Ver código fonte

在有组成物的人材机下,粘贴组成物编码后,应不要立即排序,可在切换重新读取时排序。

zhongzewei 6 anos atrás
pai
commit
ec80648348
1 arquivos alterados com 14 adições e 1 exclusões
  1. 14 1
      web/maintain/std_glj_lib/js/glj.js

+ 14 - 1
web/maintain/std_glj_lib/js/glj.js

@@ -482,7 +482,9 @@ let repositoryGljObj = {
     },
 
     getCurrentComponent: function (gljComponent, sort = false) {
-        let me = repositoryGljObj, rst = [];
+        let me = repositoryGljObj,
+            rst = [],
+            IDCodeMapping = {};
         for(let i = 0; i < gljComponent.length; i++){
             let obj = {};
             for(let j = 0; j < me.gljList.length; j++){
@@ -497,6 +499,7 @@ let repositoryGljObj = {
                     obj.consumeAmt = gljComponent[i].consumeAmt;
                     obj.consumeAmtProperty = gljComponent[i].consumeAmtProperty ? gljComponent[i].consumeAmtProperty : {};
                     rst.push(obj);
+                    IDCodeMapping[obj.ID] = obj.code;
                 }
             }
         }
@@ -507,6 +510,16 @@ let repositoryGljObj = {
                 else if(a.code < b.code) r = -1;
                 return r;
             });
+            gljComponent.sort(function (a, b) {
+                let aV = IDCodeMapping[a.ID],
+                    bV = IDCodeMapping[b.ID];
+                if (aV > bV) {
+                    return 1;
+                } else if (aV < bV) {
+                    return -1;
+                }
+                return 0;
+            });
         }
         return rst;
     },