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.

322 lines
10 KiB
JavaScript

10 months ago
//集运管理-路单查询
Ext.namespace('DsTruckRpt');
DsTruckRpt.MsRptWlTransIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruckRpt.MsRptWlTransIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruckRpt.MsRptWlTransIndex, Ext.Panel, {
PageSize: 30,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
fields: [
{ name: 'BillNo', type: 'string' },
{ name: 'RefBillNo', type: 'string'},
{ name: 'GId', type: 'string'},
{ name: 'TruckNo', type: 'string' },
{ name: 'DrvName', type: 'string' },
{ name: 'CustomerName', type: 'string' },
{ name: 'YardName', type: 'string' },
{ name: 'RtnYardName', type: 'string' },
{ name: 'DstArea', type: 'string' },
{ name: 'ExpDate', type: 'string' },
{ name: 'RealMil', type: 'number' },
{ name: 'OverLoadMil', type: 'number' },
{ name: 'NoLoadMil', type: 'number' },
{ name: 'RatedFuel', type: 'number' },
{ name: 'FuelQty', type: 'number' },
{ name: 'ContainerType', type: 'string' },
{ name: 'FixFsTotal', type: 'number' },
{ name: 'Freight', type: 'number' },
{ name: 'ExtrasFee', type: 'number' },
{ name: 'Charge', type: 'number' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/RptMng/MsRptWlTrans/GetDataList',
reader: {
id: '',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
columns: [{
sortable: true,
dataIndex: 'BillNo',
header: '路单号',
width: 130
}, {
sortable: true,
dataIndex: 'TruckNo',
header: '车号',
width: 65
}, {
sortable: true,
dataIndex: 'DrvName',
header: '司机姓名',
width: 65
}, {
sortable: true,
dataIndex: 'CustomerName',
header: '客户',
width: 100
}, {
sortable: true,
dataIndex: 'ExpDate',
header: '派车日期',
width: 70
}, {
sortable: true,
dataIndex: 'YardName',
header: '起运地',
width: 65
}, {
sortable: true,
dataIndex: 'DstArea',
header: '目的地',
width: 76
}, {
sortable: true,
dataIndex: 'RealMil',
header: '总里程',
width: 60
}, {
sortable: true,
dataIndex: 'OverLoadMil',
header: '重驶里程',
width: 60
}, {
sortable: true,
dataIndex: 'NoLoadMil',
header: '空驶里程',
width: 60
}, {
sortable: true,
dataIndex: 'RatedFuel',
header: '额定油耗',
width: 60
}, {
sortable: true,
dataIndex: 'FuelQty',
header: '加油量',
width: 60
}, {
sortable: true,
dataIndex: 'ContainerType',
header: '箱型',
width: 60
}, {
sortable: true,
dataIndex: 'FixFsTotal',
header: '运输成本',
width: 80
}, {
sortable: true,
dataIndex: 'Freight',
header: '运费',
width: 80
}, {
sortable: true,
dataIndex: 'ExtrasFee',
header: '杂费',
width: 80
}, {
sortable: true,
dataIndex: 'Charge',
header: '应付费用',
width: 80
}
],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin("/TruckMng/MsWlPc/Edit");
}, this);
//#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: 'TruckNo'
}, {
fieldLabel: '从派车日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateBgn'
},{
fieldLabel: '到派车日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ExpDateEnd'
}
]
}
]//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: 85,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeList.on('beforeload', function (store) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
}, //end initUIComponents
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var truckNo = form.findField('TruckNo').getValue();
sql = sql + getAndConSql(sql, truckNo, "TruckNo like '%" + truckNo + "%'");
var custDate_Min = form.findField('ExpDateBgn').getRawValue();
sql = sql + getAndConSql(sql, custDate_Min, "ExpDate >= '" + custDate_Min + "'");
var custDate_Max = form.findField('ExpDateEnd').getRawValue();
sql = sql + getAndConSql(sql, custDate_Max, "ExpDate <= '" + custDate_Max + " 23:59:59'");
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
ret[3] = this.SelectedRecord.data.RefBillNo;
ret[4] = "MsRptWlTransIndex";
return ret;
}
,
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
}
});