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.

571 lines
19 KiB
JavaScript

//应收应付费用列表
Ext.namespace('DsTruck');
DsTruck.RptImportFeedetailIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.RptImportFeedetailIndex.superclass.constructor.call(this);
};
//201403060002
//13号
Ext.extend(DsTruck.RptImportFeedetailIndex, Ext.Panel, {
PageSize: 500,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
idProperty: 'BSNO' + 'GID',
fields: [
{ name: 'BSNO', type: 'string' },
{ name: 'RECEIPTNAME', type: 'string' },
{ name: 'NEEDTYPE', type: 'string' },
{ name: 'NEED', type: 'string' },
{ name: 'NEEDREF', type: 'string' },
{ name: 'TRANCNO', type: 'string' },
{ name: 'R_DATE', type: 'string' },
{ name: 'GID', type: 'string' },
{ name: 'OPLBNAME', type: 'string' },
{ name: 'CREATETIME', type: 'string' },
{ name: 'CUSTNO', type: 'string' },
{ name: 'MBLNO', type: 'string' },
{ name: 'HBLNO', type: 'string' },
{ name: 'CUSTOMERNAME', type: 'string' },
{ name: 'PORTLOAD', type: 'string' },
{ name: 'PORTDISCHARGE', type: 'string' },
{ name: 'COMPANY', type: 'string' }
],
remoteSort: false,
proxy: {
type: 'ajax',
url: '/Import/RptreceiptList/GetDataList',
reader: {
id: 'Id',
root: 'data',
totalProperty: 'totalCount'
}
}
});
Ext.define('Tradermb', {
extend: 'Ext.data.Model',
idProperty: 'gid',
fields: [
{ name: 'gid', type: 'string' },
{ name: 'name', type: 'string' },
{ name: 'codename', type: 'string' }
]
});
Ext.define('companymb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'gid', type: 'string' },
{ name: 'name', type: 'string' }
]
});
this.formname = "ReceiptList";
this.storeReceiptName = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeReceiptName.load({ params: { enumTypeId: 2} });
this.comboxReceiptName = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '单据类型',
store: this.storeReceiptName,
name: 'RECEIPTNAME',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.storeOPLBNAME = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeOPLBNAME.load({ params: { enumTypeId: 96005} });
this.comboxOPLBNAME = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '业务类型',
store: this.storeOPLBNAME,
name: 'OPLBNAME',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
this.storeCompany = Ext.create('DsExt.ux.RefTableStore', {
model: 'companymb',
proxy: { url: '/CommMng/BasicDataRef/GetcompanyList' }
});
this.storeCompany.load({ params: { condition: ""} });
this.comboxCompany = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '分公司',
store: this.storeCompany,
name: 'company',
valueField: 'name',
displayField: 'name'
});
this.storeCustomer = Ext.create('DsExt.ux.RefTableStore', {
model: 'Tradermb',
proxy: { url: '/CommMng/BasicDataRef/GetTrader' }
});
this.storeCustomer.load({ params: { condition: ""} });
this.comboxCustomer = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '委托单位',
store: this.storeCustomer,
name: 'Customer',
valueField: 'name',
displayField: 'codename', flex: 1
});
this.storeport = Ext.create('DsExt.ux.RefEnumStore', {});
this.storeport.load({ params: { enumTypeId: 10} });
this.comboxport = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '目的港',
store: this.storeport,
name: 'port',
valueField: 'EnumValueName',
displayField: 'EnumValueName'
});
//////
Ext.define('Searchmb', {
extend: 'Ext.data.Model',
fields: [
{ name: 'SQLStr', type: 'string' },
{ name: 'SQLName', type: 'string' }
]
});
var SearchData = [{ "SQLStr": " need=1 ", "SQLName": "全部必需" },
{ "SQLStr": " gid is not null ", "SQLName": "全部已收发" },
{ "SQLStr": " gid is null and need=1 ", "SQLName": "全部未收发(含非必需)" },
{ "SQLStr": "", "SQLName": "全部记录(含必需/非必需、已收/未收/已发/未发 等)"}];
this.storeSearch = Ext.create('Ext.data.Store', {
model: 'Searchmb',
data: SearchData
});
this.comboxSearch = Ext.create('DsExt.ux.RefEnumCombox', {
fieldLabel: '查询的业务类型',
forceSelection: true,
store: this.storeSearch,
name: 'SearchStr',
valueField: 'SQLStr',
displayField: 'SQLName', flex: 1
, value: " need=1 "
});
this.column = [{
sortable: true, hidden: true,
dataIndex: 'BSNO',
header: 'BSNO',
width: 80
},
{
sortable: true,
dataIndex: 'RECEIPTNAME',
header: '单据名',
width: 150
},
{
sortable: true,
dataIndex: 'NEEDTYPE',
header: '单据操作',
width: 80
},
{
sortable: true, hidden: true,
dataIndex: 'NEED',
header: 'NEED',
width: 80
},
{
sortable: true,
dataIndex: 'NEEDREF',
header: '是否必需',
width: 80
},
{
sortable: true,
dataIndex: 'TRANCNO',
header: '快递号',
width: 80
},
{
sortable: true,
dataIndex: 'R_DATE',
header: '时间',
width: 150
},
{
sortable: true, hidden: true,
dataIndex: 'GID',
header: 'GID',
width: 80
},
{
sortable: true,
dataIndex: 'OPLBNAME',
header: '业务类型',
width: 80
},
{
sortable: true,
dataIndex: 'CREATETIME',
header: '业务时间',
width: 150
},
{
sortable: true,
dataIndex: 'CUSTNO',
header: '委托编号',
width: 80
},
{
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 120
},
{
sortable: true,
dataIndex: 'HBLNO',
header: '分提单号',
width: 120
},
{
sortable: true,
dataIndex: 'CUSTOMERNAME',
header: '委托单位',
width: 150
},
{
sortable: true,
dataIndex: 'PORTLOAD',
header: '装货港',
width: 80
},
{
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '卸货港',
width: 80
},
{
sortable: true,
dataIndex: 'COMPANY',
header: '分公司',
width: 80
}];
this.FeeCBModel = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
//定义Grid
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
stripeRows: true,
viewConfig: {
enableTextSelection: true,
autoFill: true
},
stateful: false,
selModel: this.FeeCBModel,
columns: [new Ext.grid.RowNumberer()],
// paging bar on the bottom
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
/////////////以下部分为获取存储的gridpanel显示样式
this.column = DsTruck.GetGridPanel(GID, this.formname, this.column);
this.column.unshift(new Ext.grid.RowNumberer());
this.gridList.reconfigure(this.storeList, this.column);
////////////////////////////
//#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: [this.comboxOPLBNAME,
this.comboxReceiptName,
{
fieldLabel: '编号',
name: 'BH', flex: 1
}, this.comboxCustomer
]
}
]//end items(fieldset 1)
}, //end fieldset 1
{//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [this.comboxCompany,
this.comboxport,
this.comboxSearch
, {
fieldLabel: '从..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArrivalDate_min'
}, {
fieldLabel: '到..到港日',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ArrivalDate_max'
}
]
}
]//end items(fieldset 2)
}//end fieldset 2
, {//-----------
xtype: 'container',
defaultType: 'textfield',
labelWidth: 90,
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}
]//end items(fieldset 2)
}//---------------------
, {//fieldset 2
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}
]//end items(fieldset 2)
}//end fieldset 2
, {//fieldset 3
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}
]//end items(fieldset 2)
}//end fieldset 3
, {//-----------
xtype: 'container',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: []
}
]//end items(fieldset 2)
}//---------------------
]//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
}, {
text: "打印",
id: "btnPrint",
iconCls: 'btnprint',
handler: function (button, event) {
this.onPrintClick(1);
},
scope: this
}, {
text: "保存列表样式",
id: "btntest",
handler: function (button, event) {
//this.column = DsTruck.SaveGridPanel(GID, this.formname, this.gridList.columns, this.column, 1, true);
var tempcolumns = this.gridList.columns;
DsTruck.SaveGridPanel(GID, this.formname, tempcolumns, this.column, 1, true);
},
scope: this
}/*,
{ text: "打印报表", menu: menu1, scope: this }*/
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 102,
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();
if (sql != "false") {
Ext.apply(store.proxy.extraParams, { condition: sql });
}
}, this);
this.onRefreshClick();
}, //end initUIComponents
onRefreshClick: function (button, event) {
if (!this.checkSearchCondition())
return;
var sql = this.getCondition();
if (sql != "false") {
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 OPLBNAME = form.findField('OPLBNAME').getValue();
sql = sql + getAndConSql(sql, OPLBNAME, "OPLBNAME = '" + OPLBNAME + "'");
var ReceiptName = form.findField('RECEIPTNAME').getValue();
sql = sql + getAndConSql(sql, ReceiptName, "ReceiptName = " + ReceiptName);
var port = form.findField('port').getValue();
sql = sql + getAndConSql(sql, port, " (portload = '" + port + "' or PORTDISCHARGE='" + port + "')");
var BH = form.findField('BH').getValue();
sql = sql + getAndConSql(sql, BH, "(CUSTNO like '%" + BH + "%' or MBLNO like '%" + BH + "%' or HBLNO like '%" + BH + "%' )");
var Customer = form.findField('Customer').getValue();
sql = sql + getAndConSql(sql, Customer, "Customername like '%" + Customer + "%'");
var company = form.findField('company').getValue();
sql = sql + getAndConSql(sql, company, " company like '%" + company + "%'");
var SearchStr = form.findField('SearchStr').getValue();
sql = sql + getAndConSql(sql, SearchStr, SearchStr);
var ArrivalDate_min = form.findField('ArrivalDate_min').getRawValue();
sql = sql + getAndConSql(sql, ArrivalDate_min, "ETD >= '" + ArrivalDate_min + "'");
var ArrivalDate_max = form.findField('ArrivalDate_max').getRawValue();
sql = sql + getAndConSql(sql, ArrivalDate_max, "ETD <= '" + ArrivalDate_max + " 23:59:59'");
return sql;
},
checkSearchCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return false;
}
return true;
},
onPrintClick: function (oper) {
PrintComm('MSRPTRECLIST'," select ROW_NUMBER() over(order by CREATETIME desc) 序号,RECEIPTNAME as 单据名,NEEDTYPE as 单据操作,TRANCNO as 快递号,R_DATE as 时间,OPLBNAME as 业务类型,CREATETIME as 业务时间,CUSTNO as 委托编号,MBLNO as 主提单号,HBLNO as 分提单号,CUSTOMERNAME as 委托单位, PORTLOAD as 装货港,PORTDISCHARGE as 卸货港,COMPANY as 分公司,case need when 1 then '必需' else '非必需' end 是否必需 from vw_ReceiptStatus where " + this.getCondition());
},
onExportClick: function (button, event) {
GridExportExcelPage(this.gridList);
},
getStrValue: function (list) {
var _list = [];
for (var _i = 0; _i < list.length; _i++) {
_list.push("'" + list[_i] + "'");
}
return _list;
}
});