Browse Source

供应商对账单、客户对账单刷新按钮控制

zhuth 7 years ago
parent
commit
8502d67bac

+ 8 - 0
frontend/saas-web/app/view/core/dbfind/DbfindTrigger.js

@@ -18,6 +18,9 @@ Ext.define('saas.view.core.dbfind.DbfindTrigger', {
     },
     //输入值之后进行模糊查询
     doQuery: function(queryString, forceAll, rawQuery) {
+        if(!this.fireEvent('beforequery', this)) {
+            return;
+        };
     	queryString = queryString || '';
     	var me = this;
     	if(me.lastQueryValue!=queryString){
@@ -308,6 +311,11 @@ Ext.define('saas.view.core.dbfind.DbfindTrigger', {
         return true;
     },
 
+    setValue: function(v) {
+        this.callParent(arguments);
+        this.publishState('value', v);
+    },
+
     getValue: function(f) {
         var me = this,val = me.rawToValue(me.processRawValue(me.getRawValue()));
         me.value = val;

+ 158 - 138
frontend/saas-web/app/view/money/report/CustomerCheck.js

@@ -11,15 +11,15 @@ Ext.define('saas.view.money.report.CustomerCheckCheck', {
     listUrl: '/api/money/report/customercheck',
     defaultCondition: null,
     reportTitle: '客户对账单',
-    QueryWidth:0.2,
-    autoLoad:false,
+    QueryWidth: 0.2,
+    autoLoad: false,
     //筛选:客户、日期(必填)
-    searchItems: [ {
+    searchItems: [{
         xtype: 'customerDbfindTrigger',
         name: 'pi_custname',
         fieldLabel: '客户名称',
         columnWidth: 0.2,
-        allowBlank:false,
+        allowBlank: false,
     }, {
         xtype: 'monthdatefield',
         name: 'ym',
@@ -32,141 +32,161 @@ Ext.define('saas.view.money.report.CustomerCheckCheck', {
         columnWidth: 0.4
     }],
 
-    reportColumns: [
-        {
-            text: 'id',
-            dataIndex: 'pi_id',
-            hidden: true
-        }, {
-            text: '单号',
-            dataIndex: 'pi_inoutno',
-            width: 150
-        }, {
-            text: '单据类型',
-            dataIndex: 'pi_class',
-            width: 110
-        }, {
-            text: '单据日期',
-            dataIndex: 'pi_date',
-            xtype: 'datecolumn',
-            width: 110
-        }, {
-            text: '序号',
-            dataIndex: 'pd_pdno',
-            xtype: 'numbercolumn',
-            width: 80
-        },{
-            text: '物料编号',
-            width: 150,
-            dataIndex: 'pr_code'
-        }, {
-            text: '物料名称',
-            dataIndex: 'pr_detail',
-            width: 200
-        }, {
-            text: '物料规格',
-            dataIndex: 'pr_spec',
-            width: 150
-        }, {
-            text: '单位',
-            dataIndex: 'pd_unit',
-            width: 80
-        }, {
-            text: '数量',
-            xtype: 'numbercolumn',
-            dataIndex: 'qty',
-            xtype: 'numbercolumn',
-            width: 110
-        }, {
-            text: '单价',
-            dataIndex: 'pd_orderprice',
-            xtype: 'numbercolumn',
-            width: 110
-        }, {
-            text: '税率',
-            dataIndex: 'pd_taxrate',
-            xtype: 'numbercolumn',
-            width: 80
-        }, {
-            text: '金额',
-            xtype: 'numbercolumn',
-            width: 110,
-            dataIndex: 'pd_total',
-            xtype: 'numbercolumn',
-            // renderer : function(v) {
-            //     var arr = (v + '.').split('.');
-            //     var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
-            //     var format = '0,000.' + xr.join();
-            //     return Ext.util.Format.number(v, format);
-            // },
-            // summaryType: 'sum',
-            // summaryRenderer: function(v) {
-            //     var arr = (v + '.').split('.');
-            //     var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
-            //     var format = '0,000.' + xr.join();
-            //     return Ext.util.Format.number(v, format);
-            // }
-        }, {
-            text: '不含税单价',
-            width: 110,
-            dataIndex: 'pd_netprice',
-            xtype: 'numbercolumn'
-        }, {
-            text: '不含税金额',
-            width: 110,
-            xtype: 'numbercolumn',
-            dataIndex: 'pd_nettotal',
-            xtype: 'numbercolumn',
-            // renderer : function(v) {
-            //     var arr = (v + '.').split('.');
-            //     var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
-            //     var format = '0,000.' + xr.join();
-            //     return Ext.util.Format.number(v, format);
-            // },
-            // summaryType: 'sum',
-            // summaryRenderer: function(v) {
-            //     var arr = (v + '.').split('.');
-            //     var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
-            //     var format = '0,000.' + xr.join();
-            //     return Ext.util.Format.number(v, format);
-            // }
-        }, {
-            text: '备注',
-            dataIndex: 'pd_remark',
-            width: 250
-        }, {
-            text: '期初应付',
-            dataIndex: 'beginamount',
-            hidden: true,
-            width: 0,
-            summaryType: 'cus',
-        }, {
-            text: '本期发生',
-            dataIndex: 'nowamount',
-            hidden: true,
-            width: 0,
-            summaryType: 'cus',
-        }, {
-            text: '本期付款',
-            dataIndex: 'nowpay',
-            hidden: true,
-            width: 0,
-            summaryType: 'cus',
-        }, {
-            text: '本期结余',
-            dataIndex: 'nowbalance',
-            hidden: true,
-            width: 0,
-            summaryType: 'cus',
-        }],
-        applyParams: function(p) {
-            var me = this,
+    reportColumns: [{
+        text: 'id',
+        dataIndex: 'pi_id',
+        hidden: true
+    }, {
+        text: '单号',
+        dataIndex: 'pi_inoutno',
+        width: 150
+    }, {
+        text: '单据类型',
+        dataIndex: 'pi_class',
+        width: 110
+    }, {
+        text: '单据日期',
+        dataIndex: 'pi_date',
+        xtype: 'datecolumn',
+        width: 110
+    }, {
+        text: '序号',
+        dataIndex: 'pd_pdno',
+        xtype: 'numbercolumn',
+        width: 80
+    }, {
+        text: '物料编号',
+        width: 150,
+        dataIndex: 'pr_code'
+    }, {
+        text: '物料名称',
+        dataIndex: 'pr_detail',
+        width: 200
+    }, {
+        text: '物料规格',
+        dataIndex: 'pr_spec',
+        width: 150
+    }, {
+        text: '单位',
+        dataIndex: 'pd_unit',
+        width: 80
+    }, {
+        text: '数量',
+        xtype: 'numbercolumn',
+        dataIndex: 'qty',
+        xtype: 'numbercolumn',
+        width: 110
+    }, {
+        text: '单价',
+        dataIndex: 'pd_orderprice',
+        xtype: 'numbercolumn',
+        width: 110
+    }, {
+        text: '税率',
+        dataIndex: 'pd_taxrate',
+        xtype: 'numbercolumn',
+        width: 80
+    }, {
+        text: '金额',
+        xtype: 'numbercolumn',
+        width: 110,
+        dataIndex: 'pd_total',
+        xtype: 'numbercolumn',
+        // renderer : function(v) {
+        //     var arr = (v + '.').split('.');
+        //     var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
+        //     var format = '0,000.' + xr.join();
+        //     return Ext.util.Format.number(v, format);
+        // },
+        // summaryType: 'sum',
+        // summaryRenderer: function(v) {
+        //     var arr = (v + '.').split('.');
+        //     var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
+        //     var format = '0,000.' + xr.join();
+        //     return Ext.util.Format.number(v, format);
+        // }
+    }, {
+        text: '不含税单价',
+        width: 110,
+        dataIndex: 'pd_netprice',
+        xtype: 'numbercolumn'
+    }, {
+        text: '不含税金额',
+        width: 110,
+        xtype: 'numbercolumn',
+        dataIndex: 'pd_nettotal',
+        xtype: 'numbercolumn',
+        // renderer : function(v) {
+        //     var arr = (v + '.').split('.');
+        //     var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
+        //     var format = '0,000.' + xr.join();
+        //     return Ext.util.Format.number(v, format);
+        // },
+        // summaryType: 'sum',
+        // summaryRenderer: function(v) {
+        //     var arr = (v + '.').split('.');
+        //     var xr = (new Array(arr[1].length > 2 ? 2 : arr[1].length)).fill('0');
+        //     var format = '0,000.' + xr.join();
+        //     return Ext.util.Format.number(v, format);
+        // }
+    }, {
+        text: '备注',
+        dataIndex: 'pd_remark',
+        width: 250
+    }, {
+        text: '期初应付',
+        dataIndex: 'beginamount',
+        hidden: true,
+        width: 0,
+        summaryType: 'cus',
+    }, {
+        text: '本期发生',
+        dataIndex: 'nowamount',
+        hidden: true,
+        width: 0,
+        summaryType: 'cus',
+    }, {
+        text: '本期付款',
+        dataIndex: 'nowpay',
+        hidden: true,
+        width: 0,
+        summaryType: 'cus',
+    }, {
+        text: '本期结余',
+        dataIndex: 'nowbalance',
+        hidden: true,
+        width: 0,
+        summaryType: 'cus',
+    }],
+
+    listeners: {
+        afterrender: function(panel) {
+            panel.setLoadButtonDisabled(true);
+        },
+    },
+
+    setLoadButtonDisabled: function (disabled) {
+        var panel = this,
+            grid = panel.down('grid'),
+            p = grid.down('pagingtoolbar'),
+            bs = p.query('button'),
+            loadButton = Ext.Array.findBy(bs, function (b) {
+                return b.iconCls == 'x-tbar-loading';
+            });
+
+        if (loadButton) {
+            loadButton.setDisabled(disabled);
+        }
+    },
+
+    applyParams: function (p) {
+        var me = this,
             viewModel = me.getViewModel(),
             formData = viewModel.get('form'),
             ym = formData.ym;
-    
-            return Ext.Object.merge(p, {
-                ym: ym
-            });
-        }
+
+        return Ext.Object.merge(p, {
+            ym: ym
+        });
+    }
 });

+ 13 - 1
frontend/saas-web/app/view/money/report/CustomerCheckModel.js

@@ -1,4 +1,16 @@
 Ext.define('saas.view.money.report.CustomerCheckModel', {
     extend: 'saas.view.core.report.ReportPanelModel',
-    alias: 'viewmodel.money-report-customercheck'
+    alias: 'viewmodel.money-report-customercheck',
+
+    formulas: {
+        pi_custname_change: {
+            bind: '{form.pi_custname}',
+            get: function(v) {
+                var me = this,
+                panel = me.getView();
+
+                panel.setLoadButtonDisabled(!v);
+            }
+        }
+    }
 });

+ 22 - 1
frontend/saas-web/app/view/money/report/VendorCheck.js

@@ -19,7 +19,7 @@ Ext.define('saas.view.money.report.VendorCheck', {
         name: 'pi_vendname',
         fieldLabel: '供应商名称',
         columnWidth: 0.2,
-        allowBlank:false,
+        allowBlank:false
     }, {
         xtype: 'monthdatefield',
         name: 'ym',
@@ -164,6 +164,27 @@ Ext.define('saas.view.money.report.VendorCheck', {
         width: 0,
         summaryType: 'cus',
     }],
+
+    listeners: {
+        afterrender: function(panel) {
+            panel.setLoadButtonDisabled(true);
+        },
+    },
+
+    setLoadButtonDisabled: function (disabled) {
+        var panel = this,
+            grid = panel.down('grid'),
+            p = grid.down('pagingtoolbar'),
+            bs = p.query('button'),
+            loadButton = Ext.Array.findBy(bs, function (b) {
+                return b.iconCls == 'x-tbar-loading';
+            });
+
+        if (loadButton) {
+            loadButton.setDisabled(disabled);
+        }
+    },
+
     applyParams: function(p) {
         var me = this,
         viewModel = me.getViewModel(),

+ 14 - 1
frontend/saas-web/app/view/money/report/VendorCheckModel.js

@@ -1,4 +1,17 @@
 Ext.define('saas.view.money.report.VendorCheckModel', {
     extend: 'saas.view.core.report.ReportPanelModel',
-    alias: 'viewmodel.money-report-vendorcheck'
+    alias: 'viewmodel.money-report-vendorcheck',
+
+    formulas: {
+        pi_vendname_change: {
+            bind: '{form.pi_vendname}',
+            get: function(v) {
+                var me = this,
+                panel = me.getView();
+
+                panel.setLoadButtonDisabled(!v);
+            }
+        }
+    }
+
 });