Browse Source

优化从表数据绑定逻辑,提升加载速度

zhuth 6 years ago
parent
commit
783cfbd5de
1 changed files with 5 additions and 10 deletions
  1. 5 10
      frontend/saas-web/app/view/core/form/FormPanel.js

+ 5 - 10
frontend/saas-web/app/view/core/form/FormPanel.js

@@ -378,17 +378,12 @@ Ext.define('saas.view.core.form.FormPanel', {
         });
 
         store.removeAll();
-        if (detailData.length > 0) {
 
-            for(let j = 0; j < detailData.length; j++) {
-                let d = detailData[j];
-                let o = {};
-                o[detnoColumn] = j + 1;
-                let r = store.add(o)[0];
-                for(let k in d) {
-                    r.set(k, d[k]);
-                }
-            }
+        if (detailData.length > 0) {
+            store.loadData(detailData.map(function(d, i) {
+                d[detnoColumn] = i + 1;
+                return d;
+            }));
         }
 
         me.isValid();