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.

233 lines
6.5 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.MsUserMsgSetIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsUserMsgSetIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsUserMsgSetIndex, Ext.Panel, {
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
initUIComponents: function () {
//定义数据集
this.storeList = Ext.create('Ext.data.Store', {
model: 'MsUserMsgSet',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsUserMsgSet/GetUseMsgSetList',
reader: {
id: 'GID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.StoreBool = Ext.create('Ext.data.Store', {
fields: ['BL', 'NUM']
});
this.StoreBool.add({ "BL": "是", "NUM": "是" });
this.StoreBool.add({ "BL": "否", "NUM": "否" });
this.comboxBool = Ext.create('DsExt.ux.RefTableCombox', {
store: this.StoreBool,
forceSelection: true,
valueField: 'NUM',
displayField: 'BL'
});
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1
});
this.GridCheckBoxModel = 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.GridCheckBoxModel,
selType: 'cellmodel',
columns: [{
sortable: true,
dataIndex: 'GID',
header: 'GID',
hidden: true,
width: 120
}, {
sortable: true,
dataIndex: 'WORKFLOWTYPE_NAME',
header: '工作流名称',
width: 200
}, {
sortable: true,
dataIndex: 'WORKFLOWTYPE_DESCRIPTION',
header: '工作流描述',
width: 200
}, {
sortable: true,
dataIndex: 'ISRECEIVE',
header: '是否接受消息提醒',
editor: this.comboxBool,
width: 160
}
]
});
//#region formSearch
//#region formSearch枚举参照相关
//#endregion
//#endregion formSearch
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.onPostDetailClick(button, event);
},
scope: this
}, '-',
{
text: "刷新",
iconCls: "btnrefresh",
handler: function (button, event) {
var sql = '';
this.storeList.load({
params: { start: 0, limit: 500, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
},
scope: this
}
]
});
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 30,
items: [this.panelBtn]
});
this.panelList = new Ext.Panel({
layout: "border",
title: '工作流消息提醒设置',
region: "center",
items: [this.gridList]
});
Ext.apply(this, {
items: [this.panelTop, this.panelList]
});
var sql = '';
this.storeList.load({
params: { start: 0, limit: 500, sort: '', condition: sql},
waitMsg: "正在查询数据...",
scope: this
});
}, //end initUIComponents
onPostDetailClick: 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 bodyDrChFeeDatas = [];
var i;
for (i = 0; i < this.storeList.getCount(); i += 1) {
var memberyf = this.storeList.getAt(i);
bodyDrChFeeDatas.push(memberyf);
};
var jsonChFeeBody = ConvertRecordsToJsonAll(bodyDrChFeeDatas);
_thisfee = this;
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/MvcShipping/MsUserMsgSet/SetUserMsgSet',
scope: this,
params: {
body: jsonChFeeBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
var sql = '';
this.storeList.load({
params: { start: 0, limit: 500, sort: '', condition: sql },
waitMsg: "正在查询数据...",
scope: this
});
} else {
Ext.Msg.show({ title: '错误', msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({ title: '请重试',
msg: '服务器响应出错',
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});