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/SysMng/ViewJs/USERINFO/USERINFOEdit.js

636 lines
21 KiB
JavaScript

2 years ago
Ext.namespace('DsTruck');
DsTruck.USERINFOEdit = function (config) {
Ext.applyIf(this, config);
this.initUIComponents();
window.DsTruck.USERINFOEdit.superclass.constructor.call(this);
};
Ext.extend(DsTruck.USERINFOEdit, Ext.Panel, {
ParentWin: null,
OpStatus: 'add',
StoreList: null,
EditRecord: null,
initUIComponents: function () {
this.serialNo = 0;
this.bodyDel = [];
//#region 编辑form
//枚举参照相关(编辑form)
//表参照相关(编辑form)
//编辑form
this.formEdit = Ext.widget('form', {
// layout: "border",
//region: 'west',
id: "formEdit",
2 years ago
frame: true,
width:340,
bodyPadding: 1,
2 years ago
trackResetOnLoad: true,
fieldDefaults: {
margins: '1 1 1 1',
labelAlign: 'right',
flex: 1,
2 years ago
//labelWidth: 90,//label标签宽度
msgTarget: 'qtip',
sourcelabelWidth: '100'
//,split:true
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'GID',
name: 'GID',
hidden: true,
flex: 1
}, {
1 year ago
fieldLabel: Zi.LAN.SHOWNAME,
2 years ago
name: 'SHOWNAME', readOnly: true, flex: 1
}//, { xtype: 'hiddenfield', flex: 3 }
2 years ago
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
1 year ago
fieldLabel: Zi.LAN.USERNAME,
2 years ago
name: 'USERNAME', flex: 1
}//, { xtype: 'hiddenfield', flex: 3 }
2 years ago
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
1 year ago
fieldLabel: Zi.LAN.OLDPASSWORD,
2 years ago
name: 'OLDPASSWORD', flex: 1
, inputType: 'password'
}//, { xtype: 'hiddenfield', flex: 3 }
2 years ago
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
1 year ago
fieldLabel: Zi.LAN.PASSWORD,
2 years ago
name: 'PASSWORD', flex: 1
, inputType: 'password'
}//, { xtype: 'hiddenfield', flex: 3 }
2 years ago
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
1 year ago
fieldLabel: Zi.LAN.PASSWORD2,
2 years ago
name: 'PASSWORD2', flex: 1
, inputType: 'password'
}//, { xtype: 'hiddenfield', flex: 3 }
2 years ago
]
}
]//end items(fieldset 1)
}//end fieldset 1
////////////////////////////////
]//end root items
}); //end this.formEdit
//编辑form
this.formBody = 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',
hidden: true,
flex: 1
}, {
fieldLabel: 'USERID',
name: 'USERID',
hidden: true,
flex: 1
}, {
1 year ago
fieldLabel: Zi.LAN.OFFICEPHONE,
2 years ago
name: 'OFFICEPHONE', flex: 1
}, {
1 year ago
fieldLabel: Zi.LAN.HOMEPHONE,
2 years ago
name: 'HOMEPHONE', flex: 1
}, { xtype: 'hiddenfield', flex: 2 }
]
}, {
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
1 year ago
fieldLabel: Zi.LAN.MOBILE ,
2 years ago
name: 'MOBILE', flex: 1
}, {
1 year ago
fieldLabel: Zi.LAN.FAX,
2 years ago
name: 'FAX', flex: 1
}, { xtype: 'hiddenfield', flex: 2 }
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [,{
1 year ago
fieldLabel: Zi.LAN.EMAIL1,
2 years ago
name: 'EMAIL1', flex: 1
}, { xtype: 'hiddenfield', flex: 1 }
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [, {
1 year ago
fieldLabel: Zi.LAN.EMAIL2,
2 years ago
name: 'EMAIL2', flex: 1
}, { xtype: 'hiddenfield', flex: 1 }
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
fieldLabel: 'QQ',
name: 'QQ', flex: 1
}, { xtype: 'hiddenfield', flex: 1 }
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [{
1 year ago
fieldLabel: Zi.LAN.HOMEADDRESS,
2 years ago
name: 'HOMEADDRESS', flex: 1
}, { xtype: 'hiddenfield', flex: 1 }
]
}
]//end items(fieldset 1)
}//end fieldset 1
////////////////////////////////
]//end root items
}); //end
this.formDJYReg = Ext.widget('form', {
// layout: "border",
//region: 'center',
id: "formDJYReg",
frame: true,
width: 340,
hidden: true,
bodyPadding: 1,
trackResetOnLoad: true,
fieldDefaults: {
margins: '1 1 1 1',
labelAlign: 'right',
flex: 1,
//labelWidth: 90,//label标签宽度
msgTarget: 'qtip',
sourcelabelWidth: '100'
//,split:true
},
items: [
{//fieldset 1
xtype: 'fieldset',
defaultType: 'textfield',
layout: 'anchor',
defaults: {
anchor: '100%'
},
items: [
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
1 year ago
fieldLabel: Zi.LAN.DJY_CODENAME,
name: 'DJY_CODENAME', flex: 1
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
1 year ago
fieldLabel: Zi.LAN.DJY_PASSWORD,
name: 'DJY_PASSWORD', flex: 1
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
1 year ago
fieldLabel: Zi.LAN.DJY_PASSWORD2,
name: 'DJY_PASSWORD2', flex: 1
}
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
//{
//fieldLabel: 'GID',
//name: 'GID',
//hidden: true,
//flex: 1
//},
{
1 year ago
fieldLabel: Zi.LAN.MobileCode,
name: 'MobileCode', flex: 1
}//, { xtype: 'hiddenfield', flex: 3 }
]
},
{
xtype: 'container',
layout: 'hbox',
defaultType: 'textfield',
items: [
{
1 year ago
text: Zi.LAN.btnGetCode,
xtype:"button",
id:"btnGetCode",
iconCls: "btnsave",
handler: function (button, event) {
//this.Save('0');
this.GetMobileCode();
},
scope: this
},
{
1 year ago
text: Zi.LAN.btnDoReg ,
xtype: "button",
id: "btnDoReg",
iconCls: "btnsave",
handler: function (button, event) {
//this.Save('0');
},
scope: this
}
//, { xtype: 'hiddenfield', flex: 3 }
]
},
//{
// xtype: 'container',
// layout: 'hbox',
// defaultType: 'textfield',
// items: [{
// fieldLabel: '旧密码',
// name: 'OLDPASSWORD', flex: 1
// , inputType: 'password'
// }//, { xtype: 'hiddenfield', flex: 3 }
// ]
//},
//{
// xtype: 'container',
// layout: 'hbox',
// defaultType: 'textfield',
// items: [{
// fieldLabel: '新密码',
// name: 'PASSWORD', flex: 1
// , inputType: 'password'
// }//, { xtype: 'hiddenfield', flex: 3 }
// ]
//},
//{
// xtype: 'container',
// layout: 'hbox',
// defaultType: 'textfield',
// items: [{
// fieldLabel: '重复新密码',
// name: 'PASSWORD2', flex: 1
// , inputType: 'password'
// }//, { xtype: 'hiddenfield', flex: 3 }
// ]
//}
]//end items(fieldset 1)
}//end fieldset 1
////////////////////////////////
]//end root items
}); //end
2 years ago
//#endregion
//#region 按钮Toolbar
this.panelBtn = new Ext.Panel({
region: "north",
tbar: [
{
1 year ago
text: Zi.LAN.btnsave,
2 years ago
iconCls: "btnsave",
handler: function (button, event) {
this.Save('0');
},
scope: this
},
{
1 year ago
text: Zi.LAN.Save,
2 years ago
handler: function (button, event) {
this.Save('1');
},
scope: this
},
{
xtype:"label",
1 year ago
text: Zi.LAN.zhuyi,
scope: this
2 years ago
}
]
}); //end 按钮Toolbar
//#endregion
//#region 布局
//控件布局
this.panel2 = new Ext.Panel({
layout: "hbox",
region: "center",
items: [
this.formEdit
//, this.formDJYReg
]
});
2 years ago
this.panelTop = new Ext.Panel({
layout: "border",
region: "north",
height: 200,
width: 600,
items: [this.panelBtn, this.panel2]
2 years ago
});
Ext.apply(this, {
items: [this.panelTop, this.formBody]
});
//#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.LoadData();
}, //end InitData
LoadData: function () {
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/SysMng/USERINFO/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;
data.PASSWORD = "";
data.OLDPASSWORD = "";
2 years ago
this.formEdit.getForm().reset();
this.formEdit.getForm().setValues(data);
var OLDPASSWORDfield = this.formEdit.getForm().findField('OLDPASSWORD');
2 years ago
OLDPASSWORDfield.setValue("");
2 years ago
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
Ext.Ajax.request({
waitMsg: '正在查询主表数据...',
url: '/SysMng/USERINFO/GetUSERINFOData',
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.formBody.getForm().reset();
this.formBody.getForm().setValues(data);
} else {
Ext.MessageBox.alert('请求出现错误,请重试', response.responseText);
}
},
scope: this
});
}, // end LoadDate
Save: function (type) {
var basicForm = this.formEdit.getForm();
var BodyForm = this.formBody.getForm();
if (!basicForm.isValid()) {
return;
}
//判断表格数据是否合法
/*
if (!validateEditorGridPanel(this.gridList)) {
return;
}
if (!this.checkedit()) {
return;
}*/
var data = basicForm.getValues();
if (data.OLDPASSWORD != "" && (data.PASSWORD == "" || data.PASSWORD2 == "")) {
1 year ago
alert(Zi.LAN.MMBWK);
2 years ago
return;
}
if (data.PASSWORD != "" || data.PASSWORD2 != "") {
if (data.PASSWORD != data.PASSWORD2) {
1 year ago
alert(Zi.LAN.BUXIANGTONG);
2 years ago
return;
}
}
var bodydatas = [];
var bodyDel = [];
var member = Ext.create('USERmb', "");
member.data = BodyForm.getValues();
bodydatas.push(member);
var jsonBody = ConvertRecordsToJsonAll(bodydatas);
var jsonDelBody = ConvertRecordsToJsonAll(bodyDel);
Ext.Msg.wait('正在保存数据, 请稍侯..');
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/SysMng/USERINFO/Save',
scope: this,
params: {
opstatus: this.opStatus,
data: Ext.JSON.encode(data),
body: jsonBody,
Delbody: jsonDelBody
},
callback: function (options, success, response) {
if (success) {
Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
} 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
,
GetMobileCode: function () {
//var mobile = this.formBody.getForm().findField('MOBILE').getValue();
2 years ago
Ext.Ajax.request({
waitMsg: '正在保存数据...',
url: '/SysMng/USERINFO/GetMobileCode',
scope: this,
params: {
//mobile: mobile
},
callback: function (options, success, response) {
if (success) {
//Ext.MessageBox.hide();
var jsonresult = Ext.JSON.decode(response.responseText);
if (jsonresult.Success) {
2 years ago
} 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
});
}
}
});
}
2 years ago
});