|
@@ -165,9 +165,13 @@ var projectObj = {
|
|
|
},
|
|
|
updateBillsCode: function (node, value) {
|
|
|
let project = projectObj.project;
|
|
|
- let stdMatchCode, formatCode;
|
|
|
+ let stdMatchCode, formatCode, matchs;
|
|
|
let searchStdBillsAndUpdate = function (stdCode, formatCode) {
|
|
|
- if (projectInfoObj.projectInfo.engineeringInfo.bill_lib.length > 0) {
|
|
|
+ let orgCode = node.data.code.substr(0, 9);
|
|
|
+ if (stdCode === orgCode || projectInfoObj.projectInfo.engineeringInfo.bill_lib.length === 0) {
|
|
|
+ project.Bills.updateField(node.source, 'code', formatCode, true);
|
|
|
+ projectObj.mainController.refreshTreeNode([node], false);
|
|
|
+ } else if (projectInfoObj.projectInfo.engineeringInfo.bill_lib.length > 0) {
|
|
|
let libId = projectInfoObj.projectInfo.engineeringInfo.bill_lib[0].id;
|
|
|
CommonAjax.post('/stdBillsEditor/getStdBillsByCode', {userId: userID, billsLibId: libId, code: stdCode}, function (data) {
|
|
|
if (data) {
|
|
@@ -178,26 +182,47 @@ var projectObj = {
|
|
|
}
|
|
|
projectObj.mainController.refreshTreeNode([node], false);
|
|
|
});
|
|
|
- } else {
|
|
|
- project.Bills.updateField(node.source, 'code', value, true);
|
|
|
- projectObj.mainController.refreshTreeNode([node], false);
|
|
|
}
|
|
|
}
|
|
|
if (value.length === 9 && /^[\d]+$/.test(value)) {
|
|
|
stdMatchCode = value;
|
|
|
- formatCode = project.Bills.formatCode(stdMatchCode);
|
|
|
+ formatCode = project.Bills.newFormatCode(stdMatchCode);
|
|
|
searchStdBillsAndUpdate(stdMatchCode, formatCode);
|
|
|
} else if (value.length === 12 && /^[\d]+$/.test(value)) {
|
|
|
stdMatchCode = value.substr(0, 9);
|
|
|
- formatCode = project.Bills.formatCode(stdMatchCode, value);
|
|
|
- searchStdBillsAndUpdate(stdMatchCode, formatCode);
|
|
|
+ matchs = project.Bills.sameStdCode(stdMatchCode, node.data.code);
|
|
|
+ if (matchs.indexOf(value) === -1) {
|
|
|
+ searchStdBillsAndUpdate(stdMatchCode, value);
|
|
|
+ } else if (confirm('已存在该编码的清单,是否继续?')) {
|
|
|
+ formatCode = project.Bills.newFormatCode(stdMatchCode, node.data.code);
|
|
|
+ searchStdBillsAndUpdate(stdMatchCode, formatCode);
|
|
|
+ }
|
|
|
} else {
|
|
|
project.Bills.updateField(node.source, 'code', value, true);
|
|
|
this.mainController.refreshTreeNode([node], false);
|
|
|
}
|
|
|
},
|
|
|
updateRationCode: function (node, value) {
|
|
|
-
|
|
|
+ if (/[\w]{2}[\d]{4}/.test(value)) {
|
|
|
+ if (projectInfoObj.projectInfo.engineeringInfo.ration_lib.length === 0) {
|
|
|
+ alert('当前项目无定额库,请添加定额库。');
|
|
|
+ this.mainController.refreshTreeNode([node], false);
|
|
|
+ } else {
|
|
|
+ let libId = projectInfoObj.projectInfo.engineeringInfo.ration_lib[0].id;
|
|
|
+ CommonAjax.postRationLib('/rationRepository/api/matchRation', {user_id: userID, rationLibId: libId, code: value}, function (data) {
|
|
|
+ if (data) {
|
|
|
+ projectObj.project.Ration.replaceRation(node.source, data);
|
|
|
+ projectObj.project.ration_glj.addRationGLJ(node.source, data);
|
|
|
+ } else {
|
|
|
+ alert('当前库中找不到定额"' + value + '"');
|
|
|
+ }
|
|
|
+ projectObj.mainController.refreshTreeNode([node], false);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ alert('输入的定额编码有误,请检查。');
|
|
|
+ this.mainController.refreshTreeNode([node], false);
|
|
|
+ }
|
|
|
},
|
|
|
updateCode: function (node, value) {
|
|
|
let project = projectObj.project;
|