Browse Source

多辅助定额bug

zhangweicheng 5 năm trước cách đây
mục cha
commit
7137e87076

+ 15 - 10
modules/ration_glj/facade/glj_calculate_facade.js

@@ -68,6 +68,7 @@ async function calculateQuantity(query,noNeedCal,refreshRationName = false,areaI
             areaSetting = project.property.areaSetting;
         }
          if(impactRation._doc.hasOwnProperty("rationAssList")&&impactRation.rationAssList.length>0){
+             prepareAss(impactRation.rationAssList);
              let temTimes = [];
              let thirdRationCodes=[];
              for(let i=0;i<impactRation.rationAssList.length;i++){
@@ -376,19 +377,23 @@ function getContent(coes) {
 }
 
 function prepareAss(assList) {//处理辅助定额,支持多个辅助定额的情况
-    for(let a of assList){
-        if(a.groupList && a.groupList.length > 1){//组里有多个定额的情况
-            let newList = _.sortByAll(a.groupList,['param']);//先按参数排序
-            for(let n of newList){
-                if(a.actualValue > n.stdValue && a.actualValue <= parseFloat(n.param)){//落在中间,则用组里的这条定额
-                    a._doc.param = n.param;
-                    a._doc.paramName = n.paramName;
-                    a._doc.assistCode = n.assistCode;
-                    break;
-                }
+  for(let a of assList){
+    if(a.groupList && a.groupList.length > 1){//组里有多个定额的情况
+        let newList = _.sortByAll(a.groupList,[function(item){
+           return parseFloat(item.param)
+        }]);//先按参数排序
+        let pre = 0;
+        for(let n of newList){
+            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);
         }
     }
+  }
 }
 
 function calculateTimes(ass){

+ 0 - 2
web/building_saas/main/js/views/glj_view.js

@@ -137,10 +137,8 @@ var gljOprObj = {
     onRationGLJSelectionChange:function(sender,args){
         let me = gljOprObj;
         let selected = args.newSelections[0] ? args.newSelections[0] : {row: 0, col: 0};
-        console.log("selected changed-------");
         //这主要记录是否点击了sheet以外的地方,如果点击了sheet里的单元格,则将cancelUpdate设置为true不触发提交更新操作
         me.cancelUpdate = true;//取消延时任务由这里进行判断处理
-        console.log("change to true");
         me.sheetInitSelection(selected);
         if(me.rationGljEditObj){
             if(ifNeedUpdate(selected)){