chenshilong 7 gadi atpakaļ
vecāks
revīzija
20b1f192ff

+ 1 - 7
web/building_saas/main/js/models/calc_program.js

@@ -1439,13 +1439,7 @@ class CalcProgram {
 
                 // 工料机类型的定额、定额要算暂估费
                 if (treeNode.data.type != rationType.volumePrice){
-                    if (treeNode.data.type == rationType.gljRation){
-                        let glj = JSON.parse(JSON.stringify(treeNode.data));
-                        glj.type = glj.subType;
-                        treeNode.data.gljList = [glj];
-                    }                        
-                    else
-                        treeNode.data.gljList = me.project.ration_glj.getGljArrByRation(treeNode.data.ID);
+                     treeNode.data.gljList = me.project.ration_glj.getGljArrByRation(treeNode.data);
                     // 计算程序里没有暂估费的计算规则,会漏掉,所以这里要专门算。
                     calcTools.estimateFee(treeNode);
                     fnArr.push('estimate');

+ 15 - 7
web/building_saas/main/js/models/ration_glj.js

@@ -40,13 +40,21 @@ var ration_glj = {
             this.datas = datas;
         };
 
-        ration_glj.prototype.getGljArrByRation = function (rationID) {
-            let result = this.datas.filter(function (data) {
-                return data.rationID === rationID;
-            })
-            result = gljOprObj.combineWithProjectGlj(result);
-            return result;
+        ration_glj.prototype.getGljArrByRation = function (ration) {
+            if (ration.type == rationType.gljRation){
+                let glj = JSON.parse(JSON.stringify(ration));
+                glj.type = glj.subType;
+                return [glj];
+            }
+            else{
+                let result = this.datas.filter(function (data) {
+                    return data.rationID === ration.ID;
+                })
+                result = gljOprObj.combineWithProjectGlj(result);
+                return result;
+            }
         };
+
         ration_glj.prototype.getGatherGljArrByRations = function (rations, billQuantity) {
             let result = [];
             let clone = function (obj) {
@@ -71,7 +79,7 @@ var ration_glj = {
                     result.push(ration);
                 }
                 else{
-                    let rationGljs = this.getGljArrByRation(ration.ID);
+                    let rationGljs = this.getGljArrByRation(ration);
                     for (let glj of rationGljs) {
                         let sameGlj = findGlj(glj, result);
                         if (!sameGlj) {

+ 1 - 1
web/building_saas/main/js/views/project_view.js

@@ -52,7 +52,7 @@ var projectObj = {
 
         // 基数
         // node.data.isSubcontract = true;
-        // node.data.gljList = project.ration_glj.getGljArrByRation(node.data.ID);
+        // node.data.gljList = project.ration_glj.getGljArrByRation(node.data);
         // let bname = '甲供定额基价材料费';
         // projectObj.testDisplay(bname, rationCalcBases[bname](node));
     },