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/MsOpStatus/MsOpStatusIndex.js

550 lines
17 KiB
JavaScript

Ext.namespace('Shipping');
Shipping.MsOpStatusIndex = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsOpStatusIndex.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsOpStatusIndex, Ext.Panel, {
PageSize: 30,
OprationStatus: null, //仅当弹出界面时使用
SelectedRecord: null,
EditRecord: null,
BsNo: "",
stroplb: "",
initUIComponents: function () {
//定义数据集
// var mainform = window.parent._this;
var mainform = window.parent.panelEdit;
if (mainform == undefined) {
mainform = window.parent._thisPc;
this.EditRecord = mainform.editRecord;
this.stroplb ='海运出口';
this.BsNo = this.EditRecord.get('gId');
} else {
this.EditRecord = mainform.editRecord;
this.stroplb = mainform.stroplb;
this.BsNo = this.EditRecord.get('BSNO');
}
//人员信息加载
this.storeOpCode = Ext.create('DsExt.ux.RefTableStore', {
model: 'DsShipping.ux.UserRefModel',
proxy: { url: '/CommMng/BasicDataRef/GetUserRefList' }
});
this.storeOpCode.load();
//客服
this.comboxCUSTSERVICE = Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeOpCode,
forceSelection: true,
name: 'COMPOP',
valueField: 'UserName',
displayField: 'CodeAndName'
});
this.storeOpStatus = Ext.create('DsExt.ux.RefTableStore', {
model: 'MsCodeOpStatusDetail',
proxy: { url: '/MvcShipping/MsCodeOpStatus/GetBodyList' }
});
this.storeOpStatus.load({ params: { condition: "OPTYPE='" + this.stroplb + "'"} });
this.comboxOPSTATUS= Ext.create('DsExt.ux.RefTableCombox', {
store: this.storeOpStatus,
forceSelection: true,
name: 'STATUS',
valueField: 'OPSTATUS',
displayField: 'OPSTATUS'
});
this.storeISOPEN = Ext.create('Ext.data.Store', {
fields: ['FSTATUS', 'NAME']
});
this.storeISOPEN.add({ "FSTATUS": "1", "NAME": Zi.LAN.GONGKAI });
this.storeISOPEN.add({ "FSTATUS": "0", "NAME": Zi.LAN.BUGONGKAI });
this.comboxISOPEN = Ext.create('DsExt.ux.RefTableCombox', {
// fieldLabel: '海运费',
store: this.storeISOPEN,
valueField: 'FSTATUS',
displayField: 'NAME',
// flex: 0.7,
// labelWidth: 55,
forceSelection: true,
name: 'ISOPEN'
});
this.storeList = Ext.create('Ext.data.Store', {
pageSize: this.PageSize,
model: 'MsOpStatus',
remoteSort: true,
proxy: {
type: 'ajax',
url: '/MvcShipping/MsOpStatus/GetListData',
reader: {
id: 'ST_ID',
root: 'data',
totalProperty: 'totalCount'
}
}
});
this.girdcolums = [{
sortable: true,
dataIndex: 'ST_ID',
header: 'ST_ID',
hidden: true,
width: 150
}, {
sortable: true,
dataIndex: 'BSNO',
header: '业务编号',
hidden: true,
width: 150
}, {
sortable: true,
dataIndex: 'STATUS',
header: Zi.LAN.STATUS,
editor: this.comboxOPSTATUS,
width: 120
}, {
sortable: true,
dataIndex: 'COMPTIME',
header: Zi.LAN.COMPTIME,
editor: {
xtype: 'datefield',
format: 'Y-m-d H:i:s',
selectOnFocus: true
},
renderer: Ext.util.Format.dateRenderer('Y-m-d H:i:s'),
width: 120
}, {
sortable: true,
dataIndex: 'COMPOP',
header: Zi.LAN.COMPOP,
editor: this.comboxCUSTSERVICE,
width: 80
}, {
sortable: true,
dataIndex: 'ISOPEN',
header: Zi.LAN.ISOPEN,
editor: this.comboxISOPEN,
width: 80,
renderer: function (value, cellmeta) {
if (value == '1') {
return Zi.LAN.GONGKAI;
} else return Zi.LAN.BUGONGKAI;
}
}, {
sortable: true,
dataIndex: 'REMARK',
header: Zi.LAN.REMARK,
editor: {
xtype: 'textfield',
selectOnFocus: true
},
width: 150
}, {
sortable: true,
dataIndex: 'OPTIME',
header: Zi.LAN.OPTIME,
width: 150
}
];
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: Zi.LAN.ShuJuJiaZaiZhongQingShaoDeng },
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: Zi.LAN.displayMsg ,
emptyMsg: Zi.LAN.emptyMsg
})
});
this.storeList.on('beforeload', function (store) {
var sql = "BSNO='" + this.BsNo + "'";
Ext.apply(store.proxy.extraParams, { condition: sql });
}, this);
//查询工具条
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
text: Zi.LAN.XinJian,
iconCls: "btnadd",
handler: function (button, event) {
this.addDetail();
},
scope: this
},
{
text: Zi.LAN.ShanChu,
id:'btndelete',
iconCls: "btndelete",
handler: function (button, event) {
this.deleteDetail();
},
scope: this
},
'-',
{
text: Zi.LAN.BaoCun,
iconCls: "btnsave",
handler: function (button, event) {
this.onPostDetailClick(button, event);
},
scope: this
},
'-',
{
text: Zi.LAN.ZhiXingChaXun,
iconCls: "btnrefresh",
handler: function (button, event) {
this.onRefreshClick(button, event);
},
scope: this
},
{
text: Zi.LAN.ChongZhi,
iconCls: "btnreset",
handler: function (button, event) {
},
scope: this
},
'-',
{
text: Zi.LAN.WeiXinTongZhi,
id:'WxOpStatusMsg',
iconCls: "btnrefresh",
handler: function (button, event) {
this.WxMsgSendDetail();
},
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.onRefreshClick();
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "modWxOpStatusMsg"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
var btnEdit = Ext.getCmp('WxOpStatusMsg');
btnEdit.setVisible(false);
} else {
var btnEdit = Ext.getCmp('WxOpStatusMsg');
btnEdit.setVisible(true);
}
} else {
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '',
url: '/MvcShipping/MsBaseInfo/GetUserModuleEnable',
params: {
modulename: "modOpStatusDel"
},
callback: function (options, success, response) {
if (success) {
var result = Ext.JSON.decode(response.responseText);
if (result.Success != true) {
var btnEdit = Ext.getCmp('btndelete');
btnEdit.setVisible(false);
} else {
var btnEdit = Ext.getCmp('btndelete');
btnEdit.setVisible(true);
}
} else {
}
},
scope: this
});
},
onRefreshClick: function (button, event) {
var sql = "BSNO='" + this.BsNo + "'";
this.storeList.load({
params: { start: 0, limit: this.PageSize, sort: '', condition: sql },
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu ,
scope: this
});
},
addDetail: function () {
var newSerialno = DsGetNewSerialNo(this.storeList, 0);
var n = this.storeList.getCount();
var myDate = new Date();
var mydatestr = Ext.util.Format.date(myDate, 'Y-m-d H:i:s');
var record = Ext.create('MsOpStatus', {
ST_ID: NewGuid(),
BSNO: '*',
ORDNO: n + 1,
STATUS: '',
ISOPEN: '0',
ISOPENREF: Zi.LAN.BUGONGKAI,
COMPTIME: mydatestr,
COMPOP: SHOWNAME,
REMARK: ''
});
this.storeList.add(record);
var n = this.storeList.getCount();
this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 });
},
deleteDetail: function () {
var selectedRecords = this.CheckBoxModel.selected.items;
Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.QueDingShanChuGaiJiLuMa, function (btn) {
if (btn == 'yes') {
var bodyDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
if (rec.BSNO == "" || rec.BSNO == "*") //如果是新增但没有保存的数据,没有必要提交到后台
{
this.storeList.remove(selectedRecords[i]);
} else {
bodyDatas.push(rec);
}
}
var jsonBody = ConvertRecordsToJsonAll(bodyDatas);
_this = this;
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsOpStatus/Delete',
params: {
bsno: _this.BsNo,
data: jsonBody
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < selectedRecords.length; i++) {
this.storeList.remove(selectedRecords[i]);
}
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
onPostDetailClick: function (button, event) {
var bodyDrChFeeDatas = [];
var i;
for (i = 0; i < this.storeList.getCount(); i += 1) {
var memberyf = this.storeList.getAt(i);
memberyf.data.COMPTIME = Ext.util.Format.date(memberyf.data.COMPTIME, 'Y-m-d H:i:s');
bodyDrChFeeDatas.push(memberyf);
var STATUS = memberyf.data.STATUS;
if (STATUS == '') {
Ext.Msg.show({
title: Zi.LAN.ChuoWu,
msg: Zi.LAN.ZhuangTaiBuNengWeiKongBuNengBaoCun,
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
return;
}
};
var jsonChFeeBody = ConvertFeeRecordsToJson(bodyDrChFeeDatas);
_this = this;
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsOpStatus/Save',
scope: this,
params: {
bsno: _this.BsNo,
body: jsonChFeeBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
for (var i = 0; i < this.storeList.getCount(); i += 1) {
var member = this.storeList.getAt(i);
member.set("BSNO", _this.BsNo);
member.commit();
}
} else {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
} else {
Ext.Msg.show({
title: Zi.LAN.TiShi,
msg: Zi.LAN.FuWuQiXiangYingChuCuo,
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
});
}
}
});
}, //end save
WxMsgSendDetail: function () {
var selectedRecords = this.CheckBoxModel.selected.items;
Ext.MessageBox.confirm(Zi.LAN.TiShi, Zi.LAN.QueDingYaoFaSongZhuangTaiMa, function (btn) {
if (btn == 'yes') {
var bodyDatas = [];
for (var i = 0; i < selectedRecords.length; i++) {
var rec = selectedRecords[i];
bodyDatas.push(rec);
}
var jsonBody = ConvertRecordsToJsonAll(bodyDatas);
_this = this;
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
Ext.Ajax.request({
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu,
url: '/MvcShipping/MsOpStatus/WxMsgSend',
params: {
bsno: _this.BsNo,
data: jsonBody
},
callback: function (options, success, response) {
if (success) {
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: jsonresult.Message, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
}
else {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
}
}
},
failure: function (response, options) {
Ext.Msg.show({ title: Zi.LAN.ChuoWu, msg: Zi.LAN.FuWuQiXiangYingChuCuo, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
success: function (response, options) {
},
scope: this
}); //end Ext.Ajax.request
}
}, this);
},
OprationSwap: function () {
var ret = new Array();
ret[0] = this.OprationStatus;
ret[1] = this.storeList;
ret[2] = this.SelectedRecord;
return ret;
}
});