Parcourir la source

Merge branch 'master' of http://192.168.1.41:3000/SmartCost/YangHuCost

vian il y a 5 ans
Parent
commit
c47b0c3855

+ 6 - 2
modules/ration_glj/facade/glj_calculate_facade.js

@@ -403,14 +403,18 @@ function getContent(coes) {
 function prepareAss(assList) {//处理辅助定额,支持多个辅助定额的情况
     for(let a of assList){
         if(a.groupList && a.groupList.length > 1){//组里有多个定额的情况
-            let newList = _.sortByAll(a.groupList,['param']);//先按参数排序
+            let newList = _.sortByAll(a.groupList,[function(item){
+               return parseFloat(item.param)
+            }]);//先按参数排序
+            let pre = 0;
             for(let n of newList){
-                if(a.actualValue > n.stdValue && a.actualValue <= parseFloat(n.param)){//落在中间,则用组里的这条定额
+                if(a.actualValue > pre && a.actualValue <= parseFloat(n.param)){//落在中间,则用组里的这条定额
                     a._doc.param = n.param;
                     a._doc.paramName = n.paramName;
                     a._doc.assistCode = n.assistCode;
                     break;
                 }
+                pre = parseFloat(n.param);
             }
         }
     }

+ 2 - 2
modules/ration_glj/facade/ration_glj_facade.js

@@ -686,7 +686,7 @@ async function insertAddTypeGLJ(rgList,compilation) {
             g.isEstimate = result.is_evaluate;
         }
         g.ID = uuidV1();
-        if (result.hasOwnProperty('subList') && result.subList.length > 0) {
+        if (result.subList && result.subList.length > 0) {
             g.subList = getMixRatioShowDatas(result.subList);
             //对于混凝土,砂浆,配合比,组成物还要插入定额工料机
             if(gljUtil.isConcreteType(g.type)){
@@ -825,7 +825,7 @@ async function replaceMixRatio(g,result,unitFileId){
             projectGLJMap[r.projectGLJID] = r;
             if(gljUtil.isConcreteType(r.type)&&r.ID!=g.ID) concreteList.push(r) //除了本身,记录一下其它混凝土类型
         }
-        if (result.hasOwnProperty('subList') && result.subList.length > 0){
+        if (result.subList && result.subList.length > 0){
             newMap =  addMixRatioToRationGLJ(g,result.subList,newRecodes,projectGLJMap);//先生成要添加的工料机
         }
         let oldMixList = await projectGljModel.getCompositionGLJByData(IDMap[g.ID],unitFileId);

+ 4 - 3
web/building_saas/main/js/views/project_glj_view.js

@@ -566,18 +566,19 @@ projectGljObject={
     },
     refreshDataSheet:function () {
         let me = projectGljObject;
+        if(!me.projectGljSpread)  return;
         let quantityCol = _.findIndex(me.projectGljSetting.header,function (header) {
             return header.dataCode ==  'quantity'|| header.dataCode == 'techQuantity' || header.dataCode =='subdivisionQuantity';
         });
         if(me.displayType == filterType.FBFX){//分部分项人材机,将“总消耗量”替换显示为“分部分项总消耗量”。
             me.projectGljSetting.header[quantityCol].dataCode = 'subdivisionQuantity';
-            me.projectGljSheet.setValue(0, quantityCol, "分部分项总消耗量", GC.Spread.Sheets.SheetArea.colHeader);
+            if(me.projectGljSheet) me.projectGljSheet.setValue(0, quantityCol, "分部分项总消耗量", GC.Spread.Sheets.SheetArea.colHeader);
         }else if(me.displayType == filterType.TECH) {//措施项目人材机,将“总消耗量”替换显示为“措施项目总消耗量”。
             me.projectGljSetting.header[quantityCol].dataCode = 'techQuantity';
-            me.projectGljSheet.setValue(0, quantityCol, "措施项目总消耗量", GC.Spread.Sheets.SheetArea.colHeader);
+            if(me.projectGljSheet) me.projectGljSheet.setValue(0, quantityCol, "措施项目总消耗量", GC.Spread.Sheets.SheetArea.colHeader);
         }else {
             me.projectGljSetting.header[quantityCol].dataCode = 'quantity';
-            me.projectGljSheet.setValue(0, quantityCol, "总消耗量", GC.Spread.Sheets.SheetArea.colHeader);
+            if(me.projectGljSheet) me.projectGljSheet.setValue(0, quantityCol, "总消耗量", GC.Spread.Sheets.SheetArea.colHeader);
         }
         if(me.displayType == filterType.SCHZ){//三材汇总树节点
             me.showMaterialTreeData();