|
|
|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
|
|
|
|
Shipping.MsCodeFeeGroupTemplateEdit = function (config) {
|
|
|
|
|
Ext.applyIf(this, config);
|
|
|
|
|
this.initUIComponents();
|
|
|
|
|
window.Shipping.MsCodeFeeGroupTemplateEdit.superclass.constructor.call(this);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Ext.extend(Shipping.MsCodeFeeGroupTemplateEdit, Ext.Panel, {
|
|
|
|
|
|
|
|
|
|
ParentWin: null,
|
|
|
|
|
OpStatus: 'add',
|
|
|
|
|
StoreList: null,
|
|
|
|
|
EditRecord: null,
|
|
|
|
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
|
|
this.serialNo = 0;
|
|
|
|
|
this.workSerialNo = 0;
|
|
|
|
|
this.bodyDel = [];
|
|
|
|
|
|
|
|
|
|
//#region 编辑form
|
|
|
|
|
|
|
|
|
|
//枚举参照相关(编辑form)
|
|
|
|
|
|
|
|
|
|
this.StoreRptType = Ext.create('Ext.data.Store', {
|
|
|
|
|
fields: ['RptType', 'Name']
|
|
|
|
|
});
|
|
|
|
|
this.StoreRptType.add({ "RptType": "RPTFEEGROUP", "Name": "费用分组统计" });
|
|
|
|
|
|
|
|
|
|
this.comboxRptType = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
fieldLabel: '报表名称',
|
|
|
|
|
store: this.StoreRptType,
|
|
|
|
|
allowBlank: false,
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
name: 'RPTTYPE',
|
|
|
|
|
valueField: 'RptType',
|
|
|
|
|
displayField: 'Name'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//表参照相关(编辑form)
|
|
|
|
|
|
|
|
|
|
//编辑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: 'DM_ID',
|
|
|
|
|
name: 'DM_ID', flex: 0, hidden: true, margins: '0'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '模板名称',
|
|
|
|
|
allowBlank: false,
|
|
|
|
|
name: 'RPTNAME'
|
|
|
|
|
}, this.comboxRptType, {
|
|
|
|
|
fieldLabel: '录入人',
|
|
|
|
|
readOnly: true,
|
|
|
|
|
name: 'INPUTBY'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: '录入日期',
|
|
|
|
|
readOnly: true,
|
|
|
|
|
name: 'INPUTDATE'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}, {
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [{
|
|
|
|
|
fieldLabel: '说明',
|
|
|
|
|
name: 'REMARK'
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
]//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.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'DsShipping.ux.FeeTypeRefModel',
|
|
|
|
|
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefList' }
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.storeFeeNameRef.load({ params: { condition: ""} });
|
|
|
|
|
this.comboxFeeNameRef = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
store: this.storeFeeNameRef,
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
name: 'FeeName',
|
|
|
|
|
valueField: 'Name',
|
|
|
|
|
displayField: 'CodeAndName'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.StoreCurr = Ext.create('DsExt.ux.RefTableStore', {
|
|
|
|
|
model: 'MsFeeCurr',
|
|
|
|
|
proxy: { url: '/MvcShipping/MsChFee/GetFeeCurrList' }
|
|
|
|
|
});
|
|
|
|
|
this.StoreCurr.load({ params: { condition: ""} });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.comboxCurr = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
store: this.StoreCurr,
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
name: 'Currency',
|
|
|
|
|
valueField: 'CURR',
|
|
|
|
|
displayField: 'CURR'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.storeFeeTypeRef = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
|
|
this.storeFeeTypeRef.load({ params: { enumTypeId: 99020} });
|
|
|
|
|
|
|
|
|
|
this.comboxFeeTypeRef = Ext.create('DsExt.ux.RefEnumCombox', {
|
|
|
|
|
store: this.storeFeeTypeRef,
|
|
|
|
|
name: 'FeeType'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//明细表-数据集
|
|
|
|
|
this.storeBodyListDr = Ext.create('Ext.data.Store', {
|
|
|
|
|
model: 'MsCodeDuiTemplateFee',
|
|
|
|
|
remoteSort: true,
|
|
|
|
|
proxy: {
|
|
|
|
|
type: 'ajax',
|
|
|
|
|
url: '/MvcShipping/MsCodeDuiTemplate/GetBodyList',
|
|
|
|
|
reader: {
|
|
|
|
|
root: 'data',
|
|
|
|
|
totalProperty: 'totalCount'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//明细表表格
|
|
|
|
|
this.gridListDrCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
|
|
clicksToEdit: 1
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.gridListDr = new Ext.grid.GridPanel({
|
|
|
|
|
store: this.storeBodyListDr,
|
|
|
|
|
enableHdMenu: false,
|
|
|
|
|
region: 'center',
|
|
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
|
|
trackMouseOver: true,
|
|
|
|
|
disableSelection: false,
|
|
|
|
|
plugins: [this.gridListDrCellEditing],
|
|
|
|
|
selType: 'cellmodel',
|
|
|
|
|
tbar: [{
|
|
|
|
|
text: '增加费用字段',
|
|
|
|
|
tooltip: '增加费用字段',
|
|
|
|
|
iconCls: "btnadddetail",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.onAddDetailClick(button, event, 1);
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}, '-', {
|
|
|
|
|
text: '删除费用字段',
|
|
|
|
|
tooltip: '删除费用字段',
|
|
|
|
|
iconCls: "btndeletedetail",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.onDelDetailClick(button, event, 1);
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}],
|
|
|
|
|
columns: [{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'DM_ID',
|
|
|
|
|
header: 'DM_ID',
|
|
|
|
|
hidden: true,
|
|
|
|
|
width: 100
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'FeeName',
|
|
|
|
|
header: '费用名称',
|
|
|
|
|
editor: this.comboxFeeNameRef,
|
|
|
|
|
width: 120
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'FeeCode',
|
|
|
|
|
header: '费用代码',
|
|
|
|
|
width: 80
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'Currency',
|
|
|
|
|
header: '币别',
|
|
|
|
|
editor: this.comboxCurr,
|
|
|
|
|
width: 60
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'DisplayName',
|
|
|
|
|
header: '显示名称',
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'textfield',
|
|
|
|
|
selectOnFocus: true,
|
|
|
|
|
enableKeyEvents: true
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
width: 80
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//明细表-数据集
|
|
|
|
|
this.storeBodyListCr = Ext.create('Ext.data.Store', {
|
|
|
|
|
model: 'MsCodeDuiTemplateFee',
|
|
|
|
|
remoteSort: true,
|
|
|
|
|
proxy: {
|
|
|
|
|
type: 'ajax',
|
|
|
|
|
url: '/MvcShipping/MsCodeDuiTemplate/GetBodyList',
|
|
|
|
|
reader: {
|
|
|
|
|
root: 'data',
|
|
|
|
|
totalProperty: 'totalCount'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//明细表表格
|
|
|
|
|
this.gridListCrCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
|
|
clicksToEdit: 1
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.gridListCr = new Ext.grid.GridPanel({
|
|
|
|
|
store: this.storeBodyListCr,
|
|
|
|
|
enableHdMenu: false,
|
|
|
|
|
region: 'center',
|
|
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
|
|
trackMouseOver: true,
|
|
|
|
|
disableSelection: false,
|
|
|
|
|
plugins: [this.gridListCrCellEditing],
|
|
|
|
|
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: 'DM_ID',
|
|
|
|
|
header: 'DM_ID',
|
|
|
|
|
hidden: true,
|
|
|
|
|
width: 100
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'FeeName',
|
|
|
|
|
header: '费用名称',
|
|
|
|
|
editor: this.comboxFeeNameRef,
|
|
|
|
|
width: 120
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'FeeCode',
|
|
|
|
|
header: '费用代码',
|
|
|
|
|
width: 80
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'Currency',
|
|
|
|
|
header: '币别',
|
|
|
|
|
editor: this.comboxCurr,
|
|
|
|
|
width: 60
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'DisplayName',
|
|
|
|
|
header: '显示名称',
|
|
|
|
|
editor: {
|
|
|
|
|
xtype: 'textfield',
|
|
|
|
|
selectOnFocus: true,
|
|
|
|
|
enableKeyEvents: true
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
width: 80
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.storeWorkList = Ext.create('Ext.data.Store', {
|
|
|
|
|
model: 'MsCodeFeeGroupTotal',
|
|
|
|
|
remoteSort: true,
|
|
|
|
|
proxy: {
|
|
|
|
|
type: 'ajax',
|
|
|
|
|
url: '/MvcShipping/MsCodeFeeGroupTemplate/GetTotalCurrList',
|
|
|
|
|
reader: {
|
|
|
|
|
root: 'data',
|
|
|
|
|
totalProperty: 'totalCount'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//明细表表格
|
|
|
|
|
this.gridworkListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
|
|
|
clicksToEdit: 1
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.gridWorkList = new Ext.grid.GridPanel({
|
|
|
|
|
store: this.storeWorkList,
|
|
|
|
|
enableHdMenu: false,
|
|
|
|
|
region: 'center',
|
|
|
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
|
|
|
trackMouseOver: true,
|
|
|
|
|
disableSelection: false,
|
|
|
|
|
plugins: [this.gridworkListCellEditing],
|
|
|
|
|
selType: 'cellmodel',
|
|
|
|
|
tbar: [{
|
|
|
|
|
text: '增加币别',
|
|
|
|
|
tooltip: '增加币别',
|
|
|
|
|
iconCls: "btnadddetail",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.addCurrDetail(2);
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}, '-', {
|
|
|
|
|
text: '删除币别',
|
|
|
|
|
tooltip: '删除币别',
|
|
|
|
|
iconCls: "btndeletedetail",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.deleteCurrDetail(2);
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}],
|
|
|
|
|
columns: [{
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'DM_ID',
|
|
|
|
|
header: 'DM_ID',
|
|
|
|
|
hidden: true,
|
|
|
|
|
width: 100
|
|
|
|
|
}, {
|
|
|
|
|
sortable: true,
|
|
|
|
|
dataIndex: 'CURRENCY',
|
|
|
|
|
header: '币别',
|
|
|
|
|
editor: this.comboxCurr,
|
|
|
|
|
width: 160
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.panelService = new Ext.Panel({
|
|
|
|
|
title: '应收费用字段',
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: 'west',
|
|
|
|
|
width: 370,
|
|
|
|
|
margin: '5 10',
|
|
|
|
|
|
|
|
|
|
items: [this.gridListDr]
|
|
|
|
|
});
|
|
|
|
|
this.panelServiceCr = new Ext.Panel({
|
|
|
|
|
title: '应付费用字段',
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: 'center',
|
|
|
|
|
margin: '5 10',
|
|
|
|
|
|
|
|
|
|
items: [this.gridListCr]
|
|
|
|
|
});
|
|
|
|
|
this.panelwork = new Ext.Panel({
|
|
|
|
|
title: '合计币别',
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: 'south',
|
|
|
|
|
height: 160,
|
|
|
|
|
margin: '5 10',
|
|
|
|
|
items: [this.gridWorkList]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.paneldetail = new Ext.Panel({
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: "center",
|
|
|
|
|
items: [
|
|
|
|
|
this.panelService, this.panelServiceCr, this.panelwork
|
|
|
|
|
]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//#endregion 明细表
|
|
|
|
|
|
|
|
|
|
//#region 布局
|
|
|
|
|
//控件布局
|
|
|
|
|
this.panelTop = new Ext.Panel({
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: "north",
|
|
|
|
|
height: 120,
|
|
|
|
|
items: [this.panelBtn, this.formEdit]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
|
|
items: [this.panelTop, this.paneldetail]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//绑定查询窗体
|
|
|
|
|
this.ParentWin = window.parent.opener;
|
|
|
|
|
|
|
|
|
|
//初始化数据
|
|
|
|
|
this.InitData();
|
|
|
|
|
|
|
|
|
|
//绑定事件
|
|
|
|
|
this.gridListDr.on('edit', function (editor, e, eOpts) {
|
|
|
|
|
this.gridAfterEdit(editor, e, eOpts);
|
|
|
|
|
}, this);
|
|
|
|
|
//绑定事件
|
|
|
|
|
this.gridListCr.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 = " DM_ID='" + this.editRecord.get('DM_ID') + "'";
|
|
|
|
|
|
|
|
|
|
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/MsCodeFeeGroupTemplate/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;
|
|
|
|
|
this.formEdit.getForm().reset();
|
|
|
|
|
this.formEdit.getForm().setValues(data);
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
var billno = '*';
|
|
|
|
|
var cargoid = 0;
|
|
|
|
|
if (this.opStatus == 'edit') {
|
|
|
|
|
cargoid = this.editRecord.get('DM_ID');
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
this.storeBodyListDr.load({ params: { condition: " DM_ID='" + cargoid + "' and Feetype=1"} });
|
|
|
|
|
this.storeBodyListCr.load({ params: { condition: " DM_ID='" + cargoid + "' and Feetype=2"} });
|
|
|
|
|
this.storeWorkList.load({ params: { condition: " DM_ID='" + cargoid + "'"} });
|
|
|
|
|
}, // end LoadDate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Save: function (type) {
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
basicForm.findField('DM_ID').setDisabled(false);
|
|
|
|
|
var data = basicForm.getValues();
|
|
|
|
|
basicForm.findField('DM_ID').setDisabled(true);
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
|
|
data.DM_ID = NewGuid();
|
|
|
|
|
}
|
|
|
|
|
var bodydrdatas = [];
|
|
|
|
|
for (var i = 0; i < this.storeBodyListDr.getCount(); i += 1) {
|
|
|
|
|
var member = this.storeBodyListDr.getAt(i);
|
|
|
|
|
bodydrdatas.push(member);
|
|
|
|
|
}
|
|
|
|
|
var bodycrdatas = [];
|
|
|
|
|
for (var i = 0; i < this.storeBodyListCr.getCount(); i += 1) {
|
|
|
|
|
var member = this.storeBodyListCr.getAt(i);
|
|
|
|
|
bodycrdatas.push(member);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var workdatas = [];
|
|
|
|
|
for (var i = 0; i < this.storeWorkList.getCount(); i += 1) {
|
|
|
|
|
var member = this.storeWorkList.getAt(i);
|
|
|
|
|
workdatas.push(member);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var jsonDrBody = ConvertRecordsToJsonAll(bodydrdatas);
|
|
|
|
|
var jsonCrBody = ConvertRecordsToJsonAll(bodycrdatas);
|
|
|
|
|
var workBody = ConvertRecordsToJsonAll(workdatas);
|
|
|
|
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
waitMsg: '正在保存数据...',
|
|
|
|
|
url: '/MvcShipping/MsCodeFeeGroupTemplate/Save',
|
|
|
|
|
scope: this,
|
|
|
|
|
params: {
|
|
|
|
|
opstatus: this.opStatus,
|
|
|
|
|
data: Ext.JSON.encode(data),
|
|
|
|
|
drbody: jsonDrBody,
|
|
|
|
|
crbody: jsonCrBody,
|
|
|
|
|
bodytotal: workBody
|
|
|
|
|
},
|
|
|
|
|
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.formEdit.getForm().setValues(returnData);
|
|
|
|
|
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
|
|
var arrNewRecords = this.StoreList.add(returnData);
|
|
|
|
|
this.editRecord = arrNewRecords[0];
|
|
|
|
|
}
|
|
|
|
|
else if (this.opStatus == 'edit') {
|
|
|
|
|
var editp = Ext.create('MsCodeFeeGroupTemplate', 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();
|
|
|
|
|
}
|
|
|
|
|
if (type == '0') {
|
|
|
|
|
this.opStatus = 'edit';
|
|
|
|
|
|
|
|
|
|
basicForm.findField('DM_ID').setDisabled(true);
|
|
|
|
|
|
|
|
|
|
for (var j = 0; j < this.storeBodyListDr.getCount(); j += 1) {
|
|
|
|
|
var memberbody = this.storeBodyListDr.getAt(j);
|
|
|
|
|
memberbody.set("DM_ID", this.editRecord.get('DM_ID'));
|
|
|
|
|
memberbody.commit();
|
|
|
|
|
};
|
|
|
|
|
for (var j = 0; j < this.storeBodyListCr.getCount(); j += 1) {
|
|
|
|
|
var memberbody = this.storeBodyListCr.getAt(j);
|
|
|
|
|
memberbody.set("DM_ID", this.editRecord.get('DM_ID'));
|
|
|
|
|
memberbody.commit();
|
|
|
|
|
};
|
|
|
|
|
for (var j = 0; j < this.storeWorkList.getCount(); j += 1) {
|
|
|
|
|
var memberwork = this.storeWorkList.getAt(j);
|
|
|
|
|
memberwork.set("DM_ID", this.editRecord.get('DM_ID'));
|
|
|
|
|
memberwork.commit();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} else if (type == '1') {
|
|
|
|
|
window.close();
|
|
|
|
|
} else {
|
|
|
|
|
this.LoadData('add', '');
|
|
|
|
|
basicForm.findField('DM_ID').setDisabled(false);
|
|
|
|
|
}
|
|
|
|
|
} 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.addDetail(type);
|
|
|
|
|
}, //end onAddDetailClick
|
|
|
|
|
|
|
|
|
|
onDelDetailClick: function (button, event, type) {
|
|
|
|
|
this.deleteDetail(type);
|
|
|
|
|
}, //onDelDetailClick
|
|
|
|
|
|
|
|
|
|
onAddSortDetailClick: function (button, event, type) {
|
|
|
|
|
this.addSortDetail(type);
|
|
|
|
|
}, //end onAddDetailClick
|
|
|
|
|
|
|
|
|
|
onDelSortDetailClick: function (button, event, type) {
|
|
|
|
|
this.deleteSortDetail(type);
|
|
|
|
|
}, //onDelDetailClick
|
|
|
|
|
|
|
|
|
|
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', '');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
addDetail: function (type) {
|
|
|
|
|
var newSerialno = 0;
|
|
|
|
|
|
|
|
|
|
if (type == 1) {
|
|
|
|
|
store = this.storeBodyListDr;
|
|
|
|
|
} else
|
|
|
|
|
store = this.storeBodyListCr;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var record = Ext.create('MsCodeDuiTemplateFee', {
|
|
|
|
|
DM_ID: '',
|
|
|
|
|
FeeType: type,
|
|
|
|
|
FeeName: "",
|
|
|
|
|
Currency: ""
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
store.add(record);
|
|
|
|
|
|
|
|
|
|
var n = store.getCount();
|
|
|
|
|
|
|
|
|
|
if (type == 1) {
|
|
|
|
|
this.gridListDrCellEditing.startEditByPosition({ row: n - 1, column: 1 });
|
|
|
|
|
} else
|
|
|
|
|
this.gridListCrCellEditing.startEditByPosition({ row: n - 1, column: 1 });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
deleteDetail: function (type) {
|
|
|
|
|
|
|
|
|
|
if (type == 1) {
|
|
|
|
|
var selectedRecords = this.gridListDr.selModel.getSelection();
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
|
|
var rec = selectedRecords[i];
|
|
|
|
|
|
|
|
|
|
this.storeBodyListDr.remove(rec);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
var selectedRecords = this.gridListCr.selModel.getSelection();
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
|
|
var rec = selectedRecords[i];
|
|
|
|
|
|
|
|
|
|
this.storeBodyListCr.remove(rec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
addCurrDetail: function (type) {
|
|
|
|
|
var newSerialno = 0;
|
|
|
|
|
|
|
|
|
|
store = this.storeWorkList;
|
|
|
|
|
var newSerialno = this.storeWorkList.getCount() + 1;
|
|
|
|
|
|
|
|
|
|
var record = Ext.create('MsCodeFeeGroupTotal', {
|
|
|
|
|
DM_ID: '',
|
|
|
|
|
CURRENCY: ""
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
store.add(record);
|
|
|
|
|
|
|
|
|
|
var n = store.getCount();
|
|
|
|
|
this.gridworkListCellEditing.startEditByPosition({ row: n - 1, column: 1 });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
deleteCurrDetail: function (type) {
|
|
|
|
|
|
|
|
|
|
var selectedRecords = this.gridWorkList.selModel.getSelection();
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < selectedRecords.length; i++) {
|
|
|
|
|
var rec = selectedRecords[i];
|
|
|
|
|
|
|
|
|
|
this.storeWorkList.remove(rec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|