<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>