|
|
|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
|
|
|
|
Shipping.MsInfoClientShipperEdit = function (config) {
|
|
|
|
|
Ext.applyIf(this, config);
|
|
|
|
|
this.initUIComponents();
|
|
|
|
|
window.Shipping.MsInfoClientShipperEdit.superclass.constructor.call(this);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Ext.extend(Shipping.MsInfoClientShipperEdit, Ext.Panel, {
|
|
|
|
|
|
|
|
|
|
ParentWin: null,
|
|
|
|
|
OpStatus: 'add',
|
|
|
|
|
StoreList: null,
|
|
|
|
|
EditRecord: null,
|
|
|
|
|
MainEditRecord: null,
|
|
|
|
|
|
|
|
|
|
//需求编号:SR2017061200005-1
|
|
|
|
|
initUIComponents: function () {
|
|
|
|
|
this.serialNo = 0;
|
|
|
|
|
this.workSerialNo = 0;
|
|
|
|
|
this.bodyDel = [];
|
|
|
|
|
|
|
|
|
|
//#region 编辑form
|
|
|
|
|
|
|
|
|
|
//枚举参照相关(编辑form)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//表参照相关(编辑form)
|
|
|
|
|
|
|
|
|
|
this.storeType = Ext.create('Ext.data.Store', {
|
|
|
|
|
fields: ['DC', 'NAME']
|
|
|
|
|
});
|
|
|
|
|
this.storeType.add({ "DC": 2, "NAME": "发货人" });
|
|
|
|
|
this.storeType.add({ "DC": 1, "NAME": "收货人" });
|
|
|
|
|
this.storeType.add({ "DC": 3, "NAME": "通知人" });
|
|
|
|
|
this.storeType.add({ "DC": 4, "NAME": "代理" });
|
|
|
|
|
|
|
|
|
|
this.comboxType = Ext.create('DsExt.ux.RefTableCombox', {
|
|
|
|
|
fieldLabel: Zi.LAN.SHIPPERTYPE, //'类型',
|
|
|
|
|
store: this.storeType,
|
|
|
|
|
valueField: 'DC',
|
|
|
|
|
displayField: 'NAME',
|
|
|
|
|
forceSelection: true,
|
|
|
|
|
name: 'SHIPPERTYPE'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
this.CheckISPUBLIC = new Ext.form.Checkbox({
|
|
|
|
|
fieldLabel: Zi.LAN.ISPUBLIC, //'是否公共',
|
|
|
|
|
inputValue: true,
|
|
|
|
|
name: 'ISPUBLIC'
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//编辑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: 60,
|
|
|
|
|
msgTarget: 'qtip'
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
items: [
|
|
|
|
|
{//fieldset 1
|
|
|
|
|
xtype: 'fieldset',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
layout: 'anchor',
|
|
|
|
|
defaults: {
|
|
|
|
|
anchor: '100%'
|
|
|
|
|
},
|
|
|
|
|
items: [{
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [{
|
|
|
|
|
fieldLabel: Zi.LAN.CODENAME, //'CODENAME',
|
|
|
|
|
name: 'CODENAME', flex: 0, hidden: true, margins: '0'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: Zi.LAN.SHIPPERID, //'代码',
|
|
|
|
|
name: 'SHIPPERID'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: Zi.LAN.SHORTNAME, //'简称',
|
|
|
|
|
name: 'SHORTNAME'
|
|
|
|
|
}, this.comboxType, this.CheckISPUBLIC
|
|
|
|
|
]
|
|
|
|
|
}, {
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [{
|
|
|
|
|
fieldLabel: Zi.LAN.SERVICECONTRACTNO, //'详细信息',
|
|
|
|
|
name: 'SERVICECONTRACTNO'
|
|
|
|
|
}, { xtype: 'hiddenfield' }, { xtype: 'hiddenfield'}]
|
|
|
|
|
}, {
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [{
|
|
|
|
|
xtype: 'textareafield',
|
|
|
|
|
grow: true,
|
|
|
|
|
fieldLabel: Zi.LAN.SHIPPERDETAIL, //'详细信息',
|
|
|
|
|
height: 160,
|
|
|
|
|
name: 'SHIPPERDETAIL',
|
|
|
|
|
anchor: '100%'
|
|
|
|
|
}]
|
|
|
|
|
}, {
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [{
|
|
|
|
|
fieldLabel: Zi.LAN.ATTN, //'代码',
|
|
|
|
|
name: 'ATTN'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: Zi.LAN.TEL, //'简称',
|
|
|
|
|
name: 'TEL'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}, {
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [{
|
|
|
|
|
fieldLabel: Zi.LAN.EMAIL, //'代码',
|
|
|
|
|
name: 'EMAIL'
|
|
|
|
|
}, {
|
|
|
|
|
fieldLabel: Zi.LAN.COUNTRYID, //'简称',
|
|
|
|
|
name: 'COUNTRY'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}, {
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [{
|
|
|
|
|
fieldLabel: Zi.LAN.CORPID, //'代码',
|
|
|
|
|
name: 'CORPID'
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}, {
|
|
|
|
|
xtype: 'container',
|
|
|
|
|
layout: 'hbox',
|
|
|
|
|
defaultType: 'textfield',
|
|
|
|
|
items: [{
|
|
|
|
|
xtype: 'textareafield',
|
|
|
|
|
grow: true,
|
|
|
|
|
fieldLabel: "企业代码说明", //'详细信息',
|
|
|
|
|
height: 120,
|
|
|
|
|
name: 'CORPIDSTR',
|
|
|
|
|
readOnly:true,
|
|
|
|
|
value: " 收发货人、通知人按《企业代码类型汇总表》中对应的企业代码类型填写,填写格式为“代码缩写+企业代码”。境内实际收发货人、通知人有统一社会信用代码的,应当填写境内实际收货人、通知人的统一社会信用代码,填写格式为“USCI+代码”;暂无统一社会信用代码的,填写组织机构代码,填写格式为“OC+代码”;所属国家或地区未列在《企业代码类型汇总表》或者无法提供表中所列企业代码类型的,应当填写实际收货人、通知人在所在国家或地区的法定企业注册代码,填写格式为“9999+企业代码”;为自然人的,应当填写身份证、护照号或其他有效证件,填写格式分别为“ID+身份证号”、“PASSPORT+护照号”、“8888+身份代码”。代码长度为128位",
|
|
|
|
|
anchor: '100%'
|
|
|
|
|
}]
|
|
|
|
|
}
|
|
|
|
|
]//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: Zi.LAN.btnESave, //"保存",
|
|
|
|
|
iconCls: "btnsave",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.Save('0');
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: Zi.LAN.btnESaveAndClose, //"保存并关闭",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.Save('1');
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
},
|
|
|
|
|
'-',
|
|
|
|
|
{
|
|
|
|
|
text: Zi.LAN.btnESaveAndNew, //"保存并新建",
|
|
|
|
|
handler: function (button, event) {
|
|
|
|
|
this.Save('2');
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}); //end 按钮Toolbar
|
|
|
|
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//#region 布局
|
|
|
|
|
//控件布局
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
|
|
items: [this.panelBtn, this.formEdit]
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//#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];
|
|
|
|
|
this.MainEditRecord = ret[3];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (this.opStatus == 'edit')
|
|
|
|
|
condition = " SHIPPERID='" + this.editRecord.get('SHIPPERID') + "'";
|
|
|
|
|
|
|
|
|
|
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: Zi.LAN.ZhengZaiChaXunShuJu, //'正在查询主表数据...',
|
|
|
|
|
url: '/MvcShipping/MsInfoClient/GetShipperData',
|
|
|
|
|
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: Zi.LAN.TiShi,
|
|
|
|
|
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 (this.opStatus == 'add') {
|
|
|
|
|
this.formEdit.getForm().findField('CODENAME').setValue(this.MainEditRecord.CODENAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
Ext.MessageBox.alert(Zi.LAN.FuWuQiXiangYingChuCuo, response.responseText);
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
scope: this
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, // end LoadDate
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Save: function (type) {
|
|
|
|
|
var basicForm = this.formEdit.getForm();
|
|
|
|
|
|
|
|
|
|
if (!basicForm.isValid()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var data = basicForm.getValues();
|
|
|
|
|
|
|
|
|
|
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
|
|
|
|
|
Ext.Ajax.request({
|
|
|
|
|
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, //'正在保存数据...',
|
|
|
|
|
url: '/MvcShipping/MsInfoClient/SaveShipper',
|
|
|
|
|
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('MsInfoClientShipperModel', 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';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (type == '1') {
|
|
|
|
|
window.close();
|
|
|
|
|
} else {
|
|
|
|
|
this.LoadData('add', '');
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.CuoWu, msg: jsonresult.Message, icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK });
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.TiShi,
|
|
|
|
|
msg: Zi.LAN.FuWuQiXiangYingChuCuo,
|
|
|
|
|
icon: Ext.Msg.ERROR, buttons: Ext.Msg.OK
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|