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/MsOpCtnStatus/MsRptCtnPortIndex.js

293 lines
8.5 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.MsRptCtnPortIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsRptCtnPortIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsRptCtnPortIndex, Ext.Panel, {
PageSize: 1000,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
EditRecord: null,
initUIComponents: function () {
//定义数据集
var myfield = [
{ name: 'position', type: 'string' },
{ name: 'port', type: 'string' }
]
this.girdcolums = [{
sortable: true,
dataIndex: 'position',
header: '代码',
hidden: true,
width: 150
}, {
sortable: true,
dataIndex: 'port',
header: '港口',
width: 120
}
];
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.CheckBoxModel = Ext.create('Ext.selection.CheckboxModel');
//定义Grid
this.gridList = new Ext.grid.GridPanel({
// store: this.storeList,
enableHdMenu: false,
region: 'center',
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
plugins: [this.gridListCellEditing],
selModel: this.CheckBoxModel,
selType: 'cellmodel',
columns: this.girdcolums,
bbar: Ext.create('Ext.PagingToolbar', {
store: this.storeList,
displayInfo: true,
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
emptyMsg: "没有数据"
})
});
//#region formSearch 查询面板
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: 'Vessel'
}, {
fieldLabel: '航次',
name: 'Voy'
}, {
fieldLabel: 'ETD',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDDateBgn'
}, {
fieldLabel: '至',
format: 'Y-m-d',
xtype: 'datefield',
name: 'ETDDateEnd'
}]
}]//end items(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: "导出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: 30,
items: [this.panelBtn]
});
Ext.apply(this, {
items: [this.panelTop, this.gridList]
});
this.storeCodeCtn = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.CodeCtnModel',
proxy: { url: '/CommMng/BasicDataRef/GetCodeCtnList' }
});
_this = this;
this.storeCodeCtn.load({ params: { condition: "" },
callback: function (r, options, success) {
if (success) {
if (r.length != 0) {
for (i = 0; i < this.storeCodeCtn.getCount(); i += 1) {
var itemindex = i + 1;
var memberyf = this.storeCodeCtn.getAt(i);
myfield.push({ name: 'C' + memberyf.data.CTN, type: 'string' });
_this.girdcolums.push({
sortable: true,
dataIndex: 'C' + memberyf.data.CTN,
header: memberyf.data.CTN,
width: 80
});
};
}
Ext.define('CtnPort', {
extend: 'Ext.data.Model',
fields: myfield
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'CtnPort',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpCtnStatus/GetRptCtnPortData',
reader: {
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.storeList.on('beforeload', function (store) {
var sql = this.getCondition();
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
this.gridList.reconfigure(this.storeList, _this.girdcolums);
this.onRefreshClick();
}
},
scope: this
});
},
onRefreshClick: function (button, event) {
// var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition:'' },
waitMsg: "正在查询数据...",
scope: this
});
},
onClearSql: function () {
var form = this.formSearch.getForm();
form.reset();
}, //onDeleteClick
getCondition: function () {
var form = this.formSearch.getForm();
if (!form.isValid()) {
Ext.Msg.alert('提示', '查询条件赋值错误,请检查。');
return '';
}
var sql = '';
var Vessel = form.findField('Vessel').getValue();
sql = sql + getAndConSql(sql, Vessel, "(b.Vessel like '%" + Vessel + "%' )");
var Voy = form.findField('Voy').getValue();
sql = sql + getAndConSql(sql, Voy, "(b.voyage like '%" + Voy + "%' )");
var ETDDateBgn = form.findField('ETDDateBgn').getRawValue();
sql = sql + getAndConSql(sql, ETDDateBgn, "b.ETD>='" + ETDDateBgn + "'");
var ETDDateEnd = form.findField('ETDDateEnd').getRawValue();
sql = sql + getAndConSql(sql, ETDDateEnd, "b.ETD <='" + ETDDateEnd + "'");
return sql;
},
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);
},
onImportBsClick: function (button, event) {
var winAccess = new Shipping.CtnFileImport({
});
winAccess.StoreList = this.storeList;
winAccess.show();
return;
}
});