Przeglądaj źródła

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/ConstructionCost

TonyKang 4 lat temu
rodzic
commit
bd5ea29067
1 zmienionych plików z 33 dodań i 5 usunięć
  1. 33 5
      web/over_write/js/chongqing_2018_export.js

+ 33 - 5
web/over_write/js/chongqing_2018_export.js

@@ -1499,11 +1499,38 @@ const XMLStandard = (function () {
             }
             //是否有清单分类,分部分项下,清单分类和清单项目不可同层存在,如果有了清单分类,则提示其他清单项目:
             //清单xx行应是清单分类,其下必须有清单项目
+            function loadSubFBFX(nodes) {
+                const rst = [];
+                nodes.forEach(node => {
+                    if (node.data.type === billType.FB) {
+                        //创建清单分部节点
+                        const fbSource = {
+                            row: detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
+                            code: node.data.code,
+                            name: node.data.name,
+                            fees: node.data.fees,
+                            remark: node.data.remark
+                        };
+                        const fb = new FBBills(fbSource);
+                        rst.push(fb);
+                        if (node.children.length) {
+                            fb.children.push(...loadSubFBFX(node.children));
+                        } else {
+                            _failList.push(`第${fbSource.row}行清单分部下至少要有一条清单。`);
+                        }
+                    } else {
+                        const fx = loadBills(node, detail);
+                        rst.push(fx);
+                    }
+                });
+                return rst;
+            }
             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) {
+                    fbfxBills.children.push(...loadSubFBFX([node]));
                     //创建清单分部节点
-                    let fbSource = {
+                   /*  let fbSource = {
                         row: detail.mainTree.nodes[detail.mainTree.prefix + node.data.ID].serialNo() + 1,
                         code: node.data.code,
                         name: node.data.name,
@@ -1511,7 +1538,7 @@ const XMLStandard = (function () {
                         remark: node.data.remark
                     };
                     if (node.children.length === 0) {
-                        _failList.push(`第${fbSource.row}行清单分部下至少要有一条清单项目。`);
+                        _failList.push(`第${fbSource.row}行清单分部下至少要有一条分部或分项。`);
                     }
                     let fbBills = new FBBills(fbSource);
                     fbfxBills.children.push(fbBills);
@@ -1520,15 +1547,16 @@ const XMLStandard = (function () {
                         //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);
+                    fbfxBills.children.push(...loadSubFBFX([node]));
+                    /* let fxBills = loadBills(node, detail);
+                    fbfxBills.children.push(fxBills); */
                 }
             }
             return fbfxBills;