Browse Source

fix: 公路工程量清单项目中“导入Excel清单”时,如果有一行清单跨页显示,则合并为一行清单数据。

vian 5 years atrás
parent
commit
467da14161
1 changed files with 6 additions and 1 deletions
  1. 6 1
      web/building_saas/main/js/views/importBills.js

+ 6 - 1
web/building_saas/main/js/views/importBills.js

@@ -100,6 +100,12 @@ const importBills = (function () {
             if (!code && !name || /合计/.test(code)) {   //过滤掉同时没有编号和名称的、过滤合计行
                 continue;
             }
+            // “子目号”、“单位”、“数量”都为空,“子目名称”不为空时,应将此行清单名称合并到上一行
+            let lastData = rst[rst.length - 1];
+            if (!code && !unit && !quantity && name) {
+                lastData.name += name;
+                continue;
+            }
             //表格内的数据
             code = String(code);
             let depth = getDepth(code);
@@ -114,7 +120,6 @@ const importBills = (function () {
                 depth: depth,
                 unitPriceAnalysis: 1,
             };
-            let lastData = rst[rst.length - 1];
             //获取data的父节点链,成为兄弟节点,只能在父链里找前兄弟(不能跨父链)
             let parents = getParents(lastData);
             let preData = findLast(parents, x => x.depth === depth);