Browse Source

代码优化

chenshilong 5 years ago
parent
commit
a3d473d053
1 changed files with 20 additions and 9 deletions
  1. 20 9
      web/building_saas/main/js/models/calc_program.js

+ 20 - 9
web/building_saas/main/js/models/calc_program.js

@@ -1160,13 +1160,13 @@ let rationCalcBases = {
         return calcTools.labourDays(node, isTender);
     },
     '甲供定额基价人工费': function (node, isTender) {
-        return calcTools.partASupplyFee(node, '甲供定额基价人工费', isTender);
+        return calcTools.partASupplyFee(node, '甲供定额基价人工费', isTender, true);
     },
     '甲供定额基价材料费': function (node, isTender) {
-        return calcTools.partASupplyFee(node, '甲供定额基价材料费', isTender);
+        return calcTools.partASupplyFee(node, '甲供定额基价材料费', isTender, true);
     },
     '甲供定额基价机械费': function (node, isTender) {
-        return calcTools.partASupplyFee(node, '甲供定额基价机械费', isTender);
+        return calcTools.partASupplyFee(node, '甲供定额基价机械费', isTender, true);
     },
     '甲供主材费': function (node, isTender) {
         return calcTools.partASupplyFee(node, '甲供主材费', isTender, false);
@@ -1175,13 +1175,13 @@ let rationCalcBases = {
         return calcTools.partASupplyFee(node, '甲供设备费', isTender, false);
     },
     '甲定定额基价人工费': function (node, isTender) {
-        return calcTools.partASupplyFee(node, '甲定定额基价人工费', isTender);
+        return calcTools.partASupplyFee(node, '甲定定额基价人工费', isTender, true);
     },
     '甲定定额基价材料费': function (node, isTender) {
-        return calcTools.partASupplyFee(node, '甲定定额基价材料费', isTender);
+        return calcTools.partASupplyFee(node, '甲定定额基价材料费', isTender, true);
     },
     '甲定定额基价机械费': function (node, isTender) {
-        return calcTools.partASupplyFee(node, '甲定定额基价机械费', isTender);
+        return calcTools.partASupplyFee(node, '甲定定额基价机械费', isTender, true);
     },
     '甲定主材费': function (node, isTender) {
         return calcTools.partASupplyFee(node, '甲定主材费', isTender, false);
@@ -1808,6 +1808,16 @@ class CalcProgram {
             return ['labour', 'material', 'machine', 'mainMaterial', 'equipment'].indexOf(type) > -1;
         };
 
+        // 不能直接删除该属性,否则无法冲掉库中已存储的值。下同。
+        function deleteProperties (treeNode, propNamesArr){
+            for (let pn of propNamesArr){
+                if (treeNode.data[pn]){
+                    treeNode.data[pn] = null;
+                    treeNode.changed = true;
+                }
+            };
+        };
+
         /*删掉多余的费用。例如:从其它计算方式(有很多费)切换到公式计算方式(只需要common费),多出来的费要删除。
         fieldNameArr 值取自:遍历treeNode的计算规则,取有绑定的字段名。这些字段名以外的fee是因旧计算多出来的,需要删除。 */
         function deleteUselessFees(treeNode, fieldNameArr){
@@ -1917,9 +1927,10 @@ class CalcProgram {
         // 叶子清单无子结点、无公式计算(啥都没有时)
         else if (treeNode.calcType == treeNodeCalcType.ctNull){
             delete treeNode.data.gljList;
-
+            deleteProperties(treeNode, ['calcBase', 'calcBaseValue', 'tenderCalcBaseValue', 'programID']);
+            deleteUselessFees(treeNode, ['common', 'rationCommon']);
             // 不能直接删除该属性,否则无法冲掉库中已存储的值。下同。
-            if (treeNode.data.calcBase){
+/*            if (treeNode.data.calcBase){
                 treeNode.data.calcBase = null;
                 treeNode.changed = true;
             }
@@ -1937,7 +1948,7 @@ class CalcProgram {
             if (treeNode.data.programID) {
                 treeNode.data.programID = null;
                 treeNode.changed = true;
-            };
+            };*/
 
             // 第1、2部分以外的叶子清单在没有公式的情况下可以手工修改综合单价并参与计算。
             // 2017-09-27 需求改了,除了第 1 、 2.2部分以外,都可以手工修改综合单价、综合合价并参与计算