Browse Source

查询列表关联列表查询样式统一

zhuth 7 years ago
parent
commit
a8a9a3aeb8

+ 20 - 18
frontend/saas-web/app/view/core/query/QueryGridPanel.js

@@ -38,6 +38,7 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
     initComponent: function () {
         var me = this;
         Ext.apply(me, {
+            columns: me.initColumns(),
             store: Ext.create('Ext.data.Store', {
                 fields: me.getFields(),
                 autoLoad: true,
@@ -96,9 +97,9 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
                         mode = queryPanel.getQueryMode();
                         
                         if(mode=="MAIN"){
-                            me.reconfigure(store, me.baseColumn);
+                            me.reconfigure(store, me.initColumns(me.baseColumn));
                         }else{
-                            me.reconfigure(store, me.relativeColumn);
+                            me.reconfigure(store, me.initColumns(me.relativeColumn));
                         }
                     }
                 }
@@ -214,23 +215,10 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
     listeners: {
         boxready: function(grid, width, height, eOpts) {
             var store = grid.getStore(),
-            dockedItems = grid.getDockedItems(),
-            toolbar = dockedItems[0],
-            header = dockedItems[1],
-            pagingtoolbar = dockedItems[2];
+            gridBodyBox = grid.body.dom.getBoundingClientRect(),
+            gridBodyBoxHeight = gridBodyBox.height;
 
-            var gridEl = grid.el.dom,
-            gridHeight = gridEl.getBoundingClientRect().height,
-            toolbarEl = toolbar.el.dom,
-            toolbarHeight = toolbarEl.getBoundingClientRect().height,
-            headerEl = header.el.dom,
-            headerHeight = headerEl.getBoundingClientRect().height,
-            pagingtoolbarEl = pagingtoolbar.el.dom,
-            pagingtoolbarHeight = pagingtoolbarEl.getBoundingClientRect().height;
-
-            var gridBodyHeight = gridHeight - toolbarHeight - headerHeight - pagingtoolbarHeight;
-
-            var pageSize = Math.floor(gridBodyHeight / 32);
+            var pageSize = Math.floor(gridBodyBoxHeight / 32);
 
             store.setPageSize(pageSize);
         },
@@ -246,6 +234,20 @@ Ext.define('saas.view.core.query.QueryGridPanel', {
             }
         },
     },
+    initColumns: function(columns) {
+        var me = this,
+        columns = columns || me.columns;
+
+        Ext.Array.each(columns, function(c) {
+            if(c.dataIndex == me.codeField) {
+                Ext.applyIf(c, {
+                    tdCls: 'x-querygrid-code-column'
+                });
+            }
+        });
+
+        return columns;
+    },
     getFields: function() {
         var me = this;
         return me.columns.filter(function(c) {

+ 0 - 5
frontend/saas-web/app/view/core/query/QueryPanel.js

@@ -103,11 +103,6 @@ Ext.define('saas.view.core.query.QueryPanel', {
                     align: 'end'
                 });
             }
-            if(c.dataIndex == queryGridConfig.codeField) {
-                Ext.applyIf(c, {
-                    tdCls: 'x-querygrid-code-column'
-                });
-            }
         });
 
         if(columns[columns.length - 1].flex != 1) {

+ 13 - 0
frontend/saas-web/app/view/core/report/ReportPanel.js

@@ -146,6 +146,19 @@ Ext.define('saas.view.core.report.ReportPanel', {
         me.callParent(arguments);
     },
 
+    listeners: {
+        boxready: function(p) {
+            var grid = p.down('grid');
+            var store = grid.getStore();
+            var gridBodyBox = grid.body.dom.getBoundingClientRect();
+            var gridBodyBoxHeight = gridBodyBox.height;
+
+            var pageSize = Math.floor(gridBodyBoxHeight / 32);
+
+            store.setPageSize(pageSize);
+        }
+    },
+
     getListGrid: function() {
         var me = this,
         grid = me.items.items[1];

+ 1 - 1
frontend/saas-web/app/view/purchase/purchase/QueryPanel.js

@@ -138,7 +138,7 @@ Ext.define('saas.view.purchase.purchase.QueryPanel', {
             text: 'id',
             dataIndex: 'pu_id',
             width: 100,
-            xtype: 'numbercolumn'
+            hidden: true
         }, {
             text: '单据编号',
             dataIndex: 'pu_code',