|
|
Ext.namespace('Shipping');
|
|
|
|
|
|
Shipping.MsInfoClientContactEdit = function (config) {
|
|
|
Ext.applyIf(this, config);
|
|
|
this.initUIComponents();
|
|
|
window.Shipping.MsInfoClientContactEdit.superclass.constructor.call(this);
|
|
|
};
|
|
|
|
|
|
Ext.extend(Shipping.MsInfoClientContactEdit, 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.myCheckboxService = new Ext.form.CheckboxGroup({
|
|
|
id: 'myService',
|
|
|
xtype: 'checkboxgroup',
|
|
|
fieldLabel: Zi.LAN.LianXiRenLeiXing, //'联系人类型',
|
|
|
columns: 3,
|
|
|
items: [{
|
|
|
boxLabel: Zi.LAN.ISOPERATOR, //'操作',
|
|
|
inputValue: true,
|
|
|
name: 'ISOPERATOR',
|
|
|
id: 'ISOPERATOR'
|
|
|
}, {
|
|
|
boxLabel: Zi.LAN.ISSALEMAN, //'销售',
|
|
|
inputValue: true,
|
|
|
name: 'ISSALEMAN',
|
|
|
id: 'ISSALEMAN'
|
|
|
}, {
|
|
|
boxLabel: Zi.LAN.ISFINANCIALSTAFF, //'财务',
|
|
|
inputValue: true,
|
|
|
name: 'ISFINANCIALSTAFF',
|
|
|
id: 'ISFINANCIALSTAFF'
|
|
|
}, {
|
|
|
boxLabel: Zi.LAN.ISINSURANCE, //'其他',
|
|
|
inputValue: true,
|
|
|
name: 'ISINSURANCE',
|
|
|
id: 'ISINSURANCE'
|
|
|
}, {
|
|
|
boxLabel: Zi.LAN.ISOTHER, //'其他',
|
|
|
inputValue: true,
|
|
|
name: 'ISOTHER',
|
|
|
id: 'ISOTHER'
|
|
|
}, {
|
|
|
boxLabel: Zi.LAN.ISDUI, //'其他',
|
|
|
inputValue: true,
|
|
|
name: 'ISDUI',
|
|
|
id: 'ISDUI'
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
|
|
|
//编辑form
|
|
|
this.formEdit = Ext.widget('form', {
|
|
|
region: 'north',
|
|
|
frame: true,
|
|
|
bodyPadding: 5,
|
|
|
autoScroll: true,
|
|
|
fieldDefaults: {
|
|
|
margins: '2 2 2 2',
|
|
|
labelAlign: 'right',
|
|
|
flex: 1,
|
|
|
labelWidth: 70,
|
|
|
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.GID, //'GID',
|
|
|
name: 'GID', flex: 0, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.LINKID, //'LINKID',
|
|
|
name: 'LINKID', flex: 0, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.CREATEUSER, //'LINKID',
|
|
|
name: 'CREATEUSER', flex: 0, hidden: true, margins: '0'
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.SHOWNAME, //'联系人',
|
|
|
flex:0.5,
|
|
|
name: 'SHOWNAME'
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.JOB, //'联系人',
|
|
|
labelWidth: 40,
|
|
|
flex: 0.5,
|
|
|
name: 'JOB'
|
|
|
}, this.myCheckboxService
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: Zi.LAN.ANNIVERSARY1, //'联系电话',
|
|
|
format: 'Y-m-d',
|
|
|
flex: 1,
|
|
|
xtype: 'datefield',
|
|
|
name: 'ANNIVERSARY1'
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.AREMARK1, //'联系电话',
|
|
|
name: 'AREMARK1'
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.ANNIVERSARY2, //'手机',
|
|
|
format: 'Y-m-d',
|
|
|
flex: 1,
|
|
|
xtype: 'datefield',
|
|
|
name: 'ANNIVERSARY2'
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.AREMARK2, //'手机',
|
|
|
name: 'AREMARK2'
|
|
|
}
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: Zi.LAN.TEL, //'联系电话',
|
|
|
name: 'TEL'
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.MOBILE, //'手机',
|
|
|
name: 'MOBILE'
|
|
|
}
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: Zi.LAN.FAX, //'传真',
|
|
|
name: 'FAX'
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.QQ, //'QQ',
|
|
|
name: 'QQ'
|
|
|
}]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: Zi.LAN.EMAIL, //'邮箱',
|
|
|
name: 'EMAIL'
|
|
|
}]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: Zi.LAN.ADDR, //'地址',
|
|
|
name: 'ADDR'
|
|
|
}
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: Zi.LAN.LOGINNAME, //'联系电话',
|
|
|
name: 'LOGINNAME'
|
|
|
}, {
|
|
|
fieldLabel: Zi.LAN.LOGINPASSWORD, //'手机',
|
|
|
name: 'LOGINPASSWORD'
|
|
|
}
|
|
|
]
|
|
|
}, {
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
xtype: 'textareafield',
|
|
|
grow: true,
|
|
|
fieldLabel: Zi.LAN.REMARK, //'备 注',
|
|
|
height: 60,
|
|
|
name: 'REMARK',
|
|
|
anchor: '100%'
|
|
|
}]
|
|
|
}
|
|
|
]//end items(fieldset 1)
|
|
|
}//end fieldset 1
|
|
|
|
|
|
, {//fieldset 1
|
|
|
xtype: 'fieldset',
|
|
|
defaultType: 'textfield',
|
|
|
layout: 'anchor',
|
|
|
defaults: {
|
|
|
anchor: '100%'
|
|
|
},
|
|
|
items: [{
|
|
|
xtype: 'container',
|
|
|
layout: 'hbox',
|
|
|
defaultType: 'textfield',
|
|
|
items: [{
|
|
|
fieldLabel: Zi.LAN.PICURL, //'签名图片',
|
|
|
id: "PICURL",
|
|
|
readOnly: true,
|
|
|
name: 'PICURL'
|
|
|
}, {
|
|
|
xtype: 'button',
|
|
|
width: 90,
|
|
|
text: Zi.LAN.onUpLoadFileClick, //'上传附件',
|
|
|
tooltip: Zi.LAN.onUpLoadFileClick, //'上传附件',
|
|
|
iconCls: "btnupload",
|
|
|
handler: function (button, event) {
|
|
|
this.onUpLoadFileClick(button, event);
|
|
|
},
|
|
|
scope: this
|
|
|
}
|
|
|
, { xtype: 'hiddenfield', flex: 1 }
|
|
|
]
|
|
|
}
|
|
|
]//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
|
|
|
this.panelPic = new Ext.Panel({
|
|
|
id: "panelPic",
|
|
|
layout: "border",
|
|
|
region: "center",
|
|
|
autoScroll: true,
|
|
|
frame: false,
|
|
|
html: ' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src=""> </iframe>'
|
|
|
//../../UploadFiles/MsDriver/ADMIN201603031507236762s.jpg
|
|
|
});
|
|
|
|
|
|
//#endregion
|
|
|
|
|
|
this.panelCenter = new Ext.Panel({
|
|
|
id: "panelCenter",
|
|
|
layout: "border",
|
|
|
region: "center",
|
|
|
autoScroll: true,
|
|
|
items: [this.formEdit, this.panelPic]
|
|
|
});
|
|
|
|
|
|
//#region 布局
|
|
|
//控件布局
|
|
|
|
|
|
|
|
|
Ext.apply(this, {
|
|
|
items: [this.panelBtn, this.panelCenter]
|
|
|
});
|
|
|
|
|
|
//#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 = " 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: Zi.LAN.ZhengZaiChaXunShuJu, //'正在查询主表数据...',
|
|
|
url: '/MvcShipping/MsInfoClient/GetContactData',
|
|
|
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('LINKID').setValue(this.MainEditRecord.GID);
|
|
|
}
|
|
|
|
|
|
var PICURL = Ext.getCmp("PICURL").getValue();
|
|
|
|
|
|
Ext.getCmp('panelPic').body.update(' <iframe scrolling="auto" frameborder="0" width="100%" height="100%" src="' + PICURL + '"> </iframe>');
|
|
|
|
|
|
} 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;
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
basicForm.findField('GID').setDisabled(false);
|
|
|
var data = basicForm.getValues();
|
|
|
basicForm.findField('GID').setDisabled(true);
|
|
|
if (this.opStatus == 'add') {
|
|
|
data.GID = NewGuid();
|
|
|
}
|
|
|
var login = basicForm.findField('LOGINNAME').getValue();
|
|
|
if (login != '') {
|
|
|
var MOBILE = basicForm.findField('MOBILE').getValue();
|
|
|
var EMAIL = basicForm.findField('EMAIL').getValue();
|
|
|
if (MOBILE == '' || EMAIL == '') {
|
|
|
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: '设置为网络用户,手机号和邮箱不能为空!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });//'客户简称不能为空!'
|
|
|
return;
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
Ext.Msg.wait(Zi.LAN.ZhengZaiCaoZuoShuJu);
|
|
|
Ext.Ajax.request({
|
|
|
waitMsg: Zi.LAN.ZhengZaiCaoZuoShuJu, //'正在保存数据...',
|
|
|
url: '/MvcShipping/MsInfoClient/SaveContact',
|
|
|
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('MsInfoClientContactModel', 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: 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
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
, onUpLoadFileClick: function (button, event) {
|
|
|
var GID = this.editRecord.get('GID');
|
|
|
var SHOWNAME = this.editRecord.get('SHOWNAME');
|
|
|
if (GID == "") {
|
|
|
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.QingXianBaoCunXinXi, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
me = this;
|
|
|
|
|
|
var imgform = new Ext.FormPanel({
|
|
|
region: 'center',
|
|
|
labelWidth: 40,
|
|
|
frame: true,
|
|
|
bodyStyle: 'padding:5px 5px 0',
|
|
|
autoScroll: true,
|
|
|
border: false,
|
|
|
fileUpload: true,
|
|
|
items: [{
|
|
|
xtype: 'fileuploadfield',
|
|
|
id: 'LoadImage',
|
|
|
name: 'LoadImage',
|
|
|
emptyText: Zi.LAN.LoadImage, //'选择图片',
|
|
|
fieldLabel: Zi.LAN.LoadImage, //'选择图片',
|
|
|
buttonText: Zi.LAN.LoadImage, //'选择文件',
|
|
|
allowBlank: false,
|
|
|
buttonCfg:
|
|
|
{
|
|
|
iconCls: 'uploaddialog'
|
|
|
},
|
|
|
anchor: '98%'
|
|
|
}],
|
|
|
buttons: [{
|
|
|
text: Zi.LAN.submit, //'上传',
|
|
|
type: 'submit',
|
|
|
handler: function () {
|
|
|
var UserFilePath = Ext.getCmp('LoadImage').getValue();
|
|
|
if (!CheckFileExt(UserFilePath, /.jpg|.gif|.png|.bmp|.pdf/i)) {
|
|
|
Ext.Msg.show({ title: Zi.LAN.CuoWu, msg: Zi.LAN.QingQueRenNiShangChuanDeWenJianWeiTuPianWenJian, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
return;
|
|
|
}
|
|
|
if (!imgform.form.isValid()) { return; }
|
|
|
imgform.form.submit({
|
|
|
url: '/MvcShipping/MsInfoClient/UploadFile',
|
|
|
waitMsg: Zi.LAN.ZhengZaiShangChuan, //'正在上传',
|
|
|
method: 'POST',
|
|
|
submitEmptyText: false,
|
|
|
async: false,
|
|
|
params: {
|
|
|
ContactGID: GID,
|
|
|
SHOWNAME: SHOWNAME,
|
|
|
OLDURL: Ext.getCmp("PICURL").getValue()
|
|
|
},
|
|
|
success: function (form, action) {
|
|
|
win.close(this);
|
|
|
|
|
|
Ext.Msg.show({ title: Zi.LAN.TiShi, msg: Zi.LAN.CaoZuoChengGong, icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
|
|
|
|
|
|
var condition = me.editRecord.get('ContractNo');
|
|
|
var condition2 = " BSNO='" + condition + "' ";
|
|
|
me.Loading = true;
|
|
|
me.storeDocList.load({
|
|
|
params: { condition: condition2 },
|
|
|
waitMsg: Zi.LAN.ZhengZaiChaXunShuJu,
|
|
|
scope: this,
|
|
|
callback: function () {
|
|
|
me.Loading = false;
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
failure: function (form, action) {
|
|
|
form.reset();
|
|
|
if (action.failureType == Ext.form.Action.SERVER_INVALID)
|
|
|
Ext.MessageBox.alert(Zi.LAN.JingGao, action.result.errors.msg);
|
|
|
}
|
|
|
|
|
|
|
|
|
});
|
|
|
}
|
|
|
}, {
|
|
|
text: Zi.LAN.btnClose, //'关闭',
|
|
|
type: 'submit',
|
|
|
handler: function () {
|
|
|
win.close(this);
|
|
|
}
|
|
|
}]
|
|
|
});
|
|
|
|
|
|
var win = new Ext.Window({
|
|
|
title: Zi.LAN.ShangChuanTuPian, //"上传图片",
|
|
|
width: 360,
|
|
|
height: 120,
|
|
|
modal: true,
|
|
|
resizable: false,
|
|
|
border: false,
|
|
|
items: imgform
|
|
|
|
|
|
});
|
|
|
win.show();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|