Bläddra i källkod

设备购置删除父项后费用汇总计算错误,合价小数位数调整

zhangweicheng 4 år sedan
förälder
incheckning
797ffe5e56
1 ändrade filer med 20 tillägg och 4 borttagningar
  1. 20 4
      web/building_saas/main/js/views/equipment_purchase_view.js

+ 20 - 4
web/building_saas/main/js/views/equipment_purchase_view.js

@@ -293,7 +293,7 @@ let equipmentPurchaseObj  = {
         doc.freight = freight;
         doc.sparePartCost = sparePartCost;
         doc.unitPrice = unitPrice;
-        doc.totalPrice = scMathUtil.roundForObj(quantity * unitPrice,getDecimal('glj.unitPrice'));
+        doc.totalPrice = scMathUtil.roundForObj(quantity * unitPrice,getDecimal('bills.totalPrice'));
         return newValue;
     },
     //计算序列号,返回要改变的兄弟节点数据
@@ -363,10 +363,10 @@ let equipmentPurchaseObj  = {
             //累加所有底层节点就行
             if(!this.parentMap[d.ID] && !temParentMap[d.ID] ){
                 if(deleteMap[d.ID]) continue;
-                let totalPrice = d.totalPrice?scMathUtil.roundForObj(d.totalPrice,getDecimal('glj.unitPrice')):0;
+                let totalPrice = d.totalPrice?scMathUtil.roundForObj(d.totalPrice,getDecimal('bills.totalPrice')):0;
                 let data = dataMap[d.ID];
                 if(data && gljUtil.isDef(data.doc.totalPrice))totalPrice = data.doc.totalPrice;
-                total =scMathUtil.roundForObj(total + totalPrice,getDecimal('glj.unitPrice')) 
+                total =scMathUtil.roundForObj(total + totalPrice,getDecimal('bills.totalPrice')) 
             }
         }
         return total;
@@ -381,6 +381,22 @@ let equipmentPurchaseObj  = {
         await this.updateEquipments(updateData);
        }
     },
+    getDeleteData: function(sourceID){
+      let data = [];  
+      let me = this;  
+      deleteNode(sourceID);
+      return data;
+
+       function deleteNode(ID){
+            data.push({ID,type:'delete'});
+            if(me.parentMap[ID]){
+                for(let c of me.parentMap[ID]){
+                    deleteNode(c.ID);
+                }
+            }
+       } 
+    },
+
     updateEquipments:async function(updateData){
         try {
             this.calcParent(updateData);
@@ -491,7 +507,7 @@ let equipmentPurchaseObj  = {
                 },
                 callback: function (key, opt) {
                   let row = me.rightClickTarget.row;
-                  me.updateEquipments([{ID:me.data[row].ID,type:'delete'}]);
+                  me.updateEquipments(me.getDeleteData(me.data[row].ID));
                   //me.preApplyInfoPrice(row);
                 }
               }