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/MvcShipping/Viewsjs/MsOpCtnFeeReport/MsOpCtnFeeReportIndex.js

375 lines
12 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.MsOpCtnFeeReportIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpCtnFeeReportIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpCtnFeeReportIndex, Ext.Panel, {
OpStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsOpCtnFeeReport',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpCtnFeeReport/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.RPTCB = 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,
selModel: this.RPTCB,
disableSelection: false,
columns: [{
sortable: false,
dataIndex: 'MBLNO',
header: '提单号',
width: 160
}, {
sortable: false,
dataIndex: 'XiangXing',
header: '箱型',
width: 160
}, {
sortable: false,
dataIndex: 'TEU',
header: 'TEU',
width: 100
}, {
sortable: false,
dataIndex: 'XiangHao',
header: '箱号',
width: 100
}, {
sortable: false,
dataIndex: 'MuDiGang',
header: '目的港',
width: 160
}, {
sortable: false,
dataIndex: 'DaoGangRiQi',
header: '到港日期',
width: 160
}, {
sortable: false,
dataIndex: 'TiXiangRiQi',
header: '提箱日期',
width: 160
}, {
sortable: false,
dataIndex: 'ChuZhaKouRiQi',
header: '出闸口日期',
width: 160
}, {
sortable: false,
dataIndex: 'HuanXiangRiQi',
header: '还箱日期',
width: 160
},
{ text: '用箱时间',
columns: [{
sortable: false,
dataIndex: 'YongXiangShiJianGangNei',
header: '港内',
width: 160
}, {
sortable: false,
dataIndex: 'YongXiangShiJianGangWai',
header: '港外',
width: 160
}]
}
, { text: '免箱使',
columns: [
{
sortable: false,
dataIndex: 'MianXiangShiGangNei',
header: '港内',
width: 160
}, {
sortable: false,
dataIndex: 'MianXiangShiGangWai',
header: '港外',
width: 160
}
]
}, { text: '超期时间',
columns: [{
sortable: false,
dataIndex: 'ChaoQiShiJianGangNei',
header: '港内',
width: 160
}, {
sortable: false,
dataIndex: 'ChaoQiShiJianGangWai',
header: '港外',
width: 160
}]
}, { text: '超期费用',
columns: [{
sortable: false,
dataIndex: 'ChaoQiFeiYongGangNei',
header: '港内',
width: 160
}, {
sortable: false,
dataIndex: 'ChaoQiFeiYongGangWai',
header: '港外',
width: 160
}]
}, {
sortable: false,
dataIndex: 'HeJi',
header: '超期箱使费合计',
width: 160
}
]
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
// this.SelectedRecord = record;
// this.OpStatus = 'edit';
// DsOpenEditWin('/MvcShipping/MsOpCtnFeeSearch/Edit');
}, this);
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
this.storeMuDiGang = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeDisportModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeDisportListRm' }
});
this.comboxMuDiGang = Ext.create('DsExt.ux.RefTableCombox', {
fieldLabel: '目的港', //'卸货港',
store: this.storeMuDiGang,
id: 'MuDiGang',
name: 'MuDiGang',
//forceSelection: true,
valueField: 'EDICODE',
queryMode: 'remote',
minChars: 1,
queryParam: 'PORT',
displayField: 'CodeAndName'
});
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.comboxMuDiGang, {
fieldLabel: '到港日期(从)',
name: 'DaoGangRiQiFrom',
format: 'Y-m-d',
xtype: 'datefield'
}, {
fieldLabel: '到港日期(到)',
name: 'DaoGangRiQiTo',
format: 'Y-m-d',
xtype: 'datefield'
}, {
fieldLabel: '对账客户',
name: 'DuiZhangKeHu'
}, { xtype: 'hidden' }, { xtype: 'hidden' }
]
}
]//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: "重置条件",
iconCls: "btnreset",
handler: function (button, event) {
},
scope: this
},
{
text: "对账",
handler: function (button, event) {
this.DuiZhang();
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 80,
items: [this.formSearch, this.panelBtn]
});
Ext.apply(this, {
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: 500, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var MuDiGang = this.comboxMuDiGang.getValue();
if (MuDiGang != '' && MuDiGang != null) {
sql = sql + getAndConSql(sql, MuDiGang, " cz = '" + MuDiGang + "'");
}
var timeP1 = '(box_no in (select box_no from container_business where 1=1 '
var timeP2 = '';
var timeP3 = '';
var DaoGangRiQiFrom = form.findField('DaoGangRiQiFrom').getRawValue();
if (DaoGangRiQiFrom != '' && DaoGangRiQiFrom != null) {
timeP2 += " jctime >= '" + DaoGangRiQiFrom + "'";
// sql = sql + getAndConSql(sql, DaoGangRiQiFrom, " jctime >= '" + DaoGangRiQiFrom + "'");
}
var DaoGangRiQiTo = form.findField('DaoGangRiQiTo').getRawValue();
if (DaoGangRiQiTo != '' && DaoGangRiQiTo != null) {
timeP3 += " jctime <= '" + DaoGangRiQiTo + "'";
//sql = sql + getAndConSql(sql, DaoGangRiQiTo, " jctime <= '" + DaoGangRiQiTo + "'");
}
var timeSql = timeP1 + (timeP2 == '' ? '' : 'and ' + timeP2) + (timeP3 == '' ? '' : 'and ' + timeP3) + ' and jcyy=\'卸船\'))';
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OpStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
},
DuiZhang: function () {
var selections = this.gridList.getSelectionModel().getSelection();
if (selections.length == 0) {
Ext.Msg.show({ title: '提示', msg: '请先选择记录!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
return;
}
var selectedRecords = [];
selectedRecords = this.gridList.selModel.getSelection();
var selectStores = [];
for (var i = 0; i < selectedRecords.length; i++) {
selectStores.push(selectedRecords[i].data);
}
var msg = '确定进行入账操作?';
Ext.MessageBox.confirm('提示', msg, function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在操作...');
Ext.Ajax.request({
waitMsg: '正在操作...',
url: '/MvcShipping/MsOpCtnFeeReport/RuZhang',
params: {
data: Ext.JSON.encode(selectStores)
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(record);
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: '警告', msg: '服务器响应出错,请重试', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
}
});