Explorar el Código

工料机形式的定额,单价不能调价。

chenshilong hace 4 años
padre
commit
34bf98c25a
Se han modificado 1 ficheros con 16 adiciones y 38 borrados
  1. 16 38
      web/building_saas/main/js/models/calc_program.js

+ 16 - 38
web/building_saas/main/js/models/calc_program.js

@@ -809,6 +809,10 @@ let calcTools = {
       return rst;
     }
 
+    function isNeedRationPrice() {
+      return baseName.includes("定额") || baseName.includes("指标")
+    }
+
     if (
       baseName.includes("甲供") ||
       baseName.includes("甲定") ||
@@ -843,38 +847,22 @@ let calcTools = {
       }
     } else {
       if (isRCJZC(treeNode, baseName)) {
+        let mPrice = treeNode.data.marketUnitFee ? parseFloat(treeNode.data.marketUnitFee) : 0;
+        let coe = isTender ? this.tenderCoe_GLJPrice() : 1;
+
         if (calcTools.isVolumePrice(treeNode)) {
-          if (isTender) {
-            let coe = this.tenderCoe_GLJPrice();
-            if (treeNode.data.marketUnitFee)
-              result = (
-                parseFloat(treeNode.data.marketUnitFee) * coe
-              ).toDecimal(decimalObj.ration.unitPrice);
-            else result = 0;
-          } else
-            result = treeNode.data.marketUnitFee
-              ? parseFloat(treeNode.data.marketUnitFee).toDecimal(
-                  decimalObj.ration.unitPrice
-                )
-              : 0;
-        } else if (calcTools.isGljRation(treeNode)) {
-          // result = treeNode.data.basePrice ? parseFloat(treeNode.data.basePrice).toDecimal(decimalObj.ration.unitPrice) : 0;
-          // 这里要取基价或市场价,但不能直接取basePrice,受限于项目属性的三个选项。
-          if (baseName.includes("定额") || baseName.includes("指标"))
-            result = gljOprObj.getBasePrice(treeNode);
-          else
-            result = treeNode.data.marketUnitFee
-              ? parseFloat(treeNode.data.marketUnitFee).toDecimal(
-                  decimalObj.ration.unitPrice
-                )
-              : gljOprObj.getBasePrice(treeNode);
+          result = (mPrice * coe).toDecimal(decimalObj.ration.unitPrice);
+        }
+        else if (calcTools.isGljRation(treeNode)) {
+            // 这里要取基价或市场价,但不能直接取basePrice,受限于项目属性的三个选项。
+            let bPrice = gljOprObj.getBasePrice(treeNode);
+            if (mPrice == 0) mPrice = bPrice;
+            result = isNeedRationPrice() ? bPrice : (mPrice * coe).toDecimal(decimalObj.ration.unitPrice);
         }
       }
     }
 
-    let nodeQ = isTender
-      ? calcTools.uiNodeTenderQty(treeNode)
-      : calcTools.uiNodeQty(treeNode);
+    let nodeQ = isTender ? calcTools.uiNodeTenderQty(treeNode) : calcTools.uiNodeQty(treeNode);
     result = (result * nodeQ).toDecimal(decimalObj.ration.totalPrice);
     return result;
   },
@@ -1947,17 +1935,7 @@ let executeObj = {
       return calcTools.marketPriceToBase(me.treeNode, baseName, isTender);
     else {
       if (!rationCalcBases[baseName]) {
-        hintBox.infoBox(
-          "系统提示",
-          "定额基数“" +
-            baseName +
-            "”未定义,计算错误。 (模板 " +
-            me.template.ID +
-            ",规则 " +
-            me.tempCalcItem.ID +
-            ")",
-          1
-        );
+        hintBox.infoBox("系统提示", "定额基数“" + baseName + "”未定义,计算错误。 (模板 " + me.template.ID + ",规则 " + me.tempCalcItem.ID + ")", 1);
         return 0;
       } else return rationCalcBases[baseName](me.treeNode, isTender);
     }