extjs分组查询

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<script type="text/jscript">
        var grid;
        Ext.onReady(function () {
            Ext.QuickTips.init();
            var reader = new Ext.data.Record.create([
                      { name: 'DWDM', type: 'string' }
                    , { name: 'AZFS', type: 'string' }
                    , { name: 'ND', type: 'string' }
                    , { name: 'MXMC', type: 'string' }
                     , { name: 'ZX', type: 'string' }
                    , { name: 'ZD', type: 'string' }
                    , { name: 'PJZ', type: 'string' }
                    , { name: 'TQJG', type: 'string' }
                    , { name: 'TBZJL', type: 'string' }
                    , { name: 'SL', type: 'string' }
                    , { name: 'SR', type: 'string' }
            ]);
            var views = new Ext.grid.GroupingView({
                groupTextTpl: '{text} ({[values.rs.length]} {[values.rs.length > 1 ? "条" : "条"]})',
                startCollapsed: true
            });
            //Ext.getBody().mask("数据重新加载中,请稍等");  
            //Ext.getBody().unmask();//去除MASK 
 
            var store = cs(new Ext.data.GroupingStore({})); //首次加载的数据源
            function cs(url) {
                var store = new Ext.data.GroupingStore({
                    proxy: new Ext.data.HttpProxy({ url: url }),
                    sortInfo: { field: "MXMC", direction: "ASC" },
                    groupField: "MXMC",
                    reader: new Ext.data.JsonReader({
                        totalProperty: 'total',
                        root: 'rows',
                        successProperty: 'success',
                        fields: ['DWDM', 'AZFS', 'ND', 'MXMC', 'ZX', 'ZD', 'PJZ', 'TQJG', 'TBZJL', 'SL', 'SR']
                    })
                });
                store.addListener({
                    beforeload: function (store, records, options) {
                        Ext.getBody().mask("数据重新加载中,请稍等");
                    }
                });
                store.load({ params: { start: 0, limit: 100000 }, callback: function (records, options, success) { Ext.getBody().unmask(); } });
                return store;
            }
            function cs_(url) {
                var store = new Ext.data.GroupingStore({
                    proxy: new Ext.data.HttpProxy({ url: url }),
                    sortInfo: { field: "ND", direction: "ASC" },
                    groupField: "ND",
                    reader: new Ext.data.JsonReader({
                        totalProperty: 'total',
                        root: 'rows',
                        successProperty: 'success',
                        fields: ['DWDM', 'AZFS', 'ND', 'MXMC', 'ZX', 'ZD', 'PJZ', 'TQJG', 'TBZJL', 'SL', 'SR']
                    })
                });
                store.addListener({
                    beforeload: function (store, records, options) {
                        Ext.getBody().mask("数据重新加载中,请稍等");
                    }
                });
                store.load({ params: { start: 0, limit: 100000 }, callback: function (records, options, success) { Ext.getBody().unmask(); } });
                return store;
            }
 
            //总和
            var summary = new Ext.ux.grid.GridSummary();
            //墓型销售全局变量
            var MXXSTOTAL = "";
            var cm = new Ext.grid.ColumnModel([
                              { header: "陵园代码", hidden: true, sortable: true, dataIndex: 'DWDM', width: 100 }
                            , { header: "安葬方式", sortable: true, dataIndex: 'AZFS', width: 100 }
                            , { header: "年度", sortable: true, hidden: true, dataIndex: 'ND', width: 100 }
                            , { header: "墓型名称", sortable: true, hidden: true, dataIndex: 'MXMC', width: 100
                            , summaryType: 'count',
                                summaryRenderer: function (val, params, data) {
                                    return val ? ((val == 0 || val > 0) ? '<span style="font-weight:bold;font-size:15;color:#0000FF" >合计:共(' + val + ')条' : '(1)') : '' + '</span>';
                                    MXXSTOTAL = val;
                                }
                            }
                            , { header: "最小值", sortable: true, dataIndex: 'ZX', width: 100 }
                            , { header: "最大值", sortable: true, dataIndex: 'ZD', width: 100 }
                            , { header: "平均值", sortable: true, dataIndex: 'PJZ', width: 100 }
                           , { header: "去年同期", sortable: true, dataIndex: 'TQJG', width: 100 }
                           , { header: "同比增率", sortable: true, dataIndex: 'TBZJL', width: 100 }
                           , { header: "本年数量", sortable: true, dataIndex: 'SL', width: 100 }
                           , { header: "本年收入", sortable: true, dataIndex: 'SR', width: 100 }
        ]);
            var cm_ = new Ext.grid.ColumnModel([
                              { header: "陵园代码", sortable: true, dataIndex: 'DWDM', width: 100 }
                            , { header: "安葬方式", sortable: true, dataIndex: 'AZFS', width: 100 }
                            , { header: "年度", sortable: true, hidden: true, dataIndex: 'ND', width: 100 }
                            , { header: "墓型名称", sortable: true, hidden: true, dataIndex: 'MXMC', width: 100
                            , summaryType: 'count',
                                summaryRenderer: function (val, params, data) {
                                    return val ? ((val == 0 || val > 0) ? '<span style="font-weight:bold;font-size:15;color:#0000FF" >合计:共(' + val + ')条' : '(1)') : '' + '</span>';
                                    MXXSTOTAL = val;
                                }
                            }
                            , { header: "最小值", sortable: true, dataIndex: 'ZX', width: 100 }
                            , { header: "最大值", sortable: true, dataIndex: 'ZD', width: 100 }
                            , { header: "平均值", sortable: true, dataIndex: 'PJZ', width: 100 }
                            , { header: "去年同期", sortable: true, dataIndex: 'TQJG', width: 100 }
                            , { header: "同比增率", sortable: true, dataIndex: 'TBZJL', width: 100 }
                            , { header: "本年数量", sortable: true, dataIndex: 'SL', width: 100 }
                            , { header: "本年收入", sortable: true, dataIndex: 'SR', width: 100 }
        ]);
            //单位查询下拉框Store
            var store_DW = new Ext.data.JsonStore({
                url: "/YWBLDJ/SelectDWMC_Data"
                , totalProperty: 'total'
                , root: 'rows'
                , fields: [{ name: 'DWDM' }, { name: 'DWMC'}]
            });
            //单位查询
            var combDW = new Ext.form.ComboBox({
                emptyText: '请选择'
                , id: 'comb_DWCX'
                , width: 200
                , triggerAction: 'all'
                , lazyRender: true
                , valueField: 'DWDM'
                , displayField: 'DWMC'
                , store: store_DW
                , allowBlank: false
                , lazyRender: true
                , listClass: 'x-combo-list-small'
            })
            grid = new Ext.grid.GridPanel({
                labelAlign: 'center',
                plugins: [summary],
                store: store,
                cm: cm,
                frame: true,
                view: views,
                tbar: [
                { xtype: 'tbtext', text: '单位名称:' }, combDW, '-',
                { text: '墓型', pressed: true, handler: function () { query("mx"); }, iconCls: 'searchIcon' }
                , '-'
                , { text: '年度', pressed: true, handler: function () { query("date"); }, iconCls: 'searchIcon' }
                ],
                width: document.documentElement.clientWidth,
                height: document.documentElement.clientHeight,
                title: '墓碑价格分析表',
                loadMask: { msg: '正在加载数据,请稍侯……' },
                renderTo: 'grid',
                loadMask: true
            });
 
            function query(typ) {
                var lymc = Ext.getCmp("comb_DWCX").getValue();
                if (lymc == "") {
                    var r = window.confirm("没有输入查询条件,这样可能造成查询时间超长,确认查询?");
                    if (!r) { return; }
                }
                var url = "/MXJGFX/GetMXND?" + "lymc=" + lymc + "";
                if (typ == "mx") {
                    store = cs(url);
                    grid.reconfigure(store, cm);
                } else {
 
                    store = cs_(url);
                    grid.reconfigure(store, cm_);
                }
 
            }
        });
    </script>

  

posted @   韩梦芫  阅读(336)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
点击右上角即可分享
微信分享提示