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.

337 lines
11 KiB
JavaScript

10 months ago
Ext.namespace('DsTruckRpt');
DsTruckRpt.MsRptInsureIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruckRpt.MsRptInsureIndex.superclass.constructor.call(this);
};
Ext.extend(DsTruckRpt.MsRptInsureIndex, 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: 'INSUREBILLNO', type: 'string' },
{ name: 'ORGCODE', type: 'string' },
{ name: 'TRUCKNO', type: 'string' },
{ name: 'LOADCOUNT', type: 'number' },
{ name: 'BENEFICIARY', type: 'string' },
{ name: 'JQXTOTAL', type: 'number' },
{ name: 'CSXTOTAL', type: 'number' },
{ name: 'SZXTOTAL', type: 'number' },
{ name: 'CYXTOTAL', type: 'number' },
{ name: 'CCSTOTAL', type: 'number' },
{ name: 'BJMPTOTAL', type: 'number' },
{ name: 'BFTOTAL', type: 'number' },
{ name: 'INSUREBGNDATE', type: 'string' },
{ name: 'INSUREENDDATE', type: 'string' }
],
remoteSort: true,
proxy: {
type: 'ajax',
url: '/RptMng/MsRptInsure/QryData',
reader: {
id: 'BILLNO',
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: 120
}, {
sortable: true,
dataIndex: 'INSUREBILLNO',
header: '保险单号',
width: 120
}, {
sortable: true,
dataIndex: 'ORGCODE',
header: '组织编码',
width: 120
}, {
sortable: true,
dataIndex: 'TRUCKNO',
header: '车牌号',
width: 200
}, {
sortable: true,
dataIndex: 'LOADCOUNT',
header: '载重量',
width: 160
}, {
sortable: true,
dataIndex: 'BENEFICIARY',
header: '投保受益人',
width: 160
}, {
sortable: true,
dataIndex: 'JQXTOTAL',
header: '交强险',
width: 160
}, {
sortable: true,
dataIndex: 'CSXTOTAL',
header: '车损险',
width: 160
}, {
sortable: true,
dataIndex: 'SZXTOTAL',
header: '三者险',
width: 160
}, {
sortable: true,
dataIndex: 'CYXTOTAL',
header: '乘员险',
width: 160
}, {
sortable: true,
dataIndex: 'CCSTOTAL',
header: '车船税',
width: 160
}, {
sortable: true,
dataIndex: 'BJMPTOTAL',
header: '不计免赔',
width: 160
}, {
sortable: true,
dataIndex: 'BFTOTAL',
header: '保费',
width: 160
}, {
sortable: true,
dataIndex: 'INSUREBGNDATE',
header: '保险开始日期',
width: 80
}, {
sortable: true,
dataIndex: 'INSUREENDDATE',
header: '保险截止日期',
width: 80
}
],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
//#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: 'PS_TRUCKNO'
}, {
fieldLabel: '保险单号',
name: 'PS_INSUREBILLNO'
}, {
fieldLabel: '组织编码',
name: 'PS_ORGCODE'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '从保险开始日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_INSUREBGNDATEBGN'
}, {
fieldLabel: '至保险开始日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_INSUREBGNDATEEND'
}, {
fieldLabel: '从保险截止日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_INSUREENDDATEBGN'
}
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '至保险截止日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'PS_INSUREENDDATEEND'
}
]
}
]//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: 160,
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();
var sql = '';
/*
var sqldata = form.getValues();
sql = Ext.JSON.encode(sqldata);
*/
var truckno = form.findField('PS_TRUCKNO').getValue();
sql = sql + getAndConSql(sql, truckno, " A.TruckNo='" + truckno + "'");
var InsureBillNo = form.findField('PS_INSUREBILLNO').getValue();
sql = sql + getAndConSql(sql, InsureBillNo, " A.InsureBillNo='" + InsureBillNo + "'");
var orgcode = form.findField('PS_ORGCODE').getValue();
sql = sql + getAndConSql(sql, orgcode, " A.OrgCode='" + orgcode + "'");
var custDate_Min = form.findField('PS_INSUREBGNDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, custDate_Min, "A.InsureBgnDate >= '" + custDate_Min + "'");
var custDate_Max = form.findField('PS_INSUREBGNDATEEND').getRawValue();
sql = sql + getAndConSql(sql, custDate_Max, "A.InsureBgnDate <= '" + custDate_Max + " 23:59:59'");
var custendDate_Min = form.findField('PS_INSUREENDDATEBGN').getRawValue();
sql = sql + getAndConSql(sql, custendDate_Min, "A.InsureEndDate >= '" + custendDate_Min + "'");
var custendDate_Max = form.findField('PS_INSUREENDDATEEND').getRawValue();
sql = sql + getAndConSql(sql, custendDate_Max, "A.InsureEndDate <= '" + custendDate_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;
return ret;
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
}
});