Przeglądaj źródła

自检增加一些同层节点清单结构的限制。eg: 分部分项清单下分部与分项不可在同层

zhongzewei 6 lat temu
rodzic
commit
b3fa54060d

+ 33 - 10
web/building_saas/main/js/models/exportStandardInterface.js

@@ -534,22 +534,22 @@ const XMLStandard = (function () {
         function FXbills(source) {
             let attrs = [
                 {name: '项目编码', value: source.code, required: true, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE,
-                    failHint: `第${source.row}行清单分项-“编码”`},
+                    failHint: `第${source.row}行清单-“编码”`},
                 {name: '项目名称', value: source.name, required: true, minLen: 1, maxLen: 500, whiteSpace: WHITE_SPACE.COLLAPSE,
-                    failHint: `第${source.row}行清单分项-“名称”`},
+                    failHint: `第${source.row}行清单-“名称”`},
                 {name: '单位', value: source.unit, required: true, minLen: 1, maxLen: 20, whiteSpace: WHITE_SPACE.COLLAPSE,
-                    failHint: `第${source.row}行清单分项-“单位”`},
+                    failHint: `第${source.row}行清单-“单位”`},
                 {name: '工程量', value: source.quantity, required: true, type: TYPE.DECIMAL,
-                    failHint: `第${source.row}行清单分项-“工程量”`},
+                    failHint: `第${source.row}行清单-“工程量”`},
                 {name: '综合单价', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.unitFee') : '0', required: true, type: TYPE.DECIMAL},
                 {name: '综合合价', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'common.totalFee') : '0', required: true, type: TYPE.NUM2},
                 {name: '其中暂估价', value: exportKind === ExportKind.Tender ? getFee(source.fees, 'estimate.totalFee') : '0', required: true, type: TYPE.NUM2},
                 {name: '主要清单标志', value: !!source.mainBills, type: TYPE.BOOL,
-                    failHint: `第${source.row}行清单分项-“主要清单标志”`},
+                    failHint: `第${source.row}行清单-“主要清单标志”`},
                 {name: '暂估清单标志', value: !!source.isEstimate, type: TYPE.BOOL,
-                    failHint: `第${source.row}行清单分项-“暂估清单标志”`},
+                    failHint: `第${source.row}行清单-“暂估清单标志”`},
                 {name: '最高限价', value: exportKind === ExportKind.Control ? source.maxPrice : '0', type: TYPE.NUM2,
-                    failHint: `第${source.row}行清单分项-“最高限价”`},
+                    failHint: `第${source.row}行清单-“最高限价”`},
                 {name: '备注', value: source.remark},
             ];
             element.call(this, '清单项目', attrs);
@@ -1795,11 +1795,11 @@ const XMLStandard = (function () {
                 failList.push('不存在分部分项清单');
                 return fbfxBills;
             }
+            //是否有清单分类,分部分项下,清单分类和清单项目不可同层存在,如果有了清单分类,则提示其他清单项目:
+            //清单xx行应是清单分类,其下必须有清单项目
+            let hasBillsClass = subEngNode.children && subEngNode.children.some(node => node.children && node.children.length);
             for (let node of subEngNode.children) {
                 if (node.data.type === billType.FB) {
-                    if (node.children.length === 0) {
-                        failList.push('清单分部下至少要有一条清单项目');
-                    }
                     //创建清单分部节点
                     let fbSource = {
                         row: detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
@@ -1808,14 +1808,23 @@ const XMLStandard = (function () {
                         fees: node.data.fees,
                         remark: node.data.remark
                     };
+                    if (node.children.length === 0) {
+                        failList.push(`第${fbSource.row}行清单分部下至少要有一条清单项目。`);
+                    }
                     let fbBills = new FBBills(fbSource);
                     fbfxBills.children.push(fbBills);
                     //创建清单项目节点
                     for (let subNode of node.children) {
+                        //detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
                         let fx = loadBills(subNode, detail);
                         fbBills.children.push(fx);
                     }
                 } else {
+                    //第一层有了分部,不能有分项
+                    if (hasBillsClass) {
+                        let row = detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1;
+                        failList.push(`第${row}行清单应是清单分部,其下必须有清单项目。<span style="color: red">(错误清单结构)</span>`);
+                    }
                     let fxBills = loadBills(node, detail);
                     fbfxBills.children.push(fxBills);
                 }
@@ -1856,6 +1865,8 @@ const XMLStandard = (function () {
             }
             return csxmBills;
             function loadZZCS(parent, nodes) {
+                let hasBillsClass = nodes && nodes.some(node => node.children && node.children.length);
+                //组织措施分类和公式计算措施项不能出现在同层中
                 for (let node of nodes) {
                     if (node.children.length > 0) {    //组织措施分类
                         let classSource = {
@@ -1880,6 +1891,9 @@ const XMLStandard = (function () {
                             feeType: FEE_TYPE[getNodeFlag(node)] || FEE_TYPE['0']
                         };
                         source.calcBaseState = transformCalcBaseState(detail, source.calcBase);
+                        if (hasBillsClass) {
+                            failList.push(`第${source.row}行清单应是清单分类,其下必须有清单项目。<span style="color: red">(错误清单结构)</span>`);
+                        }
                         let formula = new FormulaCalcMeasure(source);
                         parent.children.push(formula);
                     }
@@ -1892,6 +1906,7 @@ const XMLStandard = (function () {
                 }
             }
             function loadJSCS(parent, nodes) {
+                let hasBillsClass = nodes && nodes.some(node => node.children && node.children.length);
                 for (let node of nodes) {
                     if (node.children.length > 0) {    //技术措施分类
                         let classSource = {
@@ -1903,6 +1918,10 @@ const XMLStandard = (function () {
                         parent.children.push(jscsClass);
                         loadJSCS(jscsClass, node.children);
                     } else {    //清单项目
+                        if (hasBillsClass) {
+                            let row = detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1;
+                            failList.push(`第${row}行清单应是清单分类,其下必须有清单项目。<span style="color: red">(错误清单结构)</span>`);
+                        }
                         parent.children.push(loadBills(node, detail));
                     }
                 }
@@ -2076,6 +2095,7 @@ const XMLStandard = (function () {
             }
             //加载服务费项
             function loadService(parent, nodes) {
+                let hasBillsClass = nodes && nodes.some(node => node.children && node.children.length);
                 for (let node of nodes) {
                     if (node.children.length > 0) {    //总承包服务费分类
                         let classSource = {
@@ -2098,6 +2118,9 @@ const XMLStandard = (function () {
                             fees: node.data.fees,
                             remark: node.data.remark
                         };
+                        if (hasBillsClass) {
+                            failList.push(`第${source.row}行清单应是清单分类,其下必须有清单项目。<span style="color: red">(错误清单结构)</span>`);
+                        }
                         parent.children.push(new TurnKeyContractItem(source));
                     }
                 }