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', //layout: 'hbox', defaults: { anchor: '100%' }, id: "formEdit", frame: true, width:340, 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: [{ fieldLabel: 'GID', name: 'GID', hidden: true, flex: 1 }, { fieldLabel: Zi.LAN.SHOWNAME, name: 'SHOWNAME', readOnly: true, flex: 1 }//, { xtype: 'hiddenfield', flex: 3 } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.USERNAME, name: 'USERNAME', flex: 1 }//, { xtype: 'hiddenfield', flex: 3 } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.OLDPASSWORD, name: 'OLDPASSWORD', flex: 1 , inputType: 'password' }//, { xtype: 'hiddenfield', flex: 3 } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.PASSWORD, name: 'PASSWORD', flex: 1 , inputType: 'password' }//, { xtype: 'hiddenfield', flex: 3 } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.PASSWORD2, name: 'PASSWORD2', flex: 1 , inputType: 'password' }//, { xtype: 'hiddenfield', flex: 3 } ] } ]//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 }, { fieldLabel: Zi.LAN.OFFICEPHONE, name: 'OFFICEPHONE', flex: 1 }, { fieldLabel: Zi.LAN.HOMEPHONE, name: 'HOMEPHONE', flex: 1 }, { xtype: 'hiddenfield', flex: 2 } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [{ fieldLabel: Zi.LAN.MOBILE , name: 'MOBILE', flex: 1 }, { fieldLabel: Zi.LAN.FAX, name: 'FAX', flex: 1 }, { xtype: 'hiddenfield', flex: 2 } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [,{ fieldLabel: Zi.LAN.EMAIL1, name: 'EMAIL1', flex: 1 }, { xtype: 'hiddenfield', flex: 1 } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', items: [, { fieldLabel: Zi.LAN.EMAIL2, 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: [{ fieldLabel: Zi.LAN.HOMEADDRESS, 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', //layout: 'hbox', defaults: { anchor: '100%' }, 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', hidden: true, defaultType: 'textfield', items: [ { fieldLabel: Zi.LAN.DJY_CODENAME, name: 'DJY_CODENAME', flex: 1 } ] }, { xtype: 'container', layout: 'hbox', hidden: true, defaultType: 'textfield', items: [ { fieldLabel: Zi.LAN.DJY_PASSWORD, name: 'DJY_PASSWORD', flex: 1 } ] }, { xtype: 'container', layout: 'hbox', hidden: true, defaultType: 'textfield', items: [ { fieldLabel: Zi.LAN.DJY_PASSWORD2, name: 'DJY_PASSWORD2', flex: 1 } ] }, { fieldLabel: Zi.LAN.DJY_UID, name: 'DJY_UID', flex: 1 }, { xtype: 'container', layout: 'hbox', hidden: true, defaultType: 'textfield', items: [ //{ //fieldLabel: 'GID', //name: 'GID', //hidden: true, //flex: 1 //}, { fieldLabel: Zi.LAN.MobileCode, name: 'MobileCode', flex: 1 }//, { xtype: 'hiddenfield', flex: 3 } ] }, { xtype: 'container', layout: 'hbox', defaultType: 'textfield', hidden:true, items: [ { text: Zi.LAN.btnGetCode, xtype:"button", id:"btnGetCode", iconCls: "btnsave", handler: function (button, event) { //this.Save('0'); this.GetMobileCode(); }, scope: this }, { 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 //#endregion //#region 按钮Toolbar this.panelBtn = new Ext.Panel({ region: "north", tbar: [ { text: Zi.LAN.btnsave, iconCls: "btnsave", handler: function (button, event) { this.Save('0'); }, scope: this }, { text: Zi.LAN.Save, handler: function (button, event) { this.Save('1'); }, scope: this }, { xtype:"label", text: Zi.LAN.zhuyi, scope: this } ] }); //end 按钮Toolbar //#endregion //#region 布局 //控件布局 this.panel2 = new Ext.Panel({ layout: 'hbox', //region: "center", items: [ this.formEdit , this.formDJYReg ] }); this.panelTop = new Ext.Panel({ layout: "border", region: "north", height: 200, width: 600, items: [this.panelBtn, this.panel2] }); 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 = ""; this.formEdit.getForm().reset(); this.formEdit.getForm().setValues(data); var OLDPASSWORDfield = this.formEdit.getForm().findField('OLDPASSWORD'); this.formDJYReg.getForm().reset(); this.formDJYReg.getForm().setValues(data); OLDPASSWORDfield.setValue(""); } 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 == "")) { alert(Zi.LAN.MMBWK); return; } if (data.PASSWORD != "" || data.PASSWORD2 != "") { if (data.PASSWORD != data.PASSWORD2) { alert(Zi.LAN.BUXIANGTONG); return; } } var bodydatas = []; var bodyDel = []; var member = Ext.create('USERmb', ""); member.data = BodyForm.getValues(); bodydatas.push(member); var DjyRegForm = this.formDJYReg.getForm(); var djydata = DjyRegForm.getValues(); data.DJY_UID = djydata.DJY_UID; 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(); 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) { } 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 }); } } }); } });