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.
437 lines
15 KiB
JavaScript
437 lines
15 KiB
JavaScript
Ext.namespace('Shipping');
|
|
|
|
Shipping.MsCodeFtpSetEdit = function (config) {
|
|
Ext.applyIf(this, config);
|
|
this.initUIComponents();
|
|
window.Shipping.MsCodeFtpSetEdit.superclass.constructor.call(this);
|
|
};
|
|
|
|
Ext.extend(Shipping.MsCodeFtpSetEdit, Ext.Panel, {
|
|
|
|
ParentWin: null,
|
|
OpStatus: 'add',
|
|
StoreList: null,
|
|
EditRecord: null,
|
|
|
|
initUIComponents: function () {
|
|
this.serialNo = 0;
|
|
this.workSerialNo = 0;
|
|
this.bodyDel = [];
|
|
|
|
//#region 编辑form
|
|
|
|
//枚举参照相关(编辑form)
|
|
|
|
this.storeEdiType = Ext.create('DsExt.ux.RefEnumStore', {});
|
|
this.storeEdiType.load({ params: { enumTypeId: 97012} });
|
|
|
|
this.comboxEdiType = Ext.create('DsExt.ux.RefTableCombox', {
|
|
fieldLabel: 'EDI名称',
|
|
store: this.storeEdiType,
|
|
forceSelection: true,
|
|
name: 'EDINAME',
|
|
valueField: 'EnumValueId',
|
|
displayField: 'EnumValueName'
|
|
});
|
|
|
|
this.StoreISUSETEL = Ext.create('Ext.data.Store', {
|
|
fields: ['value', 'text']
|
|
});
|
|
this.StoreISUSETEL.add({ 'value': '1', 'text': '是' });
|
|
this.StoreISUSETEL.add({ 'value': '', 'text': '否' });
|
|
|
|
|
|
this.comboxISUSETEL = Ext.create('DsExt.ux.RefTableCombox', {
|
|
fieldLabel:'启用设置TEL', //'默认FRT',
|
|
store: this.StoreISUSETEL,
|
|
valueField: 'value',
|
|
displayField: 'text',
|
|
forceSelection: true,
|
|
name: 'ISUSETEL'
|
|
});
|
|
|
|
|
|
//表参照相关(编辑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: 'GID',
|
|
name: 'GID', flex: 0, hidden: true, margins: '0'
|
|
}, this.comboxEdiType, {
|
|
fieldLabel: '发送方代码',
|
|
name: 'SENDCODE'
|
|
}, {
|
|
fieldLabel: '发送方名称',
|
|
name: 'SENDNAME'
|
|
}, {
|
|
fieldLabel: '接收方代码',
|
|
name: 'RECEIVECODE'
|
|
}
|
|
]
|
|
}, {
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [{
|
|
fieldLabel: '主机地址',
|
|
name: 'SERVERIP'
|
|
},{
|
|
fieldLabel: '用户名',
|
|
name: 'USERNAME'
|
|
}, {
|
|
fieldLabel: '密码',
|
|
name: 'PASSWORD'
|
|
}, {
|
|
fieldLabel: '上传文件夹',
|
|
name: 'FOLDERNAME'
|
|
}
|
|
]
|
|
}, {
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [{
|
|
fieldLabel: '发送方公司代码',
|
|
name: 'SENDCOMPANYCODE'
|
|
}, {
|
|
fieldLabel: '发送方分部代码',
|
|
name: 'SENDSUBCOMPANYCODE'
|
|
}, {
|
|
fieldLabel: '发送方联系人',
|
|
name: 'SENDATTN'
|
|
}, {
|
|
fieldLabel: '发送方邮箱',
|
|
name: 'SENDEMAIL'
|
|
}
|
|
]
|
|
}, {
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [ {
|
|
fieldLabel: '发送方电话',
|
|
name: 'SENDTEL'
|
|
},{
|
|
fieldLabel: '接收方操作',
|
|
name: 'RECEIVEOP'
|
|
}, {
|
|
fieldLabel: '接收方销售',
|
|
name: 'RECEIVESALE'
|
|
}, {
|
|
fieldLabel: '接收方部门',
|
|
name: 'RECEIVEDEPT'
|
|
}
|
|
]
|
|
}, {
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [{
|
|
fieldLabel: '船公司代码',
|
|
name: 'CARRIERID'
|
|
}, {
|
|
fieldLabel: '接收方邮箱',
|
|
name: 'RECEIVEEMAIL'
|
|
}, {
|
|
fieldLabel: '接收方SI邮箱',
|
|
name: 'RECEIVESIEMAIL'
|
|
}, {
|
|
fieldLabel: '发送方别名',
|
|
name: 'ALIASSENDCODE'
|
|
}
|
|
]
|
|
}, {
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [this.comboxISUSETEL,{
|
|
fieldLabel: '发货人TEL',
|
|
name: 'SHIPPERTEL'
|
|
}, {
|
|
fieldLabel: '收货人TEL',
|
|
name: 'CONSIGNEETEL'
|
|
}, {
|
|
fieldLabel: '通知人TEL',
|
|
name: 'NOTIFYPARTYTEL'
|
|
}
|
|
]
|
|
}, {
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [{
|
|
fieldLabel: '主机地址2',
|
|
name: 'SERVERIP2'
|
|
}, {
|
|
fieldLabel: '用户名2',
|
|
name: 'USERNAME2'
|
|
}, {
|
|
fieldLabel: '密码2',
|
|
name: 'PASSWORD2'
|
|
}, {
|
|
fieldLabel: '上传文件夹2',
|
|
name: 'FOLDERNAME2'
|
|
}
|
|
]
|
|
}, {
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [{
|
|
fieldLabel: 'SFTP端口号',
|
|
name: 'SFTPPORT'
|
|
}, {
|
|
fieldLabel: '是否SFTP', //'是否SOC',
|
|
inputValue: true,
|
|
xtype: 'checkboxfield',
|
|
name: 'ISSSL'
|
|
}, {
|
|
fieldLabel: '临时文件夹',
|
|
name: 'TMPFOLDERNAME'
|
|
}, {
|
|
fieldLabel: 'SFTP认证文件',
|
|
name: 'SFTPCERFILENAME'
|
|
}
|
|
]
|
|
}, {
|
|
xtype: 'container',
|
|
layout: 'hbox',
|
|
defaultType: 'textfield',
|
|
items: [{
|
|
fieldLabel: '发送邮件端口',
|
|
name: 'SENDEMAILPORT'
|
|
}, {
|
|
fieldLabel: '发送邮件是否SSL', //'是否SOC',
|
|
inputValue: true,
|
|
xtype: 'checkboxfield',
|
|
labelWidth: 100,
|
|
name: 'ISSENDEMAILSSL'
|
|
}, {
|
|
fieldLabel: '方送邮件服务器',
|
|
name: 'SENDEMAILSERVER'
|
|
}, {
|
|
fieldLabel: '发送邮件密码',
|
|
name: 'SENDEMAILPASS'
|
|
}
|
|
]
|
|
}
|
|
]//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 布局
|
|
//控件布局
|
|
|
|
|
|
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];
|
|
}
|
|
|
|
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/MsCodeFtpSet/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
|
|
});
|
|
|
|
|
|
|
|
}, // 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/MsCodeFtpSet/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('MsCodeFtpSet', 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
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
|