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.
952 lines
33 KiB
JavaScript
952 lines
33 KiB
JavaScript
Ext.namespace('Shipping');
|
|
|
|
Shipping.MsInfoClientMailProjectEdit = function (config) {
|
|
Ext.applyIf(this, config);
|
|
this.initUIComponents();
|
|
window.Shipping.MsInfoClientMailProjectEdit.superclass.constructor.call(this);
|
|
};
|
|
|
|
Ext.extend(Shipping.MsInfoClientMailProjectEdit, Ext.Panel, {
|
|
ParentWin: null,
|
|
OpStatus: 'add',
|
|
StoreList: null,
|
|
editRecord: null,
|
|
Editdata: null,
|
|
MainEditRecord: null,
|
|
oplb: '',
|
|
|
|
initUIComponents: function () {
|
|
this.serialNo = 0;
|
|
//this.bodyDel = [];
|
|
this.itemindex = 1;
|
|
|
|
|
|
//权限范围
|
|
this.StoreOpRange = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'MsOP',
|
|
proxy: { url: '/MvcShipping/MsBaseInfo/GetOpRang' }
|
|
});
|
|
this.StoreOpRange.load({ params: { optype: "modOrderManagement"} });
|
|
|
|
|
|
this.storeFM = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'DsShipping.ux.UserLinkRefModel',
|
|
proxy: { url: '/CommMng/BasicDataRef/GetUserLinkRefList' }
|
|
});
|
|
|
|
//客户加载_车队
|
|
this.storeCustomerNameRef = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefListRm' }
|
|
});
|
|
|
|
this.storeCustomerNameRef.load();
|
|
this.comboxCustomerNameRef = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.storeCustomerNameRef,
|
|
fieldLabel: '客户名称', //'费用类型',
|
|
forceSelection: true,
|
|
queryMode: 'remote',
|
|
minChars: 1,
|
|
queryParam: 'CODENAME',
|
|
lazyRender: false,
|
|
name: 'CUSTNAME',
|
|
valueField: 'CustName',
|
|
displayField: 'CodeAndName'
|
|
});
|
|
|
|
this.CheckISDEF = new Ext.form.Checkbox({
|
|
fieldLabel: '停止默认',
|
|
inputValue: true,
|
|
name: 'ISDEF'
|
|
});
|
|
|
|
|
|
this.storeList = Ext.create('Ext.data.Store', {
|
|
pageSize: this.PageSize,
|
|
model: 'MsInfoClientMailProject',
|
|
remoteSort: true,
|
|
proxy: {
|
|
type: 'ajax',
|
|
url: '/MvcShipping/MsInfoClientMailProject/GetDataList',
|
|
reader: {
|
|
id: 'GID',
|
|
root: 'data',
|
|
totalProperty: 'totalCount'
|
|
}
|
|
}
|
|
});
|
|
|
|
this.girdcolums = [{
|
|
sortable: true,
|
|
dataIndex: 'GID',
|
|
header: 'GID',
|
|
hidden: true,
|
|
width: 150
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'CUSTNAME',
|
|
header: '客户名称',
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'PROJECTNAME',
|
|
header: '方案名称',
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'ISDEFREF',
|
|
header: '默认方案',
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'INPUTBYREF',
|
|
header: '录入人',
|
|
width: 80
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'INPUTDATE',
|
|
header: '录入日期',
|
|
width: 80
|
|
}
|
|
];
|
|
|
|
//定义Grid
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
store: this.storeList,
|
|
enableHdMenu: false,
|
|
region: 'center',
|
|
// width: 350,
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
trackMouseOver: true,
|
|
disableSelection: false,
|
|
columns: this.girdcolums,
|
|
bbar: Ext.create('Ext.PagingToolbar', {
|
|
store: this.storeList,
|
|
displayInfo: true,
|
|
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
|
|
emptyMsg: "没有数据"
|
|
})
|
|
});
|
|
|
|
_this = this;
|
|
|
|
this.gridList.addListener('itemclick', function (dataview, record, item, index, e, b) {
|
|
_this.editRecord = record;
|
|
_this.OpStatus = 'edit';
|
|
_this.LoadData("edit", "GID='" + record.data.GID + "'");
|
|
|
|
}, this);
|
|
|
|
this.gridList.getSelectionModel().on('select', function (model, record, index) {
|
|
var bsno = record.data.GID;
|
|
var sql = "";
|
|
sql = " PROJECTID='" + bsno + "' ";
|
|
this.storeListDetail.load({
|
|
params: { condition: sql },
|
|
callback: function (r, options, success) {
|
|
if (success) {
|
|
}
|
|
}
|
|
});
|
|
// this.onSelectFee(button, event);
|
|
}, this);
|
|
|
|
//#region 编辑formHead 基本信息
|
|
this.formHead = Ext.widget('form', {
|
|
region: 'north',
|
|
frame: true,
|
|
bodyPadding: 5,
|
|
collapsed: false,
|
|
collapsible: true,
|
|
trackResetOnLoad: true,
|
|
fieldDefaults: {
|
|
margins: '2 2 2 2',
|
|
labelAlign: 'right',
|
|
flex: 1,
|
|
labelWidth: 70,
|
|
msgTarget: 'qtip'
|
|
},
|
|
|
|
|
|
|
|
items: [{
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [{
|
|
fieldLabel: 'GID',
|
|
hidden: true,
|
|
name: 'GID'
|
|
}, {
|
|
fieldLabel: 'INPUTDATE',
|
|
hidden: true,
|
|
name: 'INPUTDATE'
|
|
}, this.comboxCustomerNameRef, {
|
|
fieldLabel: '方案名称',
|
|
flex: 2,
|
|
name: 'PROJECTNAME'
|
|
}, this.CheckISDEF]
|
|
}
|
|
|
|
]//end items(fieldset 1)
|
|
|
|
}); //end this.formEdit
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//#region 编辑formEdit 派车通知
|
|
|
|
|
|
this.storeListDetail = Ext.create('Ext.data.Store', {
|
|
pageSize: this.PageSize,
|
|
model: 'MsInfoClientMailProjectDetail',
|
|
remoteSort: true,
|
|
proxy: {
|
|
type: 'ajax',
|
|
url: '/MvcShipping/MsInfoClientMailProject/GetBodyList',
|
|
reader: {
|
|
id: 'GID',
|
|
root: 'data',
|
|
totalProperty: 'totalCount'
|
|
}
|
|
}
|
|
});
|
|
|
|
this.girddetailcolums = [{
|
|
sortable: true,
|
|
dataIndex: 'GID',
|
|
header: 'GID',
|
|
hidden: true,
|
|
width: 150
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'PROJECTID',
|
|
header: 'PROJECTID',
|
|
hidden: true,
|
|
width: 150
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'BLTYPE',
|
|
header: '单据类型',
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'RECEIVER',
|
|
header: '收件人',
|
|
width: 120
|
|
}
|
|
];
|
|
|
|
//定义Grid
|
|
this.gridListDetail = new Ext.grid.GridPanel({
|
|
store: this.storeListDetail,
|
|
enableHdMenu: false,
|
|
region: 'west',
|
|
width: 230,
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
trackMouseOver: true,
|
|
disableSelection: false,
|
|
columns: this.girddetailcolums,
|
|
tbar: [{
|
|
text: '添加明细',
|
|
tooltip: '添加明细',
|
|
id: "btnadddetail",
|
|
iconCls: "btnadddetail",
|
|
handler: function (button, event) {
|
|
this.onAddDetailClick(button, event);
|
|
},
|
|
scope: this
|
|
}, '-', {
|
|
text: '删除明细',
|
|
tooltip: '删除明细',
|
|
id: "btndeldetail",
|
|
iconCls: "btndeletedetail",
|
|
handler: function (button, event) {
|
|
this.onDelDetailClick(button, event);
|
|
},
|
|
scope: this
|
|
}],
|
|
bbar: Ext.create('Ext.PagingToolbar', {
|
|
store: this.storeListDetail,
|
|
displayInfo: true,
|
|
displayMsg: '当前显示 {0} - {1}条记录 /共 {2}条记录',
|
|
emptyMsg: "没有数据"
|
|
})
|
|
});
|
|
|
|
_this = this;
|
|
|
|
this.gridListDetail.addListener('itemclick', function (dataview, record, item, index, e, b) {
|
|
//_this.editRecordDetail = record;
|
|
//_this.OpDetailStatus = 'edit';
|
|
//_this.LoadDetailData("edit", "GID='" + record.data.GID + "'");
|
|
this.formEdit.getForm().reset();
|
|
this.formEdit.getForm().setValues(record.data);
|
|
|
|
}, this);
|
|
|
|
this.storeListDetail.on('load', function (store, records) {
|
|
if (store.getCount() > 0) {
|
|
this.gridListDetail.getSelectionModel().select(0);
|
|
} else {
|
|
_this.formEdit.getForm().reset();
|
|
this.formEdit.getForm().findField('BLTYPE').setValue('');
|
|
this.formEdit.getForm().findField('RECEIVER').setValue('');
|
|
this.formEdit.getForm().findField('SUBJECT').setValue('');
|
|
this.formEdit.getForm().findField('ATTACHMENT').setValue('');
|
|
this.formEdit.getForm().findField('DESCRIPTION').setValue('');
|
|
}
|
|
}, this);
|
|
|
|
this.gridListDetail.getSelectionModel().on('select', function (model, record, index) {
|
|
this.formEdit.getForm().reset();
|
|
this.formEdit.getForm().setValues(record.data);
|
|
}, this);
|
|
|
|
|
|
this.StoreBLTYPE = Ext.create('Ext.data.Store', {
|
|
fields: ['OPLB', 'OPLBNAME']
|
|
});
|
|
this.StoreBLTYPE.add({ "OPLB": 1, "OPLBNAME": "入货通知" });
|
|
this.StoreBLTYPE.add({ "OPLB": 2, "OPLBNAME": "提单及下货纸" });
|
|
this.StoreBLTYPE.add({ "OPLB": 3, "OPLBNAME": "费用确认" });
|
|
this.StoreBLTYPE.add({ "OPLB": 7, "OPLBNAME": "提单留底" });
|
|
|
|
|
|
this.comboxBLTYPE = Ext.create('DsExt.ux.RefTableCombox', {
|
|
fieldLabel: '单据类型', //'业务类别',
|
|
store: this.StoreBLTYPE,
|
|
valueField: 'OPLBNAME',
|
|
displayField: 'OPLBNAME',
|
|
forceSelection: true,
|
|
name: 'BLTYPE', //激活键盘事件
|
|
listeners: {
|
|
scope: this,
|
|
'blur': function blur(combo, eOpts, obj) {
|
|
var selections = this.gridListDetail.getSelectionModel().getSelection();
|
|
if (selections.length > 0) {
|
|
selections[0].set('BLTYPE', combo.value);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
this.formEdit = Ext.widget('form', {
|
|
region: 'center',
|
|
// height: 460,
|
|
frame: true,
|
|
bodyPadding: 5,
|
|
trackResetOnLoad: true,
|
|
fieldDefaults: {
|
|
margins: '2 2 2 2',
|
|
labelAlign: 'right',
|
|
flex: 1,
|
|
labelWidth: 70,
|
|
msgTarget: 'qtip'
|
|
},
|
|
|
|
items: [{
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [ {
|
|
fieldLabel: 'GID',
|
|
hidden: true,
|
|
name: 'GID'
|
|
}, {
|
|
fieldLabel: 'PROJECTID',
|
|
hidden: true,
|
|
name: 'PROJECTID'
|
|
}, this.comboxBLTYPE, {
|
|
fieldLabel: '收件人',
|
|
flex: 3,
|
|
name: 'RECEIVER', //激活键盘事件
|
|
listeners: {
|
|
scope: this,
|
|
'blur': function blur(combo, eOpts, obj) {
|
|
var selections = this.gridListDetail.getSelectionModel().getSelection();
|
|
if (selections.length > 0) {
|
|
selections[0].set('RECEIVER', combo.value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
]
|
|
}
|
|
, {
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [{
|
|
fieldLabel: '主题模板',
|
|
name: 'SUBJECT', //激活键盘事件
|
|
listeners: {
|
|
scope: this,
|
|
'blur': function blur(combo, eOpts, obj) {
|
|
var selections = this.gridListDetail.getSelectionModel().getSelection();
|
|
if (selections.length > 0) {
|
|
selections[0].set('SUBJECT', combo.value);
|
|
}
|
|
}
|
|
}
|
|
}]
|
|
}
|
|
|
|
, {
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [{
|
|
fieldLabel: '附件名称',
|
|
name: 'ATTACHMENT', //激活键盘事件
|
|
listeners: {
|
|
scope: this,
|
|
'blur': function blur(combo, eOpts, obj) {
|
|
var selections = this.gridListDetail.getSelectionModel().getSelection();
|
|
if (selections.length > 0) {
|
|
selections[0].set('ATTACHMENT', combo.value);
|
|
}
|
|
}
|
|
}
|
|
}]
|
|
}
|
|
|
|
, {
|
|
xtype: 'textareafield',
|
|
grow: true,
|
|
fieldLabel: '邮件内容模板',
|
|
height: 140,
|
|
name: 'DESCRIPTION',
|
|
anchor: '100%', //激活键盘事件
|
|
listeners: {
|
|
scope: this,
|
|
'blur': function blur(combo, eOpts, obj) {
|
|
var selections = this.gridListDetail.getSelectionModel().getSelection();
|
|
if (selections.length > 0) {
|
|
selections[0].set('DESCRIPTION', combo.value);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]//end items(fieldset 1)
|
|
}); //end this.formEdit
|
|
//#endregion
|
|
|
|
//#region 按钮Toolbar
|
|
|
|
|
|
this.panelBtn = new Ext.Panel({
|
|
region: "north",
|
|
tbar: [{
|
|
id: 'btnESave',
|
|
text: "保存",
|
|
iconCls: "btnsave",
|
|
handler: function (button, event) {
|
|
this.Save('0');
|
|
},
|
|
scope: this
|
|
}, {
|
|
id: 'btnESaveAndNew',
|
|
text: "保存并新建",
|
|
handler: function (button, event) {
|
|
this.Save('2');
|
|
},
|
|
scope: this
|
|
}, {
|
|
text: "新建",
|
|
handler: function (button, event) {
|
|
this.LoadData('add', '');
|
|
|
|
},
|
|
scope: this
|
|
}, '-', {
|
|
text: "删除",
|
|
iconCls: "btndelete",
|
|
handler: function (button, event) {
|
|
this.onDeleteClick(button, event);
|
|
},
|
|
scope: this
|
|
}]
|
|
}); //end 按钮Toolbar
|
|
//#endregion
|
|
|
|
this.formSearch = Ext.widget('form', {
|
|
frame: true,
|
|
region: 'north',
|
|
bodyPadding: 5,
|
|
fieldDefaults: {
|
|
margins: '2 2 2 2',
|
|
labelAlign: 'right',
|
|
flex: 1,
|
|
labelWidth: 60,
|
|
msgTarget: 'qtip'
|
|
},
|
|
|
|
items: [
|
|
{//fieldset 1
|
|
xtype: 'container',
|
|
defaultType: 'textfield',
|
|
layout: 'anchor',
|
|
defaults: {
|
|
anchor: '100%'
|
|
},
|
|
items: [{
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [{
|
|
fieldLabel: '客户名称', //编号检索
|
|
name: 'CUSTNAME',
|
|
enableKeyEvents: true,
|
|
listeners: {
|
|
specialkey: function (field, e) {
|
|
if (e.getKey() == e.ENTER) {
|
|
_this.onRefreshClick();
|
|
}
|
|
}
|
|
}
|
|
}, {
|
|
fieldLabel:'方案名称', //编号检索
|
|
name: 'PROJECTNAME',
|
|
enableKeyEvents: true,
|
|
listeners: {
|
|
specialkey: function (field, e) {
|
|
if (e.getKey() == e.ENTER) {
|
|
_this.onRefreshClick();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
]//end items(fieldset 1)
|
|
}//end fieldset 1
|
|
]//end root items
|
|
|
|
});
|
|
|
|
|
|
//#region 框架结构
|
|
|
|
|
|
this.panelpage = new Ext.Panel({
|
|
title: '方案明细',
|
|
layout: "border",
|
|
region: 'center',
|
|
animate: true,
|
|
autoScroll: true,
|
|
// containerScroll: true,
|
|
frame: false,
|
|
items: [this.gridListDetail,this.formEdit]
|
|
});
|
|
|
|
|
|
this.panelList= new Ext.Panel({
|
|
// title: '方案明细',
|
|
layout: "border",
|
|
region: 'west',
|
|
width:350,
|
|
animate: true,
|
|
autoScroll: true,
|
|
// containerScroll: true,
|
|
frame: false,
|
|
items: [this.formSearch, this.gridList]
|
|
});
|
|
|
|
this.paneltruckdetail = new Ext.Panel({
|
|
layout: "border",
|
|
region: 'center',
|
|
animate: true,
|
|
autoScroll: true,
|
|
// containerScroll: true,
|
|
frame: false,
|
|
items: [this.panelBtn, this.formHead, this.panelpage]
|
|
});
|
|
|
|
Ext.apply(this, {
|
|
items: [this.panelList, this.paneltruckdetail]
|
|
});
|
|
//#endregion
|
|
|
|
//#region 其他
|
|
// parentWin = window.parent.opener;
|
|
this.InitData();
|
|
|
|
//#endregion
|
|
}, //end initUIComponents
|
|
|
|
//#region 加载事件
|
|
InitData: function () {
|
|
this.opStatus = 'add';
|
|
var condition = '';
|
|
_this = this;
|
|
this.storeList.load({ params: { condition: "" },
|
|
callback: function (r, options, success) {
|
|
if (success) {
|
|
if (this.storeList.getCount() > 0) {
|
|
var member = this.storeList.getAt(0);
|
|
_this.LoadData("edit", "GID='" + member.data.GID + "'");
|
|
} else {
|
|
_this.LoadData('add', '');
|
|
}
|
|
}
|
|
},
|
|
scope: this
|
|
});
|
|
|
|
|
|
}, //end InitData
|
|
|
|
LoadData: function (opstatus, condition) {
|
|
this.serialNo = 0;
|
|
//this.bodyDel = [];
|
|
this.opStatus = opstatus;
|
|
|
|
//if (this.opStatus == 'add') {
|
|
// this.formHead.getForm().reset();
|
|
// this.storeListDetail.clear;
|
|
// this.formEdit.getForm().reset();
|
|
|
|
//} else {
|
|
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在查询主表数据...',
|
|
url: '/MvcShipping/MsInfoClientMailProject/GetData',
|
|
params: {
|
|
handle: opstatus,
|
|
condition: condition
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
var result = Ext.JSON.decode(response.responseText);
|
|
if (!result.Success) {
|
|
Ext.Msg.show({
|
|
title: '提示',
|
|
msg: result.Message,
|
|
icon: Ext.MessageBox.ERROR,
|
|
buttons: Ext.Msg.OK
|
|
});
|
|
return;
|
|
}
|
|
|
|
data = result.data;
|
|
|
|
|
|
this.formHead.getForm().reset();
|
|
this.formHead.getForm().setValues(data);
|
|
var sql = " PROJECTID='" + data.GID + "' ";
|
|
this.storeListDetail.load({
|
|
params: { condition: sql },
|
|
callback: function (r, options, success) {
|
|
if (success) {
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
// this.GetEditStatus();
|
|
} else {
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
}
|
|
},
|
|
scope: this
|
|
});
|
|
|
|
// }
|
|
|
|
}, // end LoadDate
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
//#region 保存
|
|
Save: function (type) {
|
|
var basicForm = this.formEdit.getForm();
|
|
if (!basicForm.isValid()) {
|
|
return;
|
|
}
|
|
var data = this.formHead.getForm().getValues(false, false, false);
|
|
var bodydatas = [];
|
|
for (var i = 0; i < this.storeListDetail.getCount() ; i += 1) {
|
|
var member = this.storeListDetail.getAt(i);
|
|
bodydatas.push(member);
|
|
}
|
|
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
|
|
|
|
//
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在保存数据...',
|
|
url: '/MvcShipping/MsInfoClientMailProject/Save',
|
|
scope: this,
|
|
params: {
|
|
opstatus: this.opStatus,
|
|
data: Ext.JSON.encode(data),
|
|
body: jsonBody
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
Ext.MessageBox.hide();
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
if (jsonresult.Success) {
|
|
var returnData = jsonresult.Data;
|
|
this.formHead.getForm().reset();
|
|
this.formHead.getForm().setValues(returnData);
|
|
//
|
|
if (this.opStatus == 'add') {
|
|
var arrNewRecords = this.storeList.add(returnData);
|
|
this.editRecord = arrNewRecords[0];
|
|
var editp = Ext.create('MsInfoClientMailProject', returnData);
|
|
this.formHead.getForm().findField('GID').setValue(editp.get('GID'));
|
|
|
|
}
|
|
else if (this.opStatus == 'edit') {
|
|
var editp = Ext.create('MsInfoClientMailProject', returnData);
|
|
//this.editRecord.fields.each(function (field) {
|
|
// if (field.persist) {
|
|
// name = field.name;
|
|
// if (name != 'id')
|
|
// this.editRecord.set(name, editp.get(name));
|
|
// }
|
|
//}, this);
|
|
//this.editRecord.commit();
|
|
}
|
|
|
|
var sql = " PROJECTID='" + returnData.GID + "' ";
|
|
this.storeListDetail.load({
|
|
params: { condition: sql },
|
|
callback: function (r, options, success) {
|
|
if (success) {
|
|
}
|
|
}
|
|
});
|
|
|
|
if (type == '0') {
|
|
this.opStatus = 'edit';
|
|
|
|
}
|
|
} 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
|
|
//#endregion
|
|
|
|
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 record = selections[0];
|
|
|
|
//if (this.StoreOpRange.getCount() == 0) {
|
|
// Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
// return;
|
|
//} else {
|
|
// var inputby = record.data.INPUTBY;
|
|
// var records = DsStoreQueryBy(this.StoreOpRange, 'OPID', inputby);
|
|
// if (records.getCount() > 0) {
|
|
// } else {
|
|
// canedit = false;
|
|
// Ext.Msg.show({ title: '警告', msg: '权限不足,不允许删除!', icon: Ext.Msg.WARNING, buttons: Ext.Msg.OK });
|
|
// return;
|
|
|
|
// }
|
|
//}
|
|
|
|
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
|
|
if (btn == 'yes') {
|
|
Ext.Msg.wait('正在删除数据...');
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在删除数据...',
|
|
url: '/MvcShipping/MsInfoClientMailProject/Delete',
|
|
params: {
|
|
data: Ext.JSON.encode(record.data)
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
if (jsonresult.Success) {
|
|
this.storeList.remove(record);
|
|
if (this.storeList.getCount() > 0) {
|
|
var member = this.storeList.getAt(0);
|
|
this.LoadData("edit", "GID='" + member.data.GID + "'");
|
|
this.editRecord = member;
|
|
} else {
|
|
this.LoadData('add', '');
|
|
}
|
|
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);
|
|
},
|
|
|
|
|
|
|
|
onAddDetailClick: function (button, event) {
|
|
var record = Ext.create('MsInfoClientMailProjectDetail', {
|
|
GID: '*',
|
|
PROJECTID:'*',
|
|
BLTYPE: '',
|
|
RECEIVER:'',
|
|
SUBJECT:'',
|
|
DESCRIPTION:'',
|
|
ATTACHMENT: ''
|
|
});
|
|
this.storeListDetail.add(record);
|
|
this.gridListDetail.getSelectionModel().select(record);
|
|
// this.storeListDetail.select(record);
|
|
// this.formEdit.getForm().reset();
|
|
// var n = this.storeListDetail.getCount();
|
|
// this.gridListCellEditing.startEditByPosition({ row: n - 1, column: 2 });
|
|
|
|
},
|
|
|
|
//#region 删除明细
|
|
onDelDetailClick: function (button, event) {
|
|
var selections = this.gridListDetail.getSelectionModel().getSelection();
|
|
var GID = selections[0].data.GID;
|
|
var selectedRecords = this.gridListDetail.selModel.getSelection();
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
var rec = selectedRecords[i];
|
|
if (rec.data.GID == "" || rec.data.GID == "*")//如果是新增但没有保存的数据,没有必要提交到后台
|
|
{
|
|
this.storeListDetail.remove(selectedRecords[i]);
|
|
}
|
|
else {
|
|
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
|
|
if (btn == 'yes') {
|
|
Ext.Msg.wait('正在删除数据...');
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在删除数据...',
|
|
url: '/MvcShipping/MsInfoClientMailProject/DeleteDetail',
|
|
params: {
|
|
data: Ext.JSON.encode(rec.data)
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
if (jsonresult.Success) {
|
|
//this.storeBodyList.remove(rec);
|
|
this.storeListDetail.reload();
|
|
// 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 });
|
|
},
|
|
scope: this
|
|
});
|
|
}
|
|
}, this);
|
|
}
|
|
}
|
|
},
|
|
//#endregion
|
|
|
|
//#region
|
|
|
|
|
|
//#endregion
|
|
|
|
//#region 编辑时按钮等的状态
|
|
GetEditStatus: function () {
|
|
var canedit = false;
|
|
//var bsStatus = this.formHead.getForm().findField('BSSTATUS').getValue();
|
|
var BSSTATUS = this.formHead.getForm().findField('BSSTATUSREF').getValue();
|
|
var inputby = this.formHead.getForm().findField('INPUTBY').getValue();
|
|
var op = this.formHead.getForm().findField('OP').getValue();
|
|
|
|
_this = this;
|
|
if (BSSTATUS == '锁定') {
|
|
canedit = false;
|
|
this.setSaveBtnStatus(canedit);
|
|
} else {
|
|
this.StoreOpRange.load({ params: { optype: "modOrderManagement" },
|
|
callback: function (r, options, success) {
|
|
if (success) {
|
|
if (r.length != 0) {
|
|
var records = DsStoreQueryBy(_this.StoreOpRange, 'OPID', op);
|
|
if (records.getCount() > 0) {
|
|
canedit = true;
|
|
} else {
|
|
var recordins = DsStoreQueryBy(_this.StoreOpRange, 'OPID', inputby);
|
|
if (recordins.getCount() > 0) {
|
|
canedit = true;
|
|
} else {
|
|
canedit = false;
|
|
}
|
|
}
|
|
} else { canedit = false; }
|
|
|
|
_this.setSaveBtnStatus(canedit);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
setSaveBtnStatus: function (enable) {
|
|
var btnESave = Ext.getCmp('btnESave');
|
|
var btnESaveAndClose = Ext.getCmp('btnESaveAndClose');
|
|
var btnESaveAndNew = Ext.getCmp('btnESaveAndNew');
|
|
var btnEAddDetail = Ext.getCmp('btnadddetail');
|
|
var btnEDeleteDetail = Ext.getCmp('btndeldetail');
|
|
|
|
if (enable) {
|
|
btnESave.enable();
|
|
btnESaveAndClose.enable();
|
|
btnESaveAndNew.enable();
|
|
|
|
btnEAddDetail.enable();
|
|
btnEDeleteDetail.enable();
|
|
} else {
|
|
btnESave.disable();
|
|
btnESaveAndClose.disable();
|
|
btnESaveAndNew.disable();
|
|
btnEAddDetail.disable();
|
|
btnEDeleteDetail.disable();
|
|
}
|
|
}
|
|
//#endregion
|
|
|
|
|
|
});
|
|
|
|
|