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.
1285 lines
44 KiB
JavaScript
1285 lines
44 KiB
JavaScript
Ext.namespace('Shipping');
|
|
|
|
Shipping.MsCodeExcelImpFormatEdit = function (config) {
|
|
Ext.applyIf(this, config);
|
|
this.initUIComponents();
|
|
window.Shipping.MsCodeExcelImpFormatEdit.superclass.constructor.call(this);
|
|
};
|
|
|
|
Ext.extend(Shipping.MsCodeExcelImpFormatEdit, Ext.Panel, {
|
|
|
|
ParentWin: null,
|
|
OpStatus: 'add',
|
|
StoreList: null,
|
|
EditRecord: null,
|
|
|
|
initUIComponents: function () {
|
|
this.serialNo = 0;
|
|
this.workSerialNo = 0;
|
|
this.bodyDel = [];
|
|
this.SELINKGID = '';
|
|
_this = this;
|
|
|
|
//#region 编辑form
|
|
|
|
//枚举参照相关(编辑form)
|
|
|
|
Ext.define('MsCodeFieldName', {
|
|
extend: 'Ext.data.Model',
|
|
idProperty: 'FieldName',
|
|
fields: [
|
|
{ name: 'FieldName', type: 'string' }
|
|
]
|
|
});
|
|
|
|
this.storeOpType = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
this.storeOpType.load({ params: { enumTypeId: 97019 } });
|
|
|
|
this.comboxOpType = Ext.create('DsExt.ux.RefTableCombox', {
|
|
fieldLabel: '业务模块',
|
|
store: this.storeOpType,
|
|
name: 'BSTYPE',
|
|
valueField: 'EnumValueName',
|
|
displayField: 'EnumValueName',
|
|
listeners: {
|
|
scope: this,
|
|
'select': function (combo, records, eOpts) {
|
|
if (records.length > 0) {
|
|
_this.LoadTableCMB(combo.value);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
this.StoreField = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'MsCodeFieldName',
|
|
proxy: { url: '/MvcShipping/MsCodeOpDef/GetFieldList' }
|
|
});
|
|
//this.StoreField.load({ params: { optable: "OP_SEAE" } });
|
|
|
|
|
|
this.comboxField = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.StoreField,
|
|
valueField: 'FieldName',
|
|
displayField: 'FieldName',
|
|
// forceSelection: true,
|
|
name: 'FIELDNAME'
|
|
});
|
|
|
|
|
|
|
|
|
|
//表参照相关(编辑form)
|
|
|
|
//编辑form
|
|
this.formEdit = Ext.widget('form', {
|
|
region: 'center',
|
|
frame: true,
|
|
bodyPadding: 2,
|
|
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: 'CORPID',
|
|
name: 'CORPID', flex: 0, hidden: true, margins: '0'
|
|
}, {
|
|
fieldLabel: 'CREATEUSER',
|
|
name: 'CREATEUSER', flex: 0, hidden: true, margins: '0'
|
|
}, this.comboxOpType, {
|
|
fieldLabel: '录入人',
|
|
readOnly: true,
|
|
name: 'CREATEUSERREF'
|
|
}, {
|
|
fieldLabel: '录入日期',
|
|
readOnly: true,
|
|
name: 'CREATETIME'
|
|
}
|
|
]
|
|
}, {
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [{
|
|
fieldLabel: '模板名称',
|
|
name: 'FMNAME',
|
|
allowBlank: false
|
|
}, {
|
|
fieldLabel: '模板说明',
|
|
flex: 2,
|
|
name: 'REMARK'
|
|
}]
|
|
|
|
}
|
|
]//end items(fieldset 1)
|
|
}//end fieldset 1
|
|
]//end root items
|
|
}); //end this.formEdit
|
|
|
|
//#endregion
|
|
|
|
_this = this;
|
|
|
|
//#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
|
|
},
|
|
'-',
|
|
{
|
|
text: "复制新建",
|
|
handler: function (button, event) {
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
this.opStatus = 'add';
|
|
basicForm.findField('GID').setDisabled(false);
|
|
var field = basicForm.findField('GID');
|
|
field.setValue(NewGuid());
|
|
basicForm.findField('GID').setDisabled(true);
|
|
field = basicForm.findField('CREATEUSERREF');
|
|
field.setValue('');
|
|
field = basicForm.findField('FMNAME');
|
|
field.setValue('');
|
|
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
|
|
var memberbody = this.storeBodyList.getAt(j);
|
|
memberbody.set("GID", NewGuid());
|
|
memberbody.set("LINKGID", '*');
|
|
memberbody.commit();
|
|
};
|
|
|
|
|
|
|
|
for (var j = 0; j < this.storeFeeList.getCount(); j += 1) {
|
|
var memberbody = this.storeFeeList.getAt(j);
|
|
var GID = memberbody.data.GID;
|
|
var feeid = NewGuid();
|
|
memberbody.set("GID", feeid);
|
|
memberbody.set("LINKGID", '*');
|
|
memberbody.commit();
|
|
//for (var i = 0; i < this.storeFeeBodyList.getCount(); i += 1) {
|
|
// var memberbody = this.storeFeeBodyList.getAt(i);
|
|
// var LINKGID = memberbody.data.LINKGID;
|
|
// if (LINKGID == GID) {
|
|
// var feebodyid = NewGuid();
|
|
// memberbody.set("GID", feebodyid);
|
|
// memberbody.set("LINKGID", feeid);
|
|
// memberbody.commit();
|
|
// }
|
|
|
|
//};
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
},
|
|
scope: this
|
|
}
|
|
]
|
|
}); //end 按钮Toolbar
|
|
|
|
//#endregion
|
|
|
|
//#region 明细表
|
|
|
|
//明细表表格相关
|
|
|
|
|
|
//明细表-数据集
|
|
this.storeBodyList = Ext.create('Ext.data.Store', {
|
|
model: 'MsCodeExcelImpFormatDetail',
|
|
remoteSort: true,
|
|
proxy: {
|
|
type: 'ajax',
|
|
url: '/MvcShipping/MsCodeExcelImpFormat/GetBodyList',
|
|
reader: {
|
|
root: 'data',
|
|
totalProperty: 'totalCount'
|
|
}
|
|
}
|
|
});
|
|
|
|
//明细表表格
|
|
this.gridListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
clicksToEdit: 1
|
|
});
|
|
|
|
this.storeTABLETYPE = Ext.create('Ext.data.Store', {
|
|
fields: ['DC', 'NAME']
|
|
});
|
|
this.storeTABLETYPE.add({ "DC": "业务表", "NAME": "业务表" });
|
|
this.storeTABLETYPE.add({ "DC": "费用表", "NAME": "费用表" });
|
|
|
|
this.comboxTABLETYPE = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.storeTABLETYPE,
|
|
valueField: 'DC',
|
|
displayField: 'NAME',
|
|
forceSelection: true,
|
|
name: 'TABLETYPE'
|
|
});
|
|
|
|
this.storeFieldType = Ext.create('Ext.data.Store', {
|
|
fields: ['TYPE', 'NAME']
|
|
});
|
|
this.storeFieldType.add({ "TYPE": "STR", "NAME": "字符型" });
|
|
this.storeFieldType.add({ "TYPE": "DATE", "NAME": "日期型" });
|
|
this.storeFieldType.add({ "TYPE": "BOOL", "NAME": "布尔型" });
|
|
|
|
this.comboxFieldType = Ext.create('DsExt.ux.RefTableCombox', {
|
|
// fieldLabel: '字段类型',
|
|
store: this.storeFieldType,
|
|
valueField: 'TYPE',
|
|
displayField: 'NAME',
|
|
forceSelection: true,
|
|
name: 'FIELDTYPE'
|
|
});
|
|
|
|
this.storeISDEF = Ext.create('Ext.data.Store', {
|
|
fields: ['DC', 'NAME']
|
|
});
|
|
this.storeISDEF.add({ "DC":'1', "NAME": "是" });
|
|
this.storeISDEF.add({ "DC":'', "NAME": "否" });
|
|
this.storeISDEF.add({ "DC": '0', "NAME": "否" });
|
|
|
|
this.comboxISDEF = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.storeISDEF,
|
|
valueField: 'DC',
|
|
displayField: 'NAME',
|
|
forceSelection: true,
|
|
name: 'ISDEF'
|
|
});
|
|
this.storeFeeList = Ext.create('Ext.data.Store', {
|
|
model: 'MsCodeExcelImpFormatFee',
|
|
remoteSort: true,
|
|
proxy: {
|
|
type: 'ajax',
|
|
url: '/MvcShipping/MsCodeExcelImpFormat/GetFeeList',
|
|
reader: {
|
|
root: 'data',
|
|
totalProperty: 'totalCount'
|
|
}
|
|
}
|
|
});
|
|
|
|
this.comboxFeeName = Ext.create('DsExt.ux.DCombox', {
|
|
store: this.storeFeeList,
|
|
minChars: 1,
|
|
// matchFieldWidth: false,
|
|
//queryParam: 'Name',
|
|
// lazyRender: false,
|
|
name: 'FEENAME',
|
|
valueField: 'FEEDESCRP',
|
|
displayField: 'FEEDESCRP'
|
|
});
|
|
|
|
this.gridList = new Ext.grid.GridPanel({
|
|
store: this.storeBodyList,
|
|
enableHdMenu: false,
|
|
region: 'center',
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
trackMouseOver: true,
|
|
disableSelection: false,
|
|
plugins: [this.gridListCellEditing],
|
|
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: 'GID',
|
|
header: 'GID',
|
|
hidden: true,
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'LINKGID',
|
|
header: 'LINKGID',
|
|
hidden: true,
|
|
width: 100
|
|
}
|
|
//, {
|
|
// sortable: true,
|
|
// dataIndex: 'TABLETYPE',
|
|
// header: '字段类别',
|
|
// editor: this.comboxTABLETYPE,
|
|
// width: 60
|
|
//}
|
|
|
|
, {
|
|
sortable: true,
|
|
dataIndex: 'FIELDNAME',
|
|
header: '字段名称',
|
|
editor: this.comboxField,
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'COLUMNNAME',
|
|
header: 'EXCEL列名',
|
|
editor: {
|
|
xtype: 'textfield',
|
|
selectOnFocus: true,
|
|
enableKeyEvents: true
|
|
|
|
},
|
|
width: 150
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'ISDEF',
|
|
header: '是否默认',
|
|
editor: this.comboxISDEF,
|
|
renderer: function (value, cellmeta) {
|
|
if (value == '1') {
|
|
return "是";
|
|
}
|
|
},
|
|
width: 60
|
|
},
|
|
|
|
//{
|
|
// sortable: true,
|
|
// dataIndex: 'FIELDTYPE',
|
|
// header: '字段类型',
|
|
// editor: this.comboxFieldType,
|
|
// renderer: function (value, cellmeta) {
|
|
// if (value == 'STR') {
|
|
// return "字符型";
|
|
// } else if (value == 'BOOL') {
|
|
// return "布尔型";
|
|
// } if (value == 'DATE') {
|
|
// return "日期型";
|
|
// }
|
|
// },
|
|
// width: 80
|
|
//},
|
|
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'DEFVALUE',
|
|
header: '默认值',
|
|
editor: {
|
|
xtype: 'textfield',
|
|
selectOnFocus: true,
|
|
enableKeyEvents: true
|
|
|
|
},
|
|
width: 200
|
|
}
|
|
|
|
// , {
|
|
// sortable: true,
|
|
// dataIndex: 'FEENAME',
|
|
// header: '费用名称',
|
|
// editor: this.comboxFeeName,
|
|
// width: 140
|
|
//}
|
|
]
|
|
});
|
|
|
|
this.gridListCellEditing.on('beforeedit', function (editor, e) {
|
|
return this.cellEditingBeforeEdit(editor, e);
|
|
}, this);
|
|
|
|
|
|
|
|
this.panelService = new Ext.Panel({
|
|
title: '明细设置',
|
|
layout: "border",
|
|
region: 'center',
|
|
// margin: '5 10',
|
|
|
|
items: [this.gridList]
|
|
});
|
|
|
|
//#endregion 费用明细表
|
|
|
|
//明细表-数据集
|
|
|
|
|
|
//明细表表格
|
|
this.gridListFeeCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
clicksToEdit: 1
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//this.StoreFeeField = Ext.create('DsExt.ux.RefTableStore', {
|
|
// model: 'MsCodeFieldName',
|
|
// proxy: { url: '/MvcShipping/MsCodeOpDef/GetFieldList' }
|
|
//});
|
|
//this.StoreFeeField.load({ params: { optable: "CH_FEE" } });
|
|
|
|
|
|
//this.comboxFeeField = Ext.create('DsExt.ux.RefTableCombox', {
|
|
// store: this.StoreFeeField,
|
|
// valueField: 'FieldName',
|
|
// displayField: 'FieldName',
|
|
// name: 'FEENAME'
|
|
//});
|
|
|
|
this.storeFeeNameRef = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'DsShipping.ux.FeeTypeRefModel',
|
|
proxy: { url: '/MvcShipping/MsChFee/GetFeeTypeRefListNew' }
|
|
});
|
|
|
|
this.storeFeeNameRef.load();
|
|
|
|
this.comboxFeeNameRef = Ext.create('DsExt.ux.DCombox', {
|
|
store: this.storeFeeNameRef,
|
|
minChars: 1,
|
|
matchFieldWidth: false,
|
|
//queryParam: 'Name',
|
|
lazyRender: false,
|
|
name: 'FeeName',
|
|
valueField: 'Name',
|
|
displayField: 'CodeAndName'
|
|
});
|
|
|
|
this.storeFeeType = Ext.create('Ext.data.Store', {
|
|
fields: ['FType', 'NAME']
|
|
});
|
|
this.storeFeeType.add({ "FType": 1, "NAME": "收" });
|
|
this.storeFeeType.add({ "FType": 2, "NAME": "付" });
|
|
|
|
this.comboxFeeType = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.storeFeeType,
|
|
valueField: 'FType',
|
|
displayField: 'NAME',
|
|
forceSelection: true,
|
|
name: 'FeeType'
|
|
});
|
|
|
|
|
|
this.gridFeeList = new Ext.grid.GridPanel({
|
|
store: this.storeFeeList,
|
|
enableHdMenu: false,
|
|
region: 'center',
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
trackMouseOver: true,
|
|
disableSelection: false,
|
|
plugins: [this.gridListFeeCellEditing],
|
|
selType: 'cellmodel',
|
|
tbar: [{
|
|
text: '增加明细',
|
|
tooltip: '增加明细',
|
|
iconCls: "btnadddetail",
|
|
handler: function (button, event) {
|
|
this.addFeeDetail();
|
|
},
|
|
scope: this
|
|
}, '-', {
|
|
text: '删除明细',
|
|
tooltip: '删除明细',
|
|
iconCls: "btndeletedetail",
|
|
handler: function (button, event) {
|
|
this.deleteFeeDetail();
|
|
},
|
|
scope: this
|
|
}],
|
|
columns: [{
|
|
sortable: true,
|
|
dataIndex: 'GID',
|
|
header: 'GID',
|
|
hidden: true,
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'LINKGID',
|
|
header: 'LINKGID',
|
|
hidden: true,
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'FEEDESCRP',
|
|
header: '费用描述',
|
|
editor: {
|
|
xtype: 'textfield',
|
|
selectOnFocus: true,
|
|
enableKeyEvents: true
|
|
|
|
},
|
|
width: 150
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'FEENAME',
|
|
header: '系统费用名称',
|
|
editor: this.comboxFeeNameRef,
|
|
width: 140
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'FEETYPE',
|
|
header: '收付', //'应收费用名称',
|
|
editor: this.comboxFeeType,
|
|
width: 40,
|
|
renderer: function (value, cellmeta) {
|
|
if (value == 'true' || value == '1' || value == 1) {
|
|
return "收";
|
|
} else return "付";
|
|
},
|
|
}
|
|
]
|
|
});
|
|
|
|
this.gridFeeList.addListener('itemclick', function (dataview, record, item, index, e, b) {
|
|
this.SELINKGID = record.data.GID;
|
|
this.storeFeeBodyList.load({ params: { condition: "LINKGID='" + record.data.GID + "'" }, scope: this });
|
|
}, this);
|
|
|
|
this.storeFeeBodyList = Ext.create('Ext.data.Store', {
|
|
model: 'MsCodeExcelImpFormatDetail',
|
|
remoteSort: true,
|
|
proxy: {
|
|
type: 'ajax',
|
|
url: '/MvcShipping/MsCodeExcelImpFormat/GetBodyList',
|
|
reader: {
|
|
root: 'data',
|
|
totalProperty: 'totalCount'
|
|
}
|
|
}
|
|
});
|
|
|
|
//明细表表格
|
|
this.gridFeeBodyListCellEditing = Ext.create('Ext.grid.plugin.CellEditing', {
|
|
clicksToEdit: 1
|
|
});
|
|
|
|
this.storeISDEF2 = Ext.create('Ext.data.Store', {
|
|
fields: ['DC', 'NAME']
|
|
});
|
|
this.storeISDEF2.add({ "DC": '1', "NAME": "是" });
|
|
this.storeISDEF2.add({ "DC": '', "NAME": "否" });
|
|
this.storeISDEF2.add({ "DC": '0', "NAME": "否" });
|
|
|
|
this.comboxISDEF2 = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.storeISDEF2,
|
|
valueField: 'DC',
|
|
displayField: 'NAME',
|
|
forceSelection: true,
|
|
name: 'ISDEF'
|
|
});
|
|
|
|
this.StoreFeeField = Ext.create('DsExt.ux.RefTableStore', {
|
|
model: 'MsCodeFieldName',
|
|
proxy: { url: '/MvcShipping/MsCodeOpDef/GetFieldList' }
|
|
});
|
|
this.StoreFeeField.load({ params: { optable: "CH_FEE" } });
|
|
|
|
|
|
this.comboxFeeField = Ext.create('DsExt.ux.RefTableCombox', {
|
|
store: this.StoreFeeField,
|
|
valueField: 'FieldName',
|
|
displayField: 'FieldName',
|
|
// forceSelection: true,
|
|
name: 'FIELDNAME'
|
|
});
|
|
|
|
this.gridFeeBodyList = new Ext.grid.GridPanel({
|
|
store: this.storeFeeBodyList,
|
|
enableHdMenu: false,
|
|
region: 'center',
|
|
loadMask: { msg: "数据加载中,请稍等..." },
|
|
trackMouseOver: true,
|
|
disableSelection: false,
|
|
plugins: [this.gridFeeBodyListCellEditing],
|
|
selType: 'cellmodel',
|
|
tbar: [{
|
|
text: '增加明细',
|
|
tooltip: '增加明细',
|
|
iconCls: "btnadddetail",
|
|
handler: function (button, event) {
|
|
this.onAddFeeBody();
|
|
},
|
|
scope: this
|
|
}, {
|
|
text: "保存明细",
|
|
iconCls: "btnsave",
|
|
handler: function (button, event) {
|
|
this.onSaveFeeBody();
|
|
},
|
|
scope: this
|
|
}, '-', {
|
|
text: '删除明细',
|
|
tooltip: '删除明细',
|
|
iconCls: "btndeletedetail",
|
|
handler: function (button, event) {
|
|
this.onDelFeeBody();
|
|
},
|
|
scope: this
|
|
}],
|
|
columns: [{
|
|
sortable: true,
|
|
dataIndex: 'GID',
|
|
header: 'GID',
|
|
hidden: true,
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'LINKGID',
|
|
header: 'LINKGID',
|
|
hidden: true,
|
|
width: 100
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'FIELDNAME',
|
|
header: '字段名称',
|
|
editor: this.comboxFeeField,
|
|
width: 120
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'COLUMNNAME',
|
|
header: 'EXCEL列名',
|
|
editor: {
|
|
xtype: 'textfield',
|
|
selectOnFocus: true,
|
|
enableKeyEvents: true
|
|
|
|
},
|
|
width: 150
|
|
}, {
|
|
sortable: true,
|
|
dataIndex: 'ISDEF',
|
|
header: '是否默认',
|
|
editor: this.comboxISDEF2,
|
|
renderer: function (value, cellmeta) {
|
|
if (value == '1') {
|
|
return "是";
|
|
}
|
|
},
|
|
width: 60
|
|
},
|
|
{
|
|
sortable: true,
|
|
dataIndex: 'DEFVALUE',
|
|
header: '默认值',
|
|
editor: {
|
|
xtype: 'textfield',
|
|
selectOnFocus: true,
|
|
enableKeyEvents: true
|
|
|
|
},
|
|
width: 200
|
|
}
|
|
]
|
|
});
|
|
|
|
|
|
this.panelFeeBody = new Ext.Panel({
|
|
title: '费用明细设置',
|
|
layout: "border",
|
|
region: 'south',
|
|
split: true,
|
|
height:350,
|
|
items: [this.gridFeeBodyList]
|
|
});
|
|
|
|
this.panelFee = new Ext.Panel({
|
|
title: '费用名称',
|
|
layout: "border",
|
|
region: 'east',
|
|
width:750,
|
|
// margin: '5 10',
|
|
split: true,
|
|
|
|
items: [this.gridFeeList, this.panelFeeBody]
|
|
});
|
|
|
|
//#endregion 明细表
|
|
|
|
|
|
|
|
|
|
this.paneldetail = new Ext.Panel({
|
|
layout: "border",
|
|
region: "center",
|
|
items: [
|
|
this.panelService, this.panelFee
|
|
]
|
|
});
|
|
|
|
|
|
|
|
//#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.gridList.on('edit', function (editor, e, eOpts) {
|
|
// this.gridAfterEdit(editor, e, eOpts);
|
|
// }, this);
|
|
|
|
this.storeBodyList.on('beforeload', function (store) {
|
|
var cargoid = 0;
|
|
if (this.opStatus == 'edit') {
|
|
cargoid = this.editRecord.get('GID');
|
|
|
|
}
|
|
var sql = " LINKGID='" + cargoid + "'";
|
|
Ext.apply(store.proxy.extraParams, { condition: sql });
|
|
}, 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/MsCodeExcelImpFormat/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);
|
|
|
|
_this.LoadTableCMB(data.BSTYPE);
|
|
|
|
} else {
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
}
|
|
},
|
|
scope: this
|
|
});
|
|
|
|
var billno = '*';
|
|
var cargoid = 0;
|
|
if (this.opStatus == 'edit') {
|
|
cargoid = this.editRecord.get('GID');
|
|
|
|
}
|
|
this.storeBodyList.load({ params: { condition: " LINKGID='" + cargoid + "'" } });
|
|
this.storeFeeList.load({ params: { condition: " LINKGID='" + cargoid + "'" } });
|
|
}, // end LoadDate
|
|
|
|
|
|
Save: function (type) {
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
if (!basicForm.isValid()) {
|
|
return;
|
|
}
|
|
|
|
//判断表格数据是否合法
|
|
if (!validateEditorGridPanel(this.gridList)) {
|
|
return;
|
|
}
|
|
|
|
basicForm.findField('GID').setDisabled(false);
|
|
var data = basicForm.getValues();
|
|
basicForm.findField('GID').setDisabled(true);
|
|
if (this.opStatus == 'add') {
|
|
data.DM_ID = NewGuid();
|
|
}
|
|
var bodydatas = [];
|
|
for (var i = 0; i < this.storeBodyList.getCount(); i += 1) {
|
|
var member = this.storeBodyList.getAt(i);
|
|
bodydatas.push(member);
|
|
}
|
|
|
|
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
|
|
|
|
var bodyfeedatas = [];
|
|
for (var i = 0; i < this.storeFeeList.getCount(); i += 1) {
|
|
var member = this.storeFeeList.getAt(i);
|
|
bodyfeedatas.push(member);
|
|
}
|
|
|
|
var jsonfeeBody = ConvertRecordsToJsonAll(bodyfeedatas);
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在保存数据...',
|
|
url: '/MvcShipping/MsCodeExcelImpFormat/Save',
|
|
scope: this,
|
|
params: {
|
|
opstatus: this.opStatus,
|
|
data: Ext.JSON.encode(data),
|
|
body: jsonBody,
|
|
bodyfee: jsonfeeBody
|
|
},
|
|
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('MsCodeExcelImpFormat', 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('GID').setDisabled(true);
|
|
|
|
for (var j = 0; j < this.storeBodyList.getCount(); j += 1) {
|
|
var memberbody = this.storeBodyList.getAt(j);
|
|
memberbody.set("LINKGID", this.editRecord.get('GID'));
|
|
memberbody.commit();
|
|
};
|
|
for (var j = 0; j < this.storeFeeList.getCount(); j += 1) {
|
|
var memberbody = this.storeFeeList.getAt(j);
|
|
memberbody.set("LINKGID", this.editRecord.get('GID'));
|
|
memberbody.commit();
|
|
};
|
|
|
|
} else if (type == '1') {
|
|
window.close();
|
|
} else {
|
|
this.LoadData('add', '');
|
|
basicForm.findField('GID').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
|
|
|
|
|
|
|
|
addDetail: function (type) {
|
|
var newSerialno = 0;
|
|
|
|
store = this.storeBodyList;
|
|
|
|
var record = Ext.create('MsCodeExcelImpFormatDetail', {
|
|
GID: NewGuid(),
|
|
LINKGID: '*',
|
|
TABLETYPE: "业务表",
|
|
FIELDNAME: "",
|
|
COLUMNNAME: ""
|
|
|
|
});
|
|
|
|
store.add(record);
|
|
|
|
var n = store.getCount();
|
|
this.gridListCellEditing.startEditByPosition({ row:n-1, column: 1 });
|
|
|
|
},
|
|
addFeeDetail: function () {
|
|
var newSerialno = 0;
|
|
|
|
store = this.storeFeeList;
|
|
|
|
var record = Ext.create('MsCodeExcelImpFormatFee', {
|
|
GID: NewGuid(),
|
|
LINKGID: '*',
|
|
FEENAME: ""
|
|
|
|
});
|
|
|
|
store.add(record);
|
|
|
|
var n = store.getCount();
|
|
this.gridListFeeCellEditing.startEditByPosition({ row: n-1, column: 1 });
|
|
|
|
},
|
|
onAddFeeBody: function () {
|
|
var selections = this.gridFeeList.getSelectionModel().getSelection();
|
|
if (selections.length > 0) {
|
|
var LINKGID = selections[0].data.LINKGID;
|
|
if (LINKGID == "" || LINKGID == "*") {
|
|
Ext.Msg.show({ title: '提示', msg: '请先保存费用名称!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
return;
|
|
}
|
|
this.SELINKGID = selections[0].data.GID;
|
|
|
|
store = this.storeFeeBodyList;
|
|
|
|
var record = Ext.create('MsCodeExcelImpFormatDetail', {
|
|
GID: NewGuid(),
|
|
LINKGID: '*',
|
|
TABLETYPE: "费用表",
|
|
FIELDNAME: "",
|
|
COLUMNNAME: ""
|
|
|
|
});
|
|
|
|
store.add(record);
|
|
|
|
var n = store.getCount();
|
|
this.gridFeeBodyListCellEditing.startEditByPosition({ row: n - 1, column: 1 });
|
|
}
|
|
else {
|
|
Ext.Msg.show({ title: '警告', msg: '请先选择费用名称!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
}
|
|
|
|
|
|
},
|
|
|
|
cellEditingBeforeEdit: function (editor, e) {
|
|
|
|
if (e.field == 'FIELDNAME') {
|
|
var TABLETYPE = e.record.get('TABLETYPE');
|
|
if (TABLETYPE == '费用表') {
|
|
this.LoadTableCMB('费用表');
|
|
} else {
|
|
var BSTYPE = this.formEdit.getForm().findField('BSTYPE').getValue();
|
|
this.LoadTableCMB(BSTYPE);
|
|
}
|
|
}
|
|
},
|
|
deleteDetail: function (type) {
|
|
|
|
var selectedRecords = this.gridList.selModel.getSelection();
|
|
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];
|
|
var GID = record.data.GID;
|
|
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
|
|
if (btn == 'yes') {
|
|
Ext.Msg.wait('正在删除数据...');
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在删除数据...',
|
|
url: '/MvcShipping/MsCodeExcelImpFormat/DeleteDetail',
|
|
params: {
|
|
GID: GID
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
if (jsonresult.Success) {
|
|
this.storeBodyList.remove(record);
|
|
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);
|
|
|
|
|
|
},
|
|
deleteFeeDetail: function () {
|
|
|
|
var selectedRecords = this.gridFeeList.selModel.getSelection();
|
|
var selections = this.gridFeeList.getSelectionModel().getSelection();
|
|
if (selections.length == 0) {
|
|
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
return;
|
|
}
|
|
|
|
var record = selections[0];
|
|
var GID = record.data.GID;
|
|
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
|
|
if (btn == 'yes') {
|
|
Ext.Msg.wait('正在删除数据...');
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在删除数据...',
|
|
url: '/MvcShipping/MsCodeExcelImpFormat/DeleteFeeDetail',
|
|
params: {
|
|
GID: GID
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
if (jsonresult.Success) {
|
|
this.storeFeeList.remove(record);
|
|
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);
|
|
|
|
|
|
},
|
|
|
|
onDelFeeBody: function () {
|
|
var selectedRecords = this.gridFeeBodyList.selModel.getSelection();
|
|
var selections = this.gridFeeBodyList.getSelectionModel().getSelection();
|
|
if (selections.length == 0) {
|
|
Ext.Msg.show({ title: '提示', msg: '请先选择单据!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
return;
|
|
}
|
|
|
|
var record = selections[0];
|
|
var GID = record.data.GID;
|
|
Ext.MessageBox.confirm('提示', '确定删除该记录吗?', function (btn) {
|
|
if (btn == 'yes') {
|
|
Ext.Msg.wait('正在删除数据...');
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在删除数据...',
|
|
url: '/MvcShipping/MsCodeExcelImpFormat/DeleteDetail',
|
|
params: {
|
|
GID: GID
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
if (jsonresult.Success) {
|
|
this.storeFeeBodyList.remove(record);
|
|
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);
|
|
},
|
|
onSaveFeeBody: function () {
|
|
var selections = this.gridFeeList.getSelectionModel().getSelection();
|
|
if (selections.length > 0) {
|
|
var LINKGID = selections[0].data.LINKGID;
|
|
if (LINKGID == "" || LINKGID == "*") {
|
|
Ext.Msg.show({ title: '提示', msg: '请先保存费用名称!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
return;
|
|
}
|
|
this.SELINKGID = selections[0].data.GID;
|
|
var bodydatas = [];
|
|
|
|
for (var i = 0; i < this.storeFeeBodyList.getCount(); i += 1) {
|
|
var member = this.storeFeeBodyList.getAt(i);
|
|
bodydatas.push(member);
|
|
}
|
|
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
Ext.Ajax.request({
|
|
waitMsg: '正在保存数据...',
|
|
url: '/MvcShipping/MsCodeExcelImpFormat/SaveBodyDetail',
|
|
scope: this,
|
|
params: {
|
|
body: jsonBody,
|
|
gid: this.SELINKGID
|
|
},
|
|
callback: function (options, success, response) {
|
|
if (success) {
|
|
Ext.MessageBox.hide();
|
|
var jsonresult = Ext.JSON.decode(response.responseText);
|
|
if (jsonresult.Success) {
|
|
this.storeFeeBodyList.reload();
|
|
} 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 });
|
|
}
|
|
}
|
|
});
|
|
|
|
}
|
|
else {
|
|
Ext.Msg.show({ title: '警告', msg: '请先选择费用名称!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
}
|
|
},
|
|
|
|
LoadTableCMB: function (name) {
|
|
|
|
if (name == '海运出口') {
|
|
this.StoreField.load({ params: { optable: "OP_SEAE" } });
|
|
} if (name == '费用表') {
|
|
this.StoreField.load({ params: { optable: "CH_FEE" } });
|
|
}
|
|
if (name == '海运进口') {
|
|
this.StoreField.load({ params: { optable: "OP_SEAI" } });
|
|
}
|
|
if (name == '空运出口') {
|
|
this.StoreField.load({ params: { optable: "OP_AIRE" } });
|
|
}
|
|
if (name == '空运进口') {
|
|
this.StoreField.load({ params: { optable: "OP_AIRI" } });
|
|
}
|
|
if (name == '综合业务') {
|
|
this.StoreField.load({ params: { optable: "OP_OTHER" } });
|
|
}
|
|
if (name == '报关业务') {
|
|
this.StoreField.load({ params: { optable: "OP_APPLY" } });
|
|
}
|
|
if (name == '大宗散货') {
|
|
this.StoreField.load({ params: { optable: "OP_BULK" } });
|
|
}
|
|
if (name == '陆运派车单') {
|
|
this.StoreField.load({ params: { optable: "tMsWlPcHead" } });
|
|
} if (name == '付费申请') {
|
|
this.StoreField.load({ params: { optable: "CH_FEE_PAYAPPLICATION" } });
|
|
} if (name == '收费申请') {
|
|
this.StoreField.load({ params: { optable: "CH_FEE_RECVAPPLICATION" } });
|
|
} if (name == '发票申请') {
|
|
this.StoreField.load({ params: { optable: "CH_FEE_INVOICEAPPLICATION" } });
|
|
} if (name == '发票开出') {
|
|
this.StoreField.load({ params: { optable: "CH_FEE_INVOICE" } });
|
|
} if (name == '发票核销') {
|
|
this.StoreField.load({ params: { optable: "CH_FEE_INVOICEHEXIAO" } });
|
|
} if (name == '舱单申报') {
|
|
this.StoreField.load({ params: { optable: "OP_SEAE_EDI" } });
|
|
}
|
|
}
|
|
|
|
});
|
|
|
|
|