zhangweicheng 7 vuotta sitten
vanhempi
commit
590185bc55
1 muutettua tiedostoa jossa 13 lisäystä ja 4 poistoa
  1. 13 4
      web/building_saas/main/js/models/quantity_detail.js

+ 13 - 4
web/building_saas/main/js/models/quantity_detail.js

@@ -580,10 +580,19 @@ var quantity_detail = {
             if(node.children.length>0){//如果有子项则
                 for(let rationNode of node.children){
                     let EXPString = rationNode.data.quantityEXP+"";
-                    if(EXPString.indexOf("QDL")!=-1){//如果定额的工程量是通过计算出来的,则应该重新计算。
-                        let tem_contain = scMathUtil.roundForObj(rationNode.data.contain,getDecimal("process"));
-                        let tem_quantity = scMathUtil.roundForObj(value*tem_contain,getDecimal("quantity",rationNode));
-                        rationNode.data.quantity = tem_quantity;//this.autoTransformQuantity(tem_quantity,rationNode);
+                    if(EXPString.indexOf("QDL")!=-1){
+                        if(EXPString=="QDL"){//定额的工程量是直接通过清单量填进来的;
+                            let times = parseInt(rationNode.data.unit);
+                            if(isNaN(times)){
+                                times = 1;
+                            }
+                            rationNode.data.quantity = scMathUtil.roundForObj(value / times,getDecimal("quantity",rationNode));
+                            rationNode.data.contain = scMathUtil.roundForObj(rationNode.data.quantity/value,getDecimal("process"));
+                        }else {//如果定额的工程量是通过计算出来的,则应该重新计算。
+                            let tem_contain = scMathUtil.roundForObj(rationNode.data.contain,getDecimal("process"));
+                            let tem_quantity = scMathUtil.roundForObj(value*tem_contain,getDecimal("quantity",rationNode)); //this.autoTransformQuantity(tem_quantity,rationNode);
+                            rationNode.data.quantity = tem_quantity;
+                        }
                         rationNode.changed = true;
                         needUpdateChildren.push(rationNode);
                         if (rationNode.children.length>0){//如果有子工料机