Browse Source

feat: 子目换算检查

zhangweicheng 3 years ago
parent
commit
d4a39e6e5a
1 changed files with 11 additions and 11 deletions
  1. 11 11
      web/maintain/ration_repository/js/ration_coe.js

+ 11 - 11
web/maintain/ration_repository/js/ration_coe.js

@@ -327,17 +327,17 @@ var rationCoeOprObj = {
                     sheetCommonObj.cleanData(me.sheet, me.setting, -1);
                     if (result.data) {
                         var tempResult = [];
-                        for (let obj of result.data) {
-                            for(let i = 0, len = coeList.length; i < len; i++){
-                                if(obj.ID === coeList[i].ID){
-                                    obj.no = coeList[i].no;
-                                    tempResult.push(obj);
-                                    break;
-                                }
-                            }
-                        };
-
-
+                        let stdMap = _.indexBy(result.data,'ID');
+                        for(let i = 0, len = coeList.length; i < len; i++){
+                            let obj = stdMap[coeList[i].ID];
+                            if(obj){
+                                obj.no = coeList[i].no;  
+                            }else{
+                               obj= {ID:coeList[i].ID,no:coeList[i].no,serialNo:-999,name:'引用错误或子目已被删除'} 
+                            } 
+                            tempResult.push(obj);                           
+                        }
+                        
                         me.cache["_Coe_" + ration.ID] = tempResult;
 
                         me.showCoeItems(ration.ID);