|
@@ -235,19 +235,21 @@ var projectObj = {
|
|
|
return rst;
|
|
|
},
|
|
|
updateBillsCode: function (node, value) {
|
|
|
- let project = projectObj.project;
|
|
|
+ let project = projectObj.project,me = this;
|
|
|
let stdMatchCode, formatCode, matchs;
|
|
|
let searchStdBillsAndUpdate = function (stdCode, formatCode) {
|
|
|
let orgCode = node.data.code?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);
|
|
|
+ normalUpdate(node,value);
|
|
|
} 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) {
|
|
|
//data.itemCharacter = pageCCOprObj.safeItemCharater(data.itemCharacter);
|
|
|
node.data.name = data.name;
|
|
|
+ if(node.data.type == billType.BX){//从清单库中找到标准清单的话,要把补项改成分项
|
|
|
+ node.data.type = billType.FX;
|
|
|
+ }
|
|
|
pageCCOprObj.setItemContentNode(node, data.jobContent, data.itemCharacter, node.data.name);
|
|
|
if (/\//.test(data.unit)) {
|
|
|
let existB = projectObj.project.Bills.sameStdCodeBillsData(data.code);
|
|
@@ -269,13 +271,12 @@ var projectObj = {
|
|
|
projectObj.mainController.refreshTreeNode([node], false);
|
|
|
}
|
|
|
} else {
|
|
|
- project.Bills.updateField(node.source, 'code', formatCode, true);
|
|
|
- projectObj.mainController.refreshTreeNode([node], false);
|
|
|
+ normalUpdate(node,value);
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
- if(node.data.type==billType.FX||(node.data.type==billType.BILL&&node.source.children.length==0)){//是分项或者叶子清单的情况下才需要查找替换
|
|
|
+ if(node.data.type==billType.FX||node.data.type==billType.BX||(node.data.type==billType.BILL&&node.source.children.length==0)){//是分项、补项或者叶子清单的情况下才需要查找替换
|
|
|
if (value&&value.length === 9 && /^[\d]+$/.test(value)) {
|
|
|
stdMatchCode = value;
|
|
|
formatCode = project.Bills.newFormatCode(stdMatchCode);
|
|
@@ -286,16 +287,31 @@ var projectObj = {
|
|
|
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);
|
|
|
return;
|
|
|
+ } else {
|
|
|
+ if (confirm('已存在该编码的清单,是否继续?')) {
|
|
|
+ // formatCode = project.Bills.newFormatCode(stdMatchCode, node.data.code);
|
|
|
+ searchStdBillsAndUpdate(stdMatchCode, value);
|
|
|
+ return;
|
|
|
+ }else {
|
|
|
+ this.mainController.refreshTreeNode([node], false);
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- project.Bills.updateField(node.source, 'code', value, true);
|
|
|
- this.mainController.refreshTreeNode([node], false);
|
|
|
+ normalUpdate(node,value);
|
|
|
+
|
|
|
|
|
|
+ function normalUpdate(billnode,codeValue) {//在标准库中没有找到清单时改分项为补项再更新
|
|
|
+ let toBX = false;
|
|
|
+ if(billnode.data.type == billType.FX){
|
|
|
+ billnode.data.type = billType.BX;
|
|
|
+ toBX = true;
|
|
|
+ }
|
|
|
+ project.Bills.updateField(billnode.source, 'code', codeValue, toBX);
|
|
|
+ me.mainController.refreshTreeNode([billnode], false);
|
|
|
+ }
|
|
|
},
|
|
|
updateRationCode: function (node, value) {
|
|
|
if(!isDef(node.data.code) && (!isDef(value) || value.toString().trim() == '')){
|
|
@@ -544,6 +560,7 @@ var projectObj = {
|
|
|
col.data.formatter = '@';
|
|
|
}
|
|
|
col.setAutoHeight = MainTreeCol.getEvent("setAutoHeight");
|
|
|
+ col.editChecking = MainTreeCol.getEvent("editChecking");
|
|
|
// 根据配置设置自动行高,在这里先做个标记,然后对每个单元格单独配置
|
|
|
if (col.data.field === 'name' || col.data.field === 'itemCharacterText' ||
|
|
|
col.data.field === 'jobContentText' || col.data.field === 'adjustState') {
|