ソースを参照

Merge branch 'master' of http://smartcost.f3322.net:3000/SmartCost/ConstructionCost

zhangweicheng 7 年 前
コミット
24c2cec337

+ 19 - 31
web/building_saas/main/js/models/calc_program.js

@@ -643,7 +643,7 @@ let calcTools = {
             summaryFees: treeNode.data.summaryFees,
             name:treeNode.data.name,
             rationQuantityCoe: treeNode.data.rationQuantityCoe,
-            quantityCoe: treeNode.data.quantityCoe,
+            quantityCoe: treeNode.data.quantityCoe == null ? {} : treeNode.data.quantityCoe,
             targetUnitFee: treeNode.data.targetUnitFee,
             targetTotalFee: treeNode.data.targetTotalFee
         };
@@ -674,6 +674,7 @@ let calcTools = {
     calcNodeTenderQty: function (treeNode){
         let qCoe = (treeNode.data.rationQuantityCoe == undefined) ? 1 : treeNode.data.rationQuantityCoe;
         treeNode.data.tenderQuantity = (this.uiNodeQty(treeNode) * qCoe).toDecimal(decimalObj.decimal("quantity", treeNode));
+        return treeNode.data.tenderQuantity;
     },
     calcGLJTenderQty: function (treeNode, glj){
         if (treeNode.data.quantityCoe == undefined){
@@ -1506,8 +1507,8 @@ class CalcProgram {
                             rttf = parseFloatPlus(node.data.feesIndex[ft.type].tenderTotalFee).toDecimal(decimalObj.bills.totalPrice);
                         };
                         if (me.project.property.billsCalcMode === leafBillGetFeeType.rationContent) {
-                            buf = (buf + (ruf * parseFloatPlus(node.data.contain)).toDecimal(decimalObj.bills.unitPrice)).toDecimal(decimalObj.process);
-                            btuf = (btuf + (rtuf * parseFloatPlus(node.data.contain)).toDecimal(decimalObj.bills.unitPrice)).toDecimal(decimalObj.process);
+                            buf = (buf + (ruf * parseFloatPlus(node.data.quantity)).toDecimal(decimalObj.bills.unitPrice)).toDecimal(decimalObj.process);
+                            btuf = (btuf + (rtuf * parseFloatPlus(node.data.tenderQuantity)).toDecimal(decimalObj.bills.unitPrice)).toDecimal(decimalObj.process);
                         };
                         sum_rtf = (sum_rtf + rtf).toDecimal(decimalObj.process);
                         sum_rttf = (sum_rttf + rttf).toDecimal(decimalObj.process);
@@ -1571,8 +1572,7 @@ class CalcProgram {
                     let ftObj = {};
                     ftObj.fieldName = 'common';
                     ftObj.unitFee = parseFloatPlus(treeNode.data.feesIndex.common.unitFee);
-                    let q = parseFloatPlus(treeNode.data.quantity);
-                    ftObj.totalFee = (ftObj.unitFee * q).toDecimal(decimalObj.bills.totalPrice);
+                    ftObj.totalFee = (ftObj.unitFee * nQ).toDecimal(decimalObj.bills.totalPrice);
                     calcTools.checkFeeField(treeNode, ftObj);
                 }
             }
@@ -1904,21 +1904,6 @@ class CalcProgram {
         return me.getTotalFee(baseNodes, excludeNodes, tender);
     };
 
-    /*clearTenders(){
-        let nodes = projectObj.project.mainTree.items;
-        for (let node of nodes) {
-            delete node.data.targetTotalFee;
-            delete node.data.targetUnitFee;
-            if (node.data.feesIndex && node.data.feesIndex.common){
-                delete node.data.feesIndex.common.tenderUnitFee;
-                delete node.data.feesIndex.common.tenderTotalFee;
-            };
-            delete node.data.quantityCoe;
-            delete node.data.rationQuantityCoe;
-        };
-        projectObj.project.property.tenderSetting.gljPriceTenderCoe = 1;
-    };*/
-
     // 反向调价
     calcTenderReverse(treeNode, tender){
         if (treeNode.data.feesIndex.common.tenderUnitFee != treeNode.data.feesIndex.common.unitFee){
@@ -1941,32 +1926,35 @@ class CalcProgram {
             coe = (treeNode.data.targetTotalFee / treeNode.data.feesIndex.common.totalFee).toDecimal(2);//(decimalObj.process);
 
         if (tender == tenderTypes.ttReverseRation){
+            treeNode.data.tenderQuantity = (treeNode.data.quantity * coe).toDecimal(decimalObj.decimal("quantity", treeNode));
             if (treeNode.data.rationQuantityCoe != coe){
                 treeNode.data.rationQuantityCoe = coe;
                 treeNode.changed = true;
             };
+
+            let ttf = (treeNode.data.tenderQuantity * treeNode.data.feesIndex.common.tenderUnitFee).toDecimal(decimalObj.decimal('totalPrice', treeNode));
+            if (treeNode.data.feesIndex.common.tenderTotalFee != ttf){
+                treeNode.data.feesIndex.common.tenderTotalFee = ttf;
+                treeNode.changed = true;
+            };
         }else if (tender == tenderTypes.ttReverseGLJ){
-            let coeObj = treeNode.data.quantityCoe;
-            if (!coeObj){
+            treeNode.data.tenderQuantity = treeNode.data.quantity;
+            let qcObj = treeNode.data.quantityCoe;
+            if (!qcObj){
                 treeNode.data.quantityCoe = {labour: coe, material: coe, machine: coe, main: coe, equipment: coe};
                 treeNode.changed = true;
             }else{
-                for (let pn in coeObj){
-                    if (coeObj[pn] != coe){
-                        coeObj[pn] = coe;
+                for (let pn in qcObj){
+                    if (qcObj[pn] != coe){
+                        qcObj[pn] = coe;
                         treeNode.changed = true;
                     }
                 };
             };
+            projectObj.project.calcProgram.calculate(treeNode, false, false, tenderTypes.ttCalc);  // 再正向算
         };
 
-        treeNode.data.tenderQuantity = (treeNode.data.quantity * coe).toDecimal(decimalObj.decimal("quantity", treeNode));
 
-        let ttf = (treeNode.data.tenderQuantity * treeNode.data.feesIndex.common.tenderUnitFee).toDecimal(decimalObj.decimal('totalPrice', treeNode));
-        if (treeNode.data.feesIndex.common.tenderTotalFee != ttf){
-            treeNode.data.feesIndex.common.tenderTotalFee = ttf;
-            treeNode.changed = true;
-        };
     };
 };
 

+ 6 - 1
web/building_saas/main/js/views/tender_price_view.js

@@ -181,7 +181,12 @@ let tender_obj={
     cleanCacheCoes: function (){
         for(let node of tender_obj.tenderTree.items){
             if (node.data.rationQuantityCoe) node.data.rationQuantityCoe = null;
-            if (node.data.quantityCoe) node.data.quantityCoe = null;
+            let qcObj = node.data.quantityCoe;
+            if (qcObj){
+                for (let pn in qcObj){
+                    qcObj[pn] = null;
+                };
+            };
         };
     },