You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/TruckMng/Viewsjs/RPT_ly/RPT_lyIndex.js

222 lines
6.7 KiB
JavaScript

3 years ago
Ext.namespace('DsTruck');
DsTruck.RPT_lyIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.RPT_lyIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruck.RPT_lyIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'RPT_ly',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/TruckMng/RPT_ly/GetDataList',
reader: {
id: 'CUSTOMERNAME',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
columns: [{
sortable: true,
dataIndex: 'bstype',
header: '货物类型',
width: 140
}, {
sortable: true,
dataIndex: 'C40',
header: '箱形 40',
width: 100
}, {
sortable: true,
dataIndex: 'C20',
header: '箱形 20',
width: 100
}, {
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
summaryType: 'count',
width: 60
}, {
sortable: true,
dataIndex: 'zong',
header: '总费用',
summaryType: 'sum',
width: 80
}, {
sortable: true,
dataIndex: 'lyf',
header: '陆运费',
summaryType: 'sum',
width: 120
}, {
sortable: true,
dataIndex: 'zf',
header: '杂费',
summaryType: 'sum',
width: 120
}
]
});
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
this.formSearch = Ext.widget('form', {
frame: true,
region: 'center',
bodyPadding: 5,
fieldDefaults: {
margins: '2 2 2 2',
labelAlign: 'right',
flex: 1,
labelWidth: 90,
msgTarget: 'qtip'
},
items: [
{//fieldset 1
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '委托单位',
name: 'CUSTOMERNAME'
}, {
fieldLabel: '从委托日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustDate_Min'
}, {
fieldLabel: '至委托日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustDate_Max'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, {
text: "导出Excel",
id: "btnExportExcel",
iconCls: 'btnexportexcel',
handler: function (button, event) {
this.onExportClick(button, event);
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
height: 300,
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: 5000, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var CUSTOMERNAME = form.findField('CUSTOMERNAME').getRawValue();
sql = sql + getAndConSql(sql, CUSTOMERNAME, "CUSTOMERNAME like '%" + CUSTOMERNAME + "%'");
var custDate_Min = form.findField('CustDate_Min').getRawValue();
sql = sql + getAndConSql(sql, custDate_Min, "CustDate >= '" + custDate_Min + "'");
var custDate_Max = form.findField('CustDate_Max').getRawValue();
sql = sql + getAndConSql(sql, custDate_Max, "CustDate <= '" + custDate_Max + " 23:59:59'");
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = "RPT_lyIndex";
return ret;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
}
});