|
|
|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
|
|
|
|
Shipping.MsCodeOpDefEdit = function (config) {
|
|
|
|
|
Ext.applyIf(this, config);
|
|
|
|
|
this.initUIComponents();
|
|
|
|
|
window.Shipping.MsCodeOpDefEdit.superclass.constructor.call(this);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Ext.extend(Shipping.MsCodeOpDefEdit, Ext.Panel, {
|
|
|
|
|
|
|
|
|
|
ParentWin: null,
|
|
|
|
|
OpStatus: 'add',
|
|
|
|
|
StoreList: null,
|
|
|
|
|
EditRecord: null,
|
|
|
|
|
|
|
|
|
|
initUIComponents: function () {
|
|
|
|
|
this.serialNo = 0;
|
|
|
|
|
this.workSerialNo = 0;
|
|
|
|
|
this.bodyDel = [];
|
|
|
|
|
|
|
|
|
|
//#region 编辑form
|
|
|
|
|
|
|
|
|
|
//枚举参照相关(编辑form)
|
|
|
|
|
|
|
|
|
|
this.storeOpType = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
|
|
|
this.storeOpType.load({ params: { enumTypeId: 96005} });
|
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
if (combo.value == '海运出口') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "OP_SEAE"} });
|
|
|
|
|
}
|
|
|
|
|
if (combo.value == '海运进口') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "OP_SEAI"} });
|
|
|
|
|
} if (combo.value == '空运出口') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "OP_AIRE" } });
|
|
|
|
|
}
|
|
|
|
|
if (combo.value == '空运进口') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "OP_AIRI" } });
|
|
|
|
|
}
|
|
|
|
|
if (combo.value == '综合业务') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "OP_OTHER"} });
|
|
|
|
|
}
|
|
|
|
|
if (combo.value == '铁路运输') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "OP_RAILWAY" } });
|
|
|
|
|
}
|
|
|
|
|
if (combo.value == '报关业务') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "OP_APPLY"} });
|
|
|
|
|
}
|
|
|
|
|
if (combo.value == '大宗散货') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "OP_BULK"} });
|
|
|
|
|
}
|
|
|
|
|
if (combo.value == '陆运派车单') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "tMsWlPCHead"} });
|
|
|
|
|
}
|
|
|
|
|
if (combo.value == '国内空运') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "OP_AIRN"} });
|
|
|
|
|
}
|
|
|
|
|
if (combo.value == '销售订舱') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "CRM_SEAEORDER"} });
|
|
|
|
|
}
|
|
|
|
|
if (combo.value == '海运出口舱单AMS') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "OP_SEAE_AMS"} });
|
|
|
|
|
}
|
|
|
|
|
if (combo.value == '费用信息') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "CH_FEE" } });
|
|
|
|
|
} if (combo.value == '仓储入库') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "WMS" } });
|
|
|
|
|
} if (combo.value == '仓储出库') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "WMS_OUT" } });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (combo.value == '押箱业务') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "MsOp_YAXIANG" } });
|
|
|
|
|
} if (combo.value == '国内空运') {
|
|
|
|
|
this.StoreField.load({ params: { optable: "OP_AIRN" } });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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', {
|
|
|
|
|
fieldLabel: '字段名称',
|
|
|
|
|
store: this.StoreField,
|
|
|
|
|
valueField: 'FieldName',
|
|
|
|
|
displayField: 'FieldName',
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
name: 'FIELDNAME'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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',
|
|
|
|
|
listeners: {
|
|
|
|
|
scope: this,
|
|
|
|
|
'select': function (combo, records, eOpts) {
|
|
|
|
|
if (records.length > 0) {
|
|
|
|
|
if (combo.value == 'STR') {
|
|
|
|
|
var DEFVALUESTR = Ext.getCmp('strvalue');
|
|
|
|
|
var DEFVALUESTRDATE = Ext.getCmp('datevalue');
|
|
|
|
|
var DEFVALUESTRBOOL = Ext.getCmp('boolvalue');
|
|
|
|
|
DEFVALUESTR.setVisible(true);
|
|
|
|
|
DEFVALUESTRDATE.setVisible(false);
|
|
|
|
|
DEFVALUESTRBOOL.setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
if (combo.value == 'DATE') {
|
|
|
|
|
var DEFVALUESTR = Ext.getCmp('strvalue');
|
|
|
|
|
var DEFVALUESTRDATE = Ext.getCmp('datevalue');
|
|
|
|
|
var DEFVALUESTRBOOL = Ext.getCmp('boolvalue');
|
|
|
|
|
DEFVALUESTR.setVisible(false);
|
|
|
|
|
DEFVALUESTRDATE.setVisible(true);
|
|
|
|
|
DEFVALUESTRBOOL.setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
if (combo.value == 'BOOL') {
|
|
|
|
|
var DEFVALUESTR = Ext.getCmp('strvalue');
|
|
|
|
|
var DEFVALUESTRDATE = Ext.getCmp('datevalue');
|
|
|
|
|
var DEFVALUESTRBOOL = Ext.getCmp('boolvalue');
|
|
|
|
|
DEFVALUESTR.setVisible(false);
|
|
|
|
|
DEFVALUESTRDATE.setVisible(false);
|
|
|
|
|
DEFVALUESTRBOOL.setVisible(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//表参照相关(编辑form)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.panelBody = new Ext.Panel({
|
|
|
|
|
title: '默认值',
|
|
|
|
|
layout: "border",
|
|
|
|
|
height: 90,
|
|
|
|
|
frame: true,
|
|
|
|
|
items: [{
|
|
|
|
|
xtype: 'textareafield',
|
|
|
|
|
// fieldLabel: '默认值',
|
|
|
|
|
grow: true,
|
|
|
|
|
id: 'strvalue',
|
|
|
|
|
hidden: true,
|
|
|
|
|
height: 70,
|
|
|
|
|
name: 'DEFVALUESTR',
|
|
|
|
|
anchor: '100%'
|
|
|
|
|
}, {
|
|
|
|
|
// fieldLabel: '默认值',
|
|
|
|
|
format: 'Y-m-d',
|
|
|
|
|
hidden: true,
|
|
|
|
|
id: 'datevalue',
|
|
|
|
|
flex: 1,
|
|
|
|
|
xtype: 'datefield',
|
|
|
|
|
name: 'DEFVALUESTRDATE'
|
|
|
|
|
}, {
|
|
|
|
|
xtype: 'checkboxfield',
|
|
|
|
|
// boxLabel: '默认值',
|
|
|
|
|
name: 'DEFVALUESTRBOOL',
|
|
|
|
|
id: 'boolvalue',
|
|
|
|
|
hidden: true,
|
|
|
|
|
inputValue: true,
|
|
|
|
|
checked: true
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//编辑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: 'CORPID',
|
|
|
|
|
name: 'CORPID', flex: 0, hidden: true, margins: '0'
|
|
|
|
|
}, this.comboxOpType, this.comboxField, this.comboxFieldType]
|
|
|
|
|
}, this.panelBody, {
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [{
|
|
|
|
|
fieldLabel: '说明',
|
|
|
|
|
name: 'REMARKS'
|
|
|
|
|
}]
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
]//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.panelTop = new Ext.Panel({
|
|
|
|
|
layout: "border",
|
|
|
|
|
region: "north",
|
|
|
|
|
height: 280,
|
|
|
|
|
items: [this.panelBtn, this.formEdit]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
|
|
items: [this.panelTop]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
//绑定查询窗体
|
|
|
|
|
this.ParentWin = window.parent.opener;
|
|
|
|
|
|
|
|
|
|
//初始化数据
|
|
|
|
|
this.InitData();
|
|
|
|
|
|
|
|
|
|
//绑定事件
|
|
|
|
|
|
|
|
|
|
}, //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/MsCodeOpDef/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);
|
|
|
|
|
if (data.FIELDTYPE == 'STR') {
|
|
|
|
|
var DEFVALUESTR = Ext.getCmp('strvalue');
|
|
|
|
|
var DEFVALUESTRDATE = Ext.getCmp('datevalue');
|
|
|
|
|
var DEFVALUESTRBOOL = Ext.getCmp('boolvalue');
|
|
|
|
|
DEFVALUESTR.setVisible(true);
|
|
|
|
|
DEFVALUESTRDATE.setVisible(false);
|
|
|
|
|
DEFVALUESTRBOOL.setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
if (data.FIELDTYPE == 'DATE') {
|
|
|
|
|
var DEFVALUESTR = Ext.getCmp('strvalue');
|
|
|
|
|
var DEFVALUESTRDATE = Ext.getCmp('datevalue');
|
|
|
|
|
var DEFVALUESTRBOOL = Ext.getCmp('boolvalue');
|
|
|
|
|
DEFVALUESTR.setVisible(false);
|
|
|
|
|
DEFVALUESTRDATE.setVisible(true);
|
|
|
|
|
DEFVALUESTRBOOL.setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
if (data.FIELDTYPE == 'BOOL') {
|
|
|
|
|
var DEFVALUESTR = Ext.getCmp('strvalue');
|
|
|
|
|
var DEFVALUESTRDATE = Ext.getCmp('datevalue');
|
|
|
|
|
var DEFVALUESTRBOOL = Ext.getCmp('boolvalue');
|
|
|
|
|
DEFVALUESTR.setVisible(false);
|
|
|
|
|
DEFVALUESTRDATE.setVisible(false);
|
|
|
|
|
DEFVALUESTRBOOL.setVisible(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, // end LoadDate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Save: function (type) {
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
basicForm.findField('GID').setDisabled(false);
|
|
|
|
|
var data = basicForm.getValues();
|
|
|
|
|
basicForm.findField('GID').setDisabled(true);
|
|
|
|
|
if (this.opStatus == 'add') {
|
|
|
|
|
data.GID = NewGuid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ext.Msg.wait('正在保存数据, 请稍侯..');
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
waitMsg: '正在保存数据...',
|
|
|
|
|
url: '/MvcShipping/MsCodeOpDef/Save',
|
|
|
|
|
scope: this,
|
|
|
|
|
params: {
|
|
|
|
|
opstatus: this.opStatus,
|
|
|
|
|
data: Ext.JSON.encode(data)
|
|
|
|
|
},
|
|
|
|
|
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('MsCodeOpDef', 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);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|