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.

356 lines
12 KiB
JavaScript

10 months ago
Ext.namespace('Shipping');
Shipping.SeaeHistryBill = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.SeaeHistryBill.superclass.constructor.call(this);
};
Ext.extend(Shipping.SeaeHistryBill, Ext.Panel, {
PageSize: 30,
ParentWin: null,
feeType: 0,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
StoreFee: null,
StoreFeeUnit: null,
StoreFeeCust: null,
EditRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpBillModel',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeae/GetBillList',
reader: {
id: 'GId',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//#region 主grid
this.gridListCheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
selModel: this.gridListCheckBoxModel,
viewConfig: {
autoFill: true,
enableTextSelection: true
},
columns: [{
sortable: true,
dataIndex: 'MBLNO',
header: '主提单号',
width: 130
}, {
sortable: true,
dataIndex: 'VESSEL',
header: '船名',
width: 130
}, {
sortable: true,
dataIndex: 'VOYNO',
header: '航次',
width: 50
}, {
sortable: true,
dataIndex: 'ETD',
header: '开船日期',
renderer: Ext.util.Format.dateRenderer('Y-m-d'),
width: 86
}, {
sortable: true,
dataIndex: 'PORTLOAD',
header: '装货港',
width: 130
}, {
sortable: true,
dataIndex: 'PORTDISCHARGE',
header: '卸货港',
width: 130
}, {
sortable: true,
dataIndex: 'SHIPPER',
header: '发货人',
width: 130
}, {
sortable: true,
dataIndex: 'CONSIGNEE',
header: '收货人',
width: 130
}, {
sortable: true,
dataIndex: 'AGENTID',
header: '代理',
width: 130
}, {
sortable: true,
dataIndex: 'INPUTBY',
header: '录入人',
width: 80
}, {
sortable: true,
dataIndex: 'CREATETIME',
header: '录入日期',
width: 86
}, {
sortable: true,
dataIndex: 'OP',
header: '操作',
width: 80
}
],
tbar: [{
text: '批量引入',
tooltip: '批量引入',
id: "btnImport",
iconCls: "btnadddetail",
handler: function (button, event) {
this.Import(button, event);
},
scope: this
}],
// 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) {
// parentWin.formEdit.getForm().reset();
// parentWin.formEdit.getForm().setValues(record.data);
parentWin.formEdit.getForm().findField('SHIPPER').setValue(record.data.SHIPPER);
parentWin.formEdit.getForm().findField('CONSIGNEE').setValue(record.data.CONSIGNEE);
parentWin.formEdit.getForm().findField('NOTIFYPARTY').setValue(record.data.NOTIFYPARTY);
parentWin.formEdit.getForm().findField('MARKS').setValue(record.data.MARKS);
parentWin.formEdit.getForm().findField('DESCRIPTION').setValue(record.data.DESCRIPTION);
window.closeAction = 'destroy';
window.close();
}, this);
//#endregion
//#region 固定费用明细表
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
_this = this;
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: 'MblNo',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '从开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustDate_Min',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
fieldLabel: '至开船日期',
format: 'Y-m-d',
xtype: 'datefield',
name: 'CustDate_Max',
enableKeyEvents: true,
listeners: {
specialkey: function (field, e) {
if (e.getKey() == e.ENTER) {
_this.onRefreshClick();
}
}
}
}, {
xtype: 'button',
width: 90,
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}
]
}]
}]
});
//#endregion formSearch
//#region 按钮ToolBar
//#endregion
//#region 布局
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 55,
items: [this.formSearch]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
//#endregion
parentWin = window.parent.opener._this;
if (parentWin) {
this.EditRecord = parentWin.EditRecord;
}
//#region 事件绑定
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.storeList.on('load', function (store, records) {
if (store.getCount() > 0) {
this.gridList.getSelectionModel().select(0);
//this.gridListCheckBoxModel.selectAll();
}
}, this);
//#endregion
//#region 自动刷新(已经提交但是尚未审核的业务,哪怕一票货中有一笔费用没审核也显示)
// this.onAutoRefresh();
//#endregion
// this.SetBtnRight();
}, //end initUIComponents
onAutoRefresh: function () {
var sql = '';
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
Import: function (button, event) {
var selections = this.gridList.getSelectionModel().getSelection();
for (var i in selections) {
var record = selections[i];
parentWin.formEdit.getForm().findField('SHIPPER').setValue(record.data.SHIPPER);
parentWin.formEdit.getForm().findField('CONSIGNEE').setValue(record.data.CONSIGNEE);
parentWin.formEdit.getForm().findField('NOTIFYPARTY').setValue(record.data.NOTIFYPARTY);
parentWin.formEdit.getForm().findField('MARKS').setValue(record.data.MARKS);
parentWin.formEdit.getForm().findField('DESCRIPTION').setValue(record.data.DESCRIPTION);
parentWin.formEdit.getForm().findField('HBLNO').setValue("");
parentWin.opStatus = "add";
parentWin.Save("0");
}
parentWin.InitData();
window.closeAction = 'destroy';
window.close();
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var mblNo = form.findField('MblNo').getValue();
sql = sql + getAndConSql(sql, mblNo, " (MBLNO like '%" + mblNo + "%' or HBLNO like '%" + mblNo + "%') ");
var custDate_Min = form.findField('CustDate_Min').getRawValue();
sql = sql + getAndConSql(sql, custDate_Min, "ETD >= '" + custDate_Min + "'");
var custDate_Max = form.findField('CustDate_Max').getRawValue();
sql = sql + getAndConSql(sql, custDate_Max, "ETD<= '" + custDate_Max + " 23:59:59'");
return sql;
}
});