TonyKang 4 gadi atpakaļ
vecāks
revīzija
cb4fa0ff24

+ 3 - 0
web/building_saas/main/js/models/project.js

@@ -552,6 +552,9 @@ var PROJECT = {
               let temObj = null;
               if(d.type == ModuleNames.bills || d.type == ModuleNames.ration){//如果是树节点类型,直接取树节点更新
                   if(d.action =="add"){
+                      if (d.data.fees) {
+                          d.data.feesIndex = getFeeIndex(d.data.fees);
+                      }
                       if(d.type == ModuleNames.ration) this.Ration.datas.push(d.data);
                       reclacQuantity = true;
                       addNodeDatas.push(d);

+ 25 - 22
web/building_saas/main/js/views/std_billsGuidance_lib.js

@@ -583,8 +583,8 @@ const billsGuidance = (function () {
                         for (const subKey of keys) {
                             let isPrjFeatureMatch = false;
                             for (let prjF of projectObj.project.projectInfo.property.projectFeature) {
-                                if (prjF.key === bmsK.key) {
-                                    if (prjF.value === bmsK.value) {
+                                if (prjF.key === subKey.key) {
+                                    if (prjF.value === subKey.value) {
                                         isPrjFeatureMatch = true;
                                         // isKeyMatch = true;
                                         break;
@@ -604,10 +604,12 @@ const billsGuidance = (function () {
                     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' && node[billsUnitPriceFeature.feature.basicKeyOptions[kIdx]] !== bm.parentBasicKeys[kIdx]) {
+                                if (bm.parentBasicKeys[kIdx] !== 'ALL' && node.updateData[billsUnitPriceFeature.feature.basicKeyOptions[kIdx].key] !== bm.parentBasicKeys[kIdx]) {
                                     isMatch = false;
                                     break;
                                 }
@@ -616,24 +618,24 @@ const billsGuidance = (function () {
                             isMatch = false;
                             break;
                         }
-                    }
-                    let basicValue = 0;
-                    if (isMatch) {
-                        //再根据相关项目属性指定基数
-                        for (const bms of billsUnitPriceFeature.feature.basicMappings.subs) {
-                            if (_chkKeys(bms.keys)) {
-                                basicValue = bms.basicValue;
-                                break;
+                        if (isMatch) {
+                            //再根据相关项目属性指定基数
+                            for (const bms of bm.subs) {
+                                if (_chkKeys(bms.keys)) {
+                                    basicValue = bms.basicValue;
+                                    break;
+                                }
                             }
+                            break;
                         }
                     }
                     // 2. 相关系数(允许多个)
                     let factors = [];
-                    isMatch = true;
                     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' && node[billsUnitPriceFeature.feature.basicKeyOptions[kIdx]] !== fm.basicFactorKeys[kIdx]) {
+                                if (fm.basicFactorKeys[kIdx] !== 'ALL' && node.updateData[billsUnitPriceFeature.feature.basicKeyOptions[kIdx].key] !== fm.basicFactorKeys[kIdx]) {
                                     isMatch = false;
                                     break;
                                 }
@@ -642,12 +644,13 @@ const billsGuidance = (function () {
                             isMatch = false;
                             break;
                         }
-                    }
-                    if (isMatch) {
-                        for (const fms of billsUnitPriceFeature.feature.factorMappings.subs) {
-                            if (_chkKeys(fms.keys)) {
-                                factors.push(fms.basicValue); // 允许多个
+                        if (isMatch) {
+                            for (const fms of fm.subs) {
+                                if (_chkKeys(fms.keys)) {
+                                    factors.push(fms.basicValue);
+                                }
                             }
+                            // 允许多个,不break;
                         }
                     }
                     //3. 装配(指标基价 即 默认的清单单价)
@@ -656,11 +659,11 @@ const billsGuidance = (function () {
                         unitFeeVal = unitFeeVal * parseFloat(factor);
                     }
                     // 暂时未设小数位数 scMathUtil.roundTo(unitFeeVal,2);
-                    node.calcFlag = 2; //当用户输入单价
-                    if (!node.hasOwnProperty('fees')) {
-                        node.fees = [];
+                    node.updateData.calcFlag = 2; //当用户输入单价
+                    if (!node.updateData.hasOwnProperty('fees')) {
+                        node.updateData.fees = [];
                     }
-                    node.fees.push({fieldName: 'common', unitFee: unitFeeVal, totalFee: 0, tenderUnitFee: unitFeeVal, tenderTotalFee: 0});
+                    node.updateData.fees.push({fieldName: 'common', unitFee: unitFeeVal, totalFee: 0, tenderUnitFee: unitFeeVal, tenderTotalFee: 0});
                 }
             }
         }