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.

327 lines
11 KiB
JavaScript

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

Ext.namespace('Shipping');
Shipping.MsOpSeaeEdiTemplateIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpSeaeEdiTemplateIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpSeaeEdiTemplateIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
this.formname = 'MsOpSeaeEdiTemplateIndex';
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsOpSeaeEdiTemplate',
pageSize: 30,
// autoLoad: { start: 0, limit: 30 },
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpSeaeEdiTemplate/GetDataList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
//定义Grid
this.WMSCB = Ext.create('Ext.selection.CheckboxModel', { checkOnly: true });
this.columns = [{
sortable: true,
dataIndex: 'gid',
header: 'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'TEMPLATENAME',
header: '模板名称',
width: 100
}, {
sortable: true,
dataIndex: 'TYPE',
header: '模板类型',
width: 100,
renderer: function (value, meta, record) {
var v = '';
if (record.data.TYPE == 'S') {
v = '收货人';
} else if (record.data.TYPE == 'F') {
v = '发货人';
} else if (record.data.TYPE == 'SE') {
v = '卖方';
} else if (record.data.TYPE == 'BY') {
v = '买方';
} else if (record.data.TYPE == 'ST') {
v = '货物送达';
} else if (record.data.TYPE == 'LG') {
v = '装柜';
} else if (record.data.TYPE == 'MF') {
v = '工厂';
} else if (record.data.TYPE == 'CS') {
v = '拼箱公司';
} else if (record.data.TYPE == 'IM') {
v = '进口商';
} else {
v = '通知人';
}
return v;
}
}, {
sortable: false,
dataIndex: 'NAME',
header: '名称',
width: 200
}, {
sortable: true,
dataIndex: 'ADDRESS',
header: '地址',
width: 120
}, {
sortable: true,
dataIndex: 'COUNTRY',
header: '国家',
width: 120
}, {
sortable: true,
dataIndex: 'CODETYPE',
header: '代码类型',
width: 120
}, {
sortable: true,
dataIndex: 'CODE',
header: '代码',
width: 80
}, {
sortable: true,
dataIndex: 'TEL',
header: '电话',
width: 80
}, {
sortable: true,
dataIndex: 'CreateTime',
header: '创建时间',
width: 80
}
];
this.girdcolums = this.columns;
this.girdcolums = DsTruck.GetGridPanel(GID, this.formname, this.girdcolums, 0); //使用者id表名中间column数组跳过一开始的几列
this.gridList = new Ext.grid.GridPanel({
store: this.storeList,
enableHdMenu: false,
region: 'center',
selModel: this.WMSCB,
loadMask: { msg: "数据加载中,请稍等..." },
trackMouseOver: true,
disableSelection: false,
features: [{
ftype: 'summary'//Ext.grid.feature.Summary表格汇总特性
}],
columns: this.girdcolums,
bbar: [{
xtype: 'pagingtoolbar',
store: this.storeList,
displayInfo: true
}]
});
this.gridList.addListener('itemdblclick', function (dataview, record, item, index, e, b) {
this.SelectedRecord = record;
this.OprationStatus = 'edit';
DsOpenEditWin("/MvcShipping/MsOpSeaeEdiTemplate/Edit", "", "195", "650");
}, this);
//#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',
flex: 1,
defaults: {
anchor: '30%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '模板名称或名称',
name: 'KeyWords'
}
]
}
]//end items(fieldset 1)
}//end fieldset 1
]//end root items
});
//#endregion formSearch
//查询工具条
_this = this;
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
text: '新建',
iconCls: "btnadd",
handler: function (menu, event) {
_this.OprationStatus = 'add';
DsOpenEditWin("/MvcShipping/MsOpSeaeEdiTemplate/Edit", "", "195", "650");
},
scope: this
}, '-',
{
text: "删除",
iconCls: "btndelete",
handler: function (button, event) {
this.onDeleteClick(button, event);
},
scope: this
},
'-',
{
text: "执行查询",
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
}, '-', {
text: "保存列表样式",
menu: [{ text: "保存",
handler: function (button, event) {
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.girdcolums, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}, { text: "初始化",
handler: function (menu, event) {
_this.formWMSINBody.reconfigure(_this.storeList, _this.columns);
_this.girdcolums = DsTruck.SaveGridPanel(GID, _this.formname, _this.gridList.columns, _this.columns, 0, true); //使用者id表名中间column数组跳过一开始的几列
}
}],
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 100,
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);
this.onRefreshClick();
}, //end initUIComponents
onRefreshClick: function (button, event) {
var sql = this.getCondition();
this.storeList.load({
params: { start: 0, limit: 30, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
onDeleteClick: function (button, event) {
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);
}
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
if (btn == 'yes') {
Ext.Msg.wait('正在删除数据...');
Ext.Ajax.request({
waitMsg: '正在删除数据...',
url: '/MvcShipping/MsOpSeaeEdiTemplate/Delete',
params: {
data: Ext.JSON.encode(selectStores),
USERID: USERID
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
this.storeList.remove(selections);
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);
}, //onDeleteClick
getCondition: function () {
var form = this.formSearch.getForm();
var sql = " TYPE in ('S','F','T') ";
var Name = form.findField('KeyWords').getValue();
sql = sql + getAndConSql(sql, Name, " TEMPLATENAME like '%" + Name + "%' ");
return sql;
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});