TonyKang 4 rokov pred
rodič
commit
7d3d81c761

+ 5 - 0
web/building_saas/main/html/main.html

@@ -50,6 +50,7 @@
         const VERSION = '<%- version %>';
         const CUR_BOQ_TYPE = '<%- boqType %>';
         const billsUnitPriceFeature = JSON.parse('<%- billsUnitPriceFeature %>');
+        const compilationName = '<%- compilationName %>';
     </script>
 </head>
 
@@ -718,10 +719,14 @@
                             <ul class="nav flex-column nav-pills" role="tablist">
                                 <li class="nav-item"><a class="nav-link active" data-toggle="pill" href="#poj-settings-basicInfo" role="tab" id="tab_poj-settings-basicInfo">建设项目基本信息</a></li>
                                 <li class="nav-item"><a class="nav-link" data-toggle="pill" href="#poj-settings-projFeature" id="tab_poj-settings-projFeature" role="tab">工程特征</a></li>
+                                <% if (compilationName !== '内蒙古高速公路日常养护估算(2021)') { %>
                                 <li class="nav-item"><a class="nav-link" data-toggle="pill" href="#poj-settings-indicativeInfo" id="tab_poj-settings-indicativeInfo" role="tab">指标信息</a></li>
                                 <li class="nav-item"><a class="nav-link" data-toggle="pill" href="#poj-settings-4" id="about-calc" role="tab">关于计算</a></li>
+                                <% } %>
                                 <li class="nav-item"><a class="nav-link" data-toggle="pill" href="#poj-settings-billsQuanDecimal" id="tab_poj-settings-bqDecimal" role="tab">清单工程量精度</a></li>
+                                <% if (compilationName !== '内蒙古高速公路日常养护估算(2021)') { %>
                                 <li class="nav-item"><a class="nav-link" data-toggle="pill" href="#poj-settings-decimal" role="tab" id="tab_poj-settings-decimal">小数位数</a></li>
+                                <% } %>
                                 <li class="nav-item"><a class="nav-link" data-toggle="pill" href="#poj-settings-6" role="tab" id="tab_poj-settings-6">人工单价调整</a></li>
                                 <li class="nav-item"><a class="nav-link" data-toggle="pill" href="#display-setting" role="tab" id="tab_display_setting">呈现选项</a></li>
                                 <li class="nav-item"><a class="nav-link" data-toggle="pill" href="#system-setting" role="tab" id="tab_system_setting">系统选项</a></li>

+ 28 - 0
web/building_saas/main/js/views/std_billsGuidance_lib.js

@@ -174,6 +174,30 @@ const billsGuidance = (function () {
             }
         }
     };
+    if (compilationName === '内蒙古高速公路日常养护估算(2021)') {
+        bills.treeSetting.cols.push(
+            {
+                width: 100,
+                readOnly: true,
+                showHint: false,
+                head: {
+                    titleNames: ["默认指标基价"],
+                    spanCols: [1],
+                    spanRows: [1],
+                    vAlign: [1],
+                    hAlign: [1],
+                    font: ["Arial"]
+                },
+                data: {
+                    field: "baseEstUnitPrice",
+                    vAlign: 1,
+                    hAlign: 2,
+                    font: "Arial"
+                }
+            }
+        );
+        bills.headers.push({name: '默认指标基价', dataCode: 'baseEstUnitPrice', width: 100, vAlign: 'center', hAlign: 'center', formatter: '@'});
+    }
     // 获取对比树片段数据的方法,此方法可能会被覆盖,方法存在一个对象中,使得外部可以覆盖相关方法
     // 在农村公路2020中,主树对比片段与这里的逻辑是不相同的
     const overwrite = {
@@ -1117,6 +1141,10 @@ const billsGuidance = (function () {
             }
             initViews();
             let callback = function () {
+                if (compilationName === '内蒙古高速公路日常养护估算(2021)') {
+                    //给清单加点料 baseEstUnitPrice
+                    chkAndAddEstUnitPrice(rstData.bills);
+                }
                 initTree(bills, bills.workBook.getActiveSheet(), bills.treeSetting, rstData.bills);
                 if(doAfterLoadGuidance){
                     doAfterLoadGuidance();

+ 89 - 4
web/building_saas/main/js/views/std_bills_unit_price_feature.js

@@ -6,6 +6,20 @@
  * @version
  */
 
+function _chkIfEquals(orgStr, targetStr) {
+    //㎡ ㎥ 立方
+    let rst = false;
+    if (orgStr !== null && targetStr !== null) {
+        let regExp1 = new RegExp('㎡', "gm");
+        let regExp2 = new RegExp('㎥', "gm");
+        let orgS = orgStr.replace(regExp1, 'm2');
+        let targetS = targetStr.replace(regExp2, 'm3');
+        rst = (orgS === targetS);
+    }
+    return rst;
+    //
+}
+
 function chkAndSetBillsUnitPrice(billsNodes) {
     // 此方法在用户选择清单时调用(有指标基价/清单单价设置)
     if (billsUnitPriceFeature !== null) {
@@ -20,7 +34,7 @@ function chkAndSetBillsUnitPrice(billsNodes) {
                     isMatch = true;
                     if (bm.parentBasicKeys.length === billsUnitPriceFeature.feature.basicKeyOptions.length) {
                         for (let kIdx = 0; kIdx < bm.parentBasicKeys.length; kIdx++) {
-                            if (bm.parentBasicKeys[kIdx] !== 'ALL' && node.updateData[billsUnitPriceFeature.feature.basicKeyOptions[kIdx].key] !== bm.parentBasicKeys[kIdx]) {
+                            if (bm.parentBasicKeys[kIdx] !== 'ALL' && !_chkIfEquals(node.updateData[billsUnitPriceFeature.feature.basicKeyOptions[kIdx].key], bm.parentBasicKeys[kIdx]) ) {
                                 isMatch = false;
                                 break;
                             }
@@ -46,7 +60,7 @@ function chkAndSetBillsUnitPrice(billsNodes) {
                     isMatch = true;
                     if (fm.basicFactorKeys.length === billsUnitPriceFeature.feature.basicKeyOptions.length) {
                         for (let kIdx = 0; kIdx < fm.basicFactorKeys.length; kIdx++) {
-                            if (fm.basicFactorKeys[kIdx] !== 'ALL' && node.updateData[billsUnitPriceFeature.feature.basicKeyOptions[kIdx].key] !== fm.basicFactorKeys[kIdx]) {
+                            if (fm.basicFactorKeys[kIdx] !== 'ALL' && !_chkIfEquals(node.updateData[billsUnitPriceFeature.feature.basicKeyOptions[kIdx].key], fm.basicFactorKeys[kIdx]) ) {
                                 isMatch = false;
                                 break;
                             }
@@ -92,7 +106,7 @@ function chkAndResetBills() {
             // node.data[bm]
             isMatch = true;
             for (let kIdx = 0; kIdx < bm.parentBasicKeys.length; kIdx++) {
-                if (bm.parentBasicKeys[kIdx] !== 'ALL' && node.data[billsUnitPriceFeature.feature.basicKeyOptions[kIdx].key] !== bm.parentBasicKeys[kIdx]) {
+                if (bm.parentBasicKeys[kIdx] !== 'ALL' && !_chkIfEquals(node.data[billsUnitPriceFeature.feature.basicKeyOptions[kIdx].key], bm.parentBasicKeys[kIdx])) {
                     isMatch = false;
                     break;
                 }
@@ -115,7 +129,7 @@ function chkAndResetBills() {
             isMatch = true;
             if (fm.basicFactorKeys.length === billsUnitPriceFeature.feature.basicKeyOptions.length) {
                 for (let kIdx = 0; kIdx < fm.basicFactorKeys.length; kIdx++) {
-                    if (fm.basicFactorKeys[kIdx] !== 'ALL' && node.data[billsUnitPriceFeature.feature.basicKeyOptions[kIdx].key] !== fm.basicFactorKeys[kIdx]) {
+                    if (fm.basicFactorKeys[kIdx] !== 'ALL' && !_chkIfEquals(node.data[billsUnitPriceFeature.feature.basicKeyOptions[kIdx].key], fm.basicFactorKeys[kIdx])) {
                         isMatch = false;
                         break;
                     }
@@ -161,6 +175,77 @@ function chkAndResetBills() {
     });
 }
 
+function chkAndAddEstUnitPrice(orgBills) {
+    if (billsUnitPriceFeature !== null) {
+        for (const node of orgBills) {
+            //只有创建的才设置初始化单价
+            let isMatch = true;
+            // 1. 基本数量
+            // 先判断此bills是否有配置
+            let basicValue = 0;
+            for (const bm of billsUnitPriceFeature.feature.basicMappings) {
+                isMatch = true;
+                if (bm.parentBasicKeys.length === billsUnitPriceFeature.feature.basicKeyOptions.length) {
+                    for (let kIdx = 0; kIdx < bm.parentBasicKeys.length; kIdx++) {
+                        if (bm.parentBasicKeys[kIdx] !== 'ALL' && !_chkIfEquals(node[billsUnitPriceFeature.feature.basicKeyOptions[kIdx].key], bm.parentBasicKeys[kIdx])) {
+                            isMatch = false;
+                            break;
+                        }
+                    }
+                } else {
+                    isMatch = false;
+                    break;
+                }
+                if (isMatch) {
+                    //再根据相关项目属性指定基数
+                    for (const bms of bm.subs) {
+                        if (chkUnitPriceFeatureKeys(bms.keys)) {
+                            basicValue = bms.basicValue;
+                            break;
+                        }
+                    }
+                    break;
+                }
+            }
+            // 2. 相关系数(允许多个)
+            let factors = [];
+            for (const fm of billsUnitPriceFeature.feature.factorMappings) {
+                isMatch = true;
+                if (fm.basicFactorKeys.length === billsUnitPriceFeature.feature.basicKeyOptions.length) {
+                    for (let kIdx = 0; kIdx < fm.basicFactorKeys.length; kIdx++) {
+                        if (fm.basicFactorKeys[kIdx] !== 'ALL' && !_chkIfEquals(node[billsUnitPriceFeature.feature.basicKeyOptions[kIdx].key], fm.basicFactorKeys[kIdx])) {
+                            isMatch = false;
+                            break;
+                        }
+                    }
+                } else {
+                    isMatch = false;
+                    break;
+                }
+                if (isMatch) {
+                    for (const fms of fm.subs) {
+                        if (chkUnitPriceFeatureKeys(fms.keys)) {
+                            factors.push(fms.basicValue);
+                        }
+                    }
+                    // 允许多个,不break;
+                }
+            }
+            //3. 装配(指标基价 即 默认的清单单价)
+            let unitFeeVal = basicValue;
+            for (const factor of factors) {
+                unitFeeVal = unitFeeVal * parseFloat(factor);
+            }
+            if (!isNaN(parseFloat(unitFeeVal))) {
+                unitFeeVal = unitFeeVal.toFixed(2);
+                if (unitFeeVal === '0.00') unitFeeVal = '';
+            }
+            // 暂时未设小数位数 scMathUtil.roundTo(unitFeeVal,2);
+            node.baseEstUnitPrice = unitFeeVal;
+        }
+    }
+}
+
 function chkUnitPriceFeatureKeys(keys) {
     let rst = false;
     for (const subKey of keys) {