|
@@ -165,9 +165,13 @@ var projectObj = {
|
|
},
|
|
},
|
|
updateBillsCode: function (node, value) {
|
|
updateBillsCode: function (node, value) {
|
|
let project = projectObj.project;
|
|
let project = projectObj.project;
|
|
- let stdMatchCode, formatCode;
|
|
|
|
|
|
+ let stdMatchCode, formatCode, matchs;
|
|
let searchStdBillsAndUpdate = function (stdCode, formatCode) {
|
|
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;
|
|
let libId = projectInfoObj.projectInfo.engineeringInfo.bill_lib[0].id;
|
|
CommonAjax.post('/stdBillsEditor/getStdBillsByCode', {userId: userID, billsLibId: libId, code: stdCode}, function (data) {
|
|
CommonAjax.post('/stdBillsEditor/getStdBillsByCode', {userId: userID, billsLibId: libId, code: stdCode}, function (data) {
|
|
if (data) {
|
|
if (data) {
|
|
@@ -178,19 +182,21 @@ var projectObj = {
|
|
}
|
|
}
|
|
projectObj.mainController.refreshTreeNode([node], false);
|
|
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)) {
|
|
if (value.length === 9 && /^[\d]+$/.test(value)) {
|
|
stdMatchCode = value;
|
|
stdMatchCode = value;
|
|
- formatCode = project.Bills.formatCode(stdMatchCode);
|
|
|
|
|
|
+ formatCode = project.Bills.newFormatCode(stdMatchCode);
|
|
searchStdBillsAndUpdate(stdMatchCode, formatCode);
|
|
searchStdBillsAndUpdate(stdMatchCode, formatCode);
|
|
} else if (value.length === 12 && /^[\d]+$/.test(value)) {
|
|
} else if (value.length === 12 && /^[\d]+$/.test(value)) {
|
|
stdMatchCode = value.substr(0, 9);
|
|
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 {
|
|
} else {
|
|
project.Bills.updateField(node.source, 'code', value, true);
|
|
project.Bills.updateField(node.source, 'code', value, true);
|
|
this.mainController.refreshTreeNode([node], false);
|
|
this.mainController.refreshTreeNode([node], false);
|