Преглед изворни кода

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

zhangweicheng пре 3 месеци
родитељ
комит
4e06bcf110

+ 16 - 11
modules/price_info_lib/facade/index.js

@@ -186,26 +186,30 @@ async function importExcelData(libID, sheetData) {
     let curAreaName;
     let curClassName;
     let curClassID;
+    const areaIDSet = new Set();
     for (let row = 1; row < sheetData.length; row++) {
-        const areaName = sheetData[row][colMap.area] || '';
-        const className = sheetData[row][colMap.class] || '';
-        const code = sheetData[row][colMap.code] ? sheetData[row][colMap.code].trim() : '';
-        const name = sheetData[row][colMap.name] ? sheetData[row][colMap.name].trim() : '';
-        const specs = sheetData[row][colMap.specs] ? sheetData[row][colMap.specs].trim() : '';
-        const unit = sheetData[row][colMap.unit] ? sheetData[row][colMap.unit].trim() : '';
-        const noTaxPrice = sheetData[row][colMap.noTaxPrice] ? sheetData[row][colMap.noTaxPrice].trim() : '';
-        const taxPrice = sheetData[row][colMap.taxPrice] ? sheetData[row][colMap.taxPrice].trim() : '';
+        const areaName = sheetData[row][colMap.area] ? String(sheetData[row][colMap.area]).trim() : '';
+        const className = sheetData[row][colMap.class] ? String(sheetData[row][colMap.class]).trim() : '';
+        const code = sheetData[row][colMap.code] ? String(sheetData[row][colMap.code]).trim() : '';
+        const name = sheetData[row][colMap.name] ? String(sheetData[row][colMap.name]).trim() : '';
+        const specs = sheetData[row][colMap.specs] ? String(sheetData[row][colMap.specs]).trim() : '';
+        const unit = sheetData[row][colMap.unit] ? String(sheetData[row][colMap.unit]).trim() : '';
+        const noTaxPrice = sheetData[row][colMap.noTaxPrice] ? String(sheetData[row][colMap.noTaxPrice]).trim() : '';
+        const taxPrice = sheetData[row][colMap.taxPrice] ? String(sheetData[row][colMap.taxPrice]).trim() : '';
         if (!className && !code && !name && !specs && !noTaxPrice && !taxPrice) { // 认为是空数据
             continue;
         }
+        let areaChange = false;
         if (areaName && areaName !== curAreaName) {
             curAreaName = areaName;
+            areaChange = true;
         }
         const areaID = areaMap[curAreaName];
         if (!areaID) {
             continue;
         }
-        if (className && className !== curClassName) {
+        areaIDSet.add(areaID);
+        if ((className && className !== curClassName) || areaChange) {
             curClassName = className;
             const classItem = {
                 libID,
@@ -241,12 +245,13 @@ async function importExcelData(libID, sheetData) {
             taxPrice
         });
     }
+    const areaIDs = [...areaIDSet]
     if (classData.length) {
-        await priceInfoClassModel.remove({ libID });
+        await priceInfoClassModel.remove({ libID, areaID: { $in: areaIDs } });
         await priceInfoClassModel.insertMany(classData);
     }
     if (data.length) {
-        await priceInfoItemModel.remove({ libID });
+        await priceInfoItemModel.remove({ libID, areaID: { $in: areaIDs } });
         await priceInfoItemModel.insertMany(data);
     } else {
         throw 'excel没有有效数据。'

+ 9 - 0
web/maintain/report/html/rpt_tpl_dtl_info.html

@@ -135,6 +135,7 @@
                         <option value="complexConstruct">跨项目汇总对比(3个建设项目,一对多对多)</option>
                         <option value="complexConstructMultiple">各阶段项目对比(3个建设项目,多对多对多)</option>
                         <option value="complexSelfConstructMultiple">各阶段项目对比(当前建设项目对本阶段对其他阶段)</option>
+                        <option value="businessSummary">多个业务汇总</option>
                     </select>
                     <label class="form-check-label" id="outputDesignDataBar" style="display: none;">
                         <input onchange="zTreeOprObj.onChangeFlag('outputDesignData', this)"  id="outputDesignData" type="checkbox">输出设计清单
@@ -164,6 +165,14 @@
                     <option value="false">否</option>
                 </select>
             </div>
+            <div class="input-group col-2">
+                <div class="input-group-addon">汇总规则设置</div>
+                <select id="element_summaryRule_select" class="form-control" onchange="zTreeOprObj.onChangeFlag('existSummaryRule', this)">
+                    <option value="NA">N/A</option>
+                    <option value="true">是</option>
+                    <option value="false">否</option>
+                </select>
+            </div>
             <div class="input-group col-3">
                 <div class="input-group-addon">建设项目汇总类型</div>
                 <select class="form-control input-sm" id="element_constructSumFlags_select"

+ 14 - 0
web/maintain/report/js/rpt_tpl_main.js

@@ -1274,6 +1274,8 @@ let zTreeOprObj = {
                   $("#element_sumLv_flags")[0].selectedIndex = 14;
                 else if (sumLvType === "complexSelfConstructMultiple")
                   $("#element_sumLv_flags")[0].selectedIndex = 15;
+                else if (sumLvType === "businessSummary")
+                  $("#element_sumLv_flags")[0].selectedIndex = 16;
                 else {
                   $("#element_sumLv_flags")[0].selectedIndex = 0;
                 }
@@ -1311,6 +1313,18 @@ let zTreeOprObj = {
               } else {
                 $("#element_existLevel_select")[0].selectedIndex = 0;
               }
+              if (me.currentNode.flags.hasOwnProperty("existSummaryRule")) {
+                let existSummaryRule = me.currentNode.flags["existSummaryRule"];
+                if (existSummaryRule === "true") {
+                  $("#element_summaryRule_select")[0].selectedIndex = 1;
+                } else if (existSummaryRule === "false") {
+                  $("#element_summaryRule_select")[0].selectedIndex = 2;
+                } else {
+                  $("#element_summaryRule_select")[0].selectedIndex = 0;
+                }
+              } else {
+                $("#element_summaryRule_select")[0].selectedIndex = 0;
+              }
               if (me.currentNode.flags.hasOwnProperty("constructSumType")) {
                 let val = me.currentNode.flags["constructSumType"];
                 if (val === "constructSum") {