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.
DS7/DSWeb/Areas/MvcShipping/Viewsjs/MsCompanysBX/MsCompanysBXEdit.js

295 lines
9.9 KiB
JavaScript

3 years ago
Ext.namespace('Shipping');
Shipping.MsCompanysBXEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.Shipping.MsCompanysBXEdit.superclass.constructor.call(this);
};
Ext.extend(Shipping.MsCompanysBXEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
editRecord: null,
Editdata: null,
initUIComponents: function () {
//权限范围
this.formHead = Ext.widget('form', {
region: 'north',
frame: true,
fieldDefaults: {
labelAlign: 'right',
flex: 1,
labelWidth: 80,
msgTarget: 'qtip'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '公司ID',
name: 'GID',
hidden: true
},{
id: 'data',
hidden: true,
name: 'data'
},
{
xtype: 'fileuploadfield',
id: 'YingYeZhiZhao',
name: 'YingYeZhiZhao',
emptyText: '请选择图片',
fieldLabel: '公司营业执照',
buttonText: '选择文件',
buttonCfg: { iconCls: 'uploaddialog' },
labelWidth:120
}, {
xtype: "button",
text: "预览",
handler: function () {
}
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '联系人',
name: 'LianXiRen',
labelWidth: 120
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'QQ',
name: 'QQ',
labelWidth: 120
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '邮箱',
name: 'EMAIL',
labelWidth: 120
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: '公司地址',
name: 'ADDRESS',
labelWidth: 120
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
xtype: 'fileuploadfield',
id: 'PINTTAISHIYONGXIEYI',
name: 'PINTTAISHIYONGXIEYI',
emptyText: '请选择图片',
fieldLabel: '平台使用协议',
buttonText: '选择文件',
buttonCfg: { iconCls: 'uploaddialog' },
labelWidth: 120
}, {
xtype: "button",
text: "预览",
handler: function () {
}
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
xtype: 'fileuploadfield',
id: 'BAOXIANJINGJIWEITUOSHU',
name: 'BAOXIANJINGJIWEITUOSHU',
emptyText: '请选择图片',
fieldLabel: '保险经纪委托书',
buttonText: '选择文件',
buttonCfg: { iconCls: 'uploaddialog' },
labelWidth: 120
}, {
xtype: "button",
text: "预览",
handler: function () {
}
}]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
xtype: 'fileuploadfield',
id: 'BAOXIANJINGJIHEZUOXIEYI',
name: 'BAOXIANJINGJIHEZUOXIEYI',
emptyText: '请选择图片',
fieldLabel: '保险经纪合作协议',
buttonText: '选择文件',
buttonCfg: { iconCls: 'uploaddialog' },
labelWidth: 120
}, {
xtype: "button",
text: "预览",
handler: function () {
}
}]
}]
});
//按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [{
id: 'btnESave',
text: "保存",
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
}, {
id: 'btnESaveAndClose',
text: "保存并关闭",
handler: function (button, event) {
this.Save('1');
},
scope: this
}, {
text: "关闭",
handler: function (button, event) {
window.close();
},
scope: this
}]
}); //end 按钮Toolbar
this.panelCompanys = new Ext.Panel({
title: '保险信息',
id: 'pnlmodCompanysInfo',
layout: "border",
region: 'center',
animate: true,
autoScroll: true,
frame: false,
items: [this.panelBtn, this.formHead]
});
//this.tabCompanysPanel = new Ext.TabPanel({
// activeTab: 0,
// autoWidth: true,
// border: true,
// frame: false,
// region: 'center',
// id: "tabCompanysPanel",
// enableTabScroll: true,
// items: [this.panelCompanys]
//});
Ext.apply(this, {
//items: [this.tabtree, this.tabCompanysPanel]
items: [this.panelCompanys]
});
parentWin = window.parent.opener;
this.InitData();
}, //end initUIComponents
InitData: function () {
this.opStatus = 'add';
var condition = '';
_this = this;
if (parentWin) {
var ret = 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.bodyDel = [];
this.opStatus = opstatus;
if (this.opStatus == 'add') {
var basicForm = this.formHead.getForm();
basicForm.reset();
basicForm.findField('GID').setDisabled(false);
basicForm.findField('GID').setValue("*");
basicForm.findField('GID').setDisabled(true);
}
else {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/MvcShipping/MsCompanysBX/GetData',
params: {
},
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, buttons: Ext.Msg.OK });
return;
}
data = result.data;
this.formHead.getForm().reset();
this.formHead.getForm().setValues(data);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}
}, // end LoadDate
Save: function (type) {
var _this = this;
var data = this.formHead.getForm().getValues();
var datastr = Ext.JSON.encode(data);
this.formHead.getForm().findField('data').setValue(datastr);
var basicForm = this.formHead.getForm();
if (!basicForm.isValid()) {
return;
}
var frm = this.formHead.getForm();
frm.submit({
waitMsg: '正在提交数据',
waitTitle: '提示',
url: '/MvcShipping/MsCompanysBX/Save',
method: 'POST',
success: function (form, action) {
Ext.Msg.alert('提示', '保存成功');
var jsonresult = Ext.JSON.decode(action.response.responseText);
var data = jsonresult.Data;
},
failure: function (form, action) {
Ext.Msg.alert('提示', '保存出错');
}
});
} //end save
});