|
|
|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
|
|
|
|
Shipping.MsCodeDuiTemplateEdit = function (config) {
|
|
|
|
|
Ext.applyIf(this, config);
|
|
|
|
|
this.initUIComponents();
|
|
|
|
|
window.Shipping.MsCodeDuiTemplateEdit.superclass.constructor.call(this);
|
|
|
|
|
};
|
|
|
|
|
var GGID = '';
|
|
|
|
|
var GID = '';
|
|
|
|
|
Ext.extend(Shipping.MsCodeDuiTemplateEdit, Ext.Panel, {
|
|
|
|
|
|
|
|
|
|
ParentWin: null,
|
|
|
|
|
OpStatus: 'add',
|
|
|
|
|
StoreList: null,
|
|
|
|
|
EditRecord: null,
|
|
|
|
|
GGID: '',
|
|
|
|
|
initUIComponents: function () {
|
|
|
|
|
this.serialNo = 0;
|
|
|
|
|
this.workSerialNo = 0;
|
|
|
|
|
this.detailsDel = [];
|
|
|
|
|
|
|
|
|
|
//#region 编辑form
|
|
|
|
|
|
|
|
|
|
//枚举参照相关(编辑form)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//表参照相关(编辑form)
|
|
|
|
|
Ext.regModel('IsCustOnly', {
|
|
|
|
|
fields: [{ name: 'value' }, { name: 'text'}]
|
|
|
|
|
})
|
|
|
|
|
var IsCustOnlyStore = new Ext.data.Store({
|
|
|
|
|
model: 'IsCustOnly',
|
|
|
|
|
data: [{ 'value': '0', 'text': '否' },
|
|
|
|
|
{ 'value': '1', 'text': '是'}]
|
|
|
|
|
});
|
|
|
|
|
var cbIsCustOnly = Ext.create('Ext.form.ComboBox', {
|
|
|
|
|
name: 'IsCustOnly',
|
|
|
|
|
queryMode: 'local',
|
|
|
|
|
id: 'IsCustOnly',
|
|
|
|
|
triggerAction: 'all',
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
allowBlank: false,
|
|
|
|
|
flex: 1,
|
|
|
|
|
valueField: 'value',
|
|
|
|
|
displayField: 'text',
|
|
|
|
|
store: IsCustOnlyStore,
|
|
|
|
|
fieldLabel: '是否客户专有',
|
|
|
|
|
hidden:true,
|
|
|
|
|
listeners: {
|
|
|
|
|
afterRender: function (combo) {
|
|
|
|
|
combo.setValue('1'); //同时下拉框会将与name为firstValue值对应的 text显示
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
cbIsCustOnly.on('load', function () { Ext.getCmp("IsCustOnly").setValue('1'); });
|
|
|
|
|
//客户名称
|
|
|
|
|
var storeGainCust = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'DsShipping.ux.CustomRefModel',
|
|
|
|
|
proxy: { url: '/CommMng/BasicDataRef/GetCustomRefList' }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var comboxGainCust = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
fieldLabel: '应收客户',
|
|
|
|
|
store: storeGainCust,
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
allowBlank: false,
|
|
|
|
|
id: 'CustName',
|
|
|
|
|
name: 'CustName',
|
|
|
|
|
valueField: 'CustName',
|
|
|
|
|
displayField: 'CodeAndName'
|
|
|
|
|
});
|
|
|
|
|
//编辑form
|
|
|
|
|
this.formEdit = Ext.widget('form', {
|
|
|
|
|
region: 'center',
|
|
|
|
|
frame: true,
|
|
|
|
|
bodyPadding: 5,
|
|
|
|
|
autoScroll: true,
|
|
|
|
|
fieldDefaults: {
|
|
|
|
|
margins: '2 2 2 2',
|
|
|
|
|
labelAlign: 'right',
|
|
|
|
|
flex: 1,
|
|
|
|
|
labelWidth: 90,
|
|
|
|
|
msgTarget: 'qtip'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
items: [
|
|
|
|
|
{//fieldset 1
|
|
|
|
|
xtype: 'fieldset',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
layout: 'anchor',
|
|
|
|
|
defaults: {
|
|
|
|
|
anchor: '100%'
|
|
|
|
|
},
|
|
|
|
|
items: [{
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [{
|
|
|
|
|
fieldLabel: 'GID',
|
|
|
|
|
name: 'GID', flex: 0, hidden: true, margins: '0'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '模板名称',
|
|
|
|
|
allowBlank: false,
|
|
|
|
|
name: 'ModelName'
|
|
|
|
|
}, comboxGainCust, {
|
|
|
|
|
fieldLabel: '录入人',
|
|
|
|
|
readOnly: true,
|
|
|
|
|
name: 'Oper'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '录入日期',
|
|
|
|
|
readOnly: true,
|
|
|
|
|
name: 'Optime'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
]//end items(fieldset 1)
|
|
|
|
|
}//end fieldset 1
|
|
|
|
|
]//end root items
|
|
|
|
|
}); //end this.formEdit
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//#region 按钮Toolbar
|
|
|
|
|
this.panelBtn = new Ext.Panel({
|
|
|
|
|
region: "north",
|
|
|
|
|
tbar: [
|
|
|
|
|
{
|
|
|
|
|
text: "保存",
|
|
|
|
|
iconCls: "btnsave",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.Save('0');
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: "保存并关闭",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.Save('1');
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
},
|
|
|
|
|
'-',
|
|
|
|
|
{
|
|
|
|
|
text: "保存并新建",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.Save('2');
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}); //end 按钮Toolbar
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//#region 明细表
|
|
|
|
|
|
|
|
|
|
//明细表表格相关
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//明细表-数据集
|
|
|
|
|
this.storePinMingList = Ext.create('Ext.data.Store', {
|
|
|
|
|
model: 'WMSPinMing',
|
|
|
|
|
remoteSort: true,
|
|
|
|
|
proxy: {
|
|
|
|
|
type: 'ajax',
|
|
|
|
|
url: '/MvcShipping/WMSFeeModel/GetPinMing',
|
|
|
|
|
reader: {
|
|
|
|
|
root: 'data',
|
|
|
|
|
totalProperty: 'totalCount'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
|
|
|
store: this.storePinMingList,
|
|
|
|
|
enableHdMenu: false,
|
|
|
|
|
region: 'center',
|
|
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
|
|
trackMouseOver: true,
|
|
|
|
|
disableSelection: false,
|
|
|
|
|
columns: [{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'GID',
|
|
|
|
|
header: 'GID',
|
|
|
|
|
hidden: true,
|
|
|
|
|
width: 100
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'CODE',
|
|
|
|
|
header: '代码',
|
|
|
|
|
width: 140
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'NAME',
|
|
|
|
|
header: '品名',
|
|
|
|
|
width: 140
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.gridList.addListener('cellclick', function (dataview, record, item, data, e, b) {
|
|
|
|
|
|
|
|
|
|
GGID = data.data.GID;
|
|
|
|
|
var condition = "";
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
|
|
condition = " PGID='" + GID + "' and GGID = '" + GGID + "'";
|
|
|
|
|
this.storeDetailsList.load({ params: { condition: condition} });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, this);
|
|
|
|
|
|
|
|
|
|
this.storeFangXiang = Ext.create('Ext.data.Store', {
|
|
|
|
|
fields: ['ID', 'TYPE']
|
|
|
|
|
});
|
|
|
|
|
this.storeFangXiang.add({ "ID": "1", "TYPE": "收" });
|
|
|
|
|
this.storeFangXiang.add({ "ID": "2", "TYPE": "付" });
|
|
|
|
|
|
|
|
|
|
this.comboxFangXiang = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
store: this.storeFangXiang,
|
|
|
|
|
valueField: 'ID',
|
|
|
|
|
displayField: 'TYPE',
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
name: 'SortType'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.storeDetailsList = Ext.create('Ext.data.Store', {
|
|
|
|
|
model: 'WMSFeeModelDetails',
|
|
|
|
|
remoteSort: false,
|
|
|
|
|
pruneModifiedRecords: true,
|
|
|
|
|
proxy: {
|
|
|
|
|
type: 'ajax',
|
|
|
|
|
url: '/MvcShipping/WMSFeeModel/GetDataDetailsList',
|
|
|
|
|
reader: {
|
|
|
|
|
id: 'gid',
|
|
|
|
|
root: 'data',
|
|
|
|
|
totalProperty: 'totalCount'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//明细表表格
|
|
|
|
|
this.gridDetailsListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
|
|
clicksToEdit: 1
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.gridDetailsList = new Ext.grid.GridPanel({
|
|
|
|
|
store: this.storeDetailsList,
|
|
|
|
|
enableHdMenu: false,
|
|
|
|
|
region: 'center',
|
|
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
|
|
trackMouseOver: true,
|
|
|
|
|
disableSelection: false,
|
|
|
|
|
plugins: [this.gridDetailsListCellEditing],
|
|
|
|
|
selType: 'cellmodel',
|
|
|
|
|
tbar: [{
|
|
|
|
|
text: '增加明细',
|
|
|
|
|
tooltip: '增加明细',
|
|
|
|
|
iconCls: "btnadddetail",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.onAddDetailClick(button, event, 2);
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}, '-', {
|
|
|
|
|
text: '删除明细',
|
|
|
|
|
tooltip: '删除明细',
|
|
|
|
|
iconCls: "btndeletedetail",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.onDelDetailClick(button, event, 2);
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}],
|
|
|
|
|
columns: [{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'GID',
|
|
|
|
|
header: 'GID',
|
|
|
|
|
hidden: true,
|
|
|
|
|
width: 100
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'PGID',
|
|
|
|
|
header: 'PGID',
|
|
|
|
|
hidden: true,
|
|
|
|
|
width: 100
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'GGID',
|
|
|
|
|
header: 'GGID',
|
|
|
|
|
hidden: true,
|
|
|
|
|
width: 100
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'JiFeiDengJi',
|
|
|
|
|
header: '计费等级',
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'numberfield',
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
},
|
|
|
|
|
width: 160
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'ShouFuFangXiang',
|
|
|
|
|
header: '收付方向',
|
|
|
|
|
editor: this.comboxFangXiang,
|
|
|
|
|
renderer: function (value, p, record) {
|
|
|
|
|
return record.data.ShouFuFangXiang == '1' ? "收" : "付";
|
|
|
|
|
},
|
|
|
|
|
width: 100
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'JiFeiQuJian',
|
|
|
|
|
header: '计费区间',
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'numberfield',
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
},
|
|
|
|
|
width: 60
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'JiFeiDanJia',
|
|
|
|
|
header: '计费单价',
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'numberfield',
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
},
|
|
|
|
|
width: 60
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'ZengZhiJia',
|
|
|
|
|
header: '增值价',
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'numberfield',
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
},
|
|
|
|
|
width: 60
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'FengDingJia',
|
|
|
|
|
header: '封顶价',
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'numberfield',
|
|
|
|
|
selectOnFocus: true
|
|
|
|
|
},
|
|
|
|
|
width: 60
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'Optime',
|
|
|
|
|
header: '修改时间',
|
|
|
|
|
width: 60
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.panelService = new Ext.Panel({
|
|
|
|
|
title: '品名',
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: 'west',
|
|
|
|
|
width: 340,
|
|
|
|
|
margin: '5 10',
|
|
|
|
|
|
|
|
|
|
items: [this.gridList]
|
|
|
|
|
});
|
|
|
|
|
this.panelwork = new Ext.Panel({
|
|
|
|
|
title: '仓储费模板明细',
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: 'center',
|
|
|
|
|
margin: '5 10',
|
|
|
|
|
items: [this.gridDetailsList]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.paneldetail = new Ext.Panel({
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: "center",
|
|
|
|
|
items: [
|
|
|
|
|
this.panelService, this.panelwork
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//#endregion 明细表
|
|
|
|
|
|
|
|
|
|
//#region 布局
|
|
|
|
|
//控件布局
|
|
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: "north",
|
|
|
|
|
height: 100,
|
|
|
|
|
items: [this.panelBtn, this.formEdit]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
|
|
items: [this.panelTop, this.paneldetail]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//绑定查询窗体
|
|
|
|
|
this.ParentWin = window.parent.opener;
|
|
|
|
|
|
|
|
|
|
//初始化数据
|
|
|
|
|
this.InitData();
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
|
|
storeGainCust.load({});
|
|
|
|
|
} else {
|
|
|
|
|
storeGainCust.load({ params: { condition: " SHORTNAME NOT IN (SELECT CustName FROM WMS_FEEMODEL)"} });
|
|
|
|
|
}
|
|
|
|
|
//绑定事件
|
|
|
|
|
this.gridList.on('edit', function (editor, e, eOpts) {
|
|
|
|
|
this.gridAfterEdit(editor, e, eOpts);
|
|
|
|
|
}, this);
|
|
|
|
|
}, //end initUIComponents
|
|
|
|
|
|
|
|
|
|
InitData: function () {
|
|
|
|
|
this.opStatus = 'add';
|
|
|
|
|
var condition = '';
|
|
|
|
|
if (this.ParentWin) {
|
|
|
|
|
var ret = this.ParentWin.OprationSwap();
|
|
|
|
|
this.opStatus = ret[0];
|
|
|
|
|
this.StoreList = ret[1];
|
|
|
|
|
this.editRecord = ret[2];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.opStatus == 'edit')
|
|
|
|
|
condition = " GID='" + this.editRecord.get('GID') + "'";
|
|
|
|
|
|
|
|
|
|
this.LoadData(this.opStatus, condition);
|
|
|
|
|
|
|
|
|
|
}, //end InitData
|
|
|
|
|
|
|
|
|
|
LoadData: function (opstatus, condition) {
|
|
|
|
|
this.serialNo = 0;
|
|
|
|
|
this.workSerialNo = 0;
|
|
|
|
|
this.bodyDel = [];
|
|
|
|
|
|
|
|
|
|
this.opStatus = opstatus;
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
waitMsg: '正在查询主表数据...',
|
|
|
|
|
url: '/MvcShipping/WMSFeeModel/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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var data = result.data;
|
|
|
|
|
GID = data.GID;
|
|
|
|
|
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
|
|
this.formEdit.getForm().reset();
|
|
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var billno = '*';
|
|
|
|
|
var modelid = 0;
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
|
|
modelid = this.editRecord.get('GID');
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
this.storePinMingList.load();
|
|
|
|
|
|
|
|
|
|
// this.storeDetailsList.load({ params: { condition: " GID='" + modelid + "'"} });
|
|
|
|
|
}, // end LoadDate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Save: function (type) {
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var data = basicForm.getValues();
|
|
|
|
|
data.Oper = SHOWNAME;
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
|
|
data.GID = "*";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var detailsArr = [];
|
|
|
|
|
for (var i = 0; i < this.storeDetailsList.getCount(); i += 1) {
|
|
|
|
|
var member = this.storeDetailsList.getAt(i);
|
|
|
|
|
detailsArr.push(member);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var details = ConvertRecordsToJson(detailsArr);
|
|
|
|
|
var detailsDel = ConvertRecordsToJsonAll(this.detailsDel);
|
|
|
|
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
waitMsg: '正在保存数据...',
|
|
|
|
|
url: '/MvcShipping/WMSFeeModel/Save',
|
|
|
|
|
scope: this,
|
|
|
|
|
params: {
|
|
|
|
|
opstatus: this.opStatus,
|
|
|
|
|
data: Ext.JSON.encode(data),
|
|
|
|
|
details: details,
|
|
|
|
|
detailsDel: detailsDel
|
|
|
|
|
},
|
|
|
|
|
callback: function (options, success, response) {
|
|
|
|
|
if (success) {
|
|
|
|
|
Ext.MessageBox.hide();
|
|
|
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
|
|
|
if (jsonresult.Success) {
|
|
|
|
|
this.opStatus == 'edit'
|
|
|
|
|
var returnData = jsonresult.Data;
|
|
|
|
|
GID = returnData.GID;
|
|
|
|
|
this.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
|
|
|
|
if (type == '0') {
|
|
|
|
|
this.opStatus = 'edit';
|
|
|
|
|
this.LoadData('edit', " GID='" + GID + "'");
|
|
|
|
|
var condition = "";
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
|
|
condition = " PGID='" + GID + "' and GGID = '" + GGID + "'";
|
|
|
|
|
this.storeDetailsList.load({ params: { condition: condition} });
|
|
|
|
|
}
|
|
|
|
|
} else if (type == '1') {
|
|
|
|
|
window.close();
|
|
|
|
|
} else {
|
|
|
|
|
this.LoadData('add', '');
|
|
|
|
|
}
|
|
|
|
|
Ext.Msg.show({ title: '提示', msg: jsonresult.Message, icon: Ext.Msg.OK, buttons: Ext.Msg.OK });
|
|
|
|
|
} 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
|
|
|
|
|
|
|
|
|
|
onAddDetailClick: function (button, event, type) {
|
|
|
|
|
this.addDetails(type);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
onDelDetailClick: function (button, event, type) {
|
|
|
|
|
this.deleteDetail(type);
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
gridAfterEdit: function (editor, e, eOpts) {
|
|
|
|
|
//需要自己实现里面的事件
|
|
|
|
|
|
|
|
|
|
if (e.field == 'FeeName') {
|
|
|
|
|
var records = DsStoreQueryBy(this.storeFeeNameRef, 'Name', e.value);
|
|
|
|
|
|
|
|
|
|
if (records.getCount() > 0) {
|
|
|
|
|
var data = records.getAt(0).data;
|
|
|
|
|
var FeeCode = data.FeeCode;
|
|
|
|
|
e.record.set('FeeCode', FeeCode);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
e.record.set('FeeCode', '');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
deleteDetail: function (type) {
|
|
|
|
|
|
|
|
|
|
var selectedRecords = this.gridList.selModel.getSelection();
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
|
|
var rec = selectedRecords[i];
|
|
|
|
|
this.detailsDel.push(rec);
|
|
|
|
|
this.storeBodyList.remove(rec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
addDetails: function (type) {
|
|
|
|
|
if (GGID == '') {
|
|
|
|
|
Ext.Msg.show({ title: '提示', msg: '请先选择品名!', icon: Ext.Msg.WARNNING, buttons: Ext.Msg.OK });
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var newSerialno = 0;
|
|
|
|
|
|
|
|
|
|
store = this.storeDetailsList;
|
|
|
|
|
var newSerialno = this.storeDetailsList.getCount() + 1;
|
|
|
|
|
|
|
|
|
|
var record = Ext.create('WMSFeeModelDetails', {
|
|
|
|
|
GID: '*',
|
|
|
|
|
PGID: GID,
|
|
|
|
|
GGID: GGID,
|
|
|
|
|
JiFeiDengJi: 0,
|
|
|
|
|
ShouFuFangXiang: 0,
|
|
|
|
|
JiFeiQuJian: 0,
|
|
|
|
|
JiFeiDanJia: 0,
|
|
|
|
|
ZengZhiJia: 0,
|
|
|
|
|
FengDingJia: 0
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
store.add(record);
|
|
|
|
|
|
|
|
|
|
var n = store.getCount();
|
|
|
|
|
this.gridDetailsListCellEditing.startEditByPosition({ row: n + 1, column: 1 });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
deleteDetail: function (type) {
|
|
|
|
|
|
|
|
|
|
var selectedRecords = this.gridDetailsList.selModel.getSelection();
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
|
|
var rec = selectedRecords[i];
|
|
|
|
|
|
|
|
|
|
this.storeDetailsList.remove(rec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|