| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- Ext.define('erp.view.core.window.PwdWindow', {
- extend: 'Ext.window.Window',
- alias: 'widget.pwdwindow',
- width: 440,
- height: 260,
- frame: true,
- modal: true,
- bodyStyle: 'background: #E0EEEE;',
- layout: 'anchor',
- title: '修改密码',
- initComponent: function() {
- this.title = '<div style="height:25;padding-top:5px;color:blue;font-size:14px;background: #E0EEEE url(' +
- basePath + 'resource/ext/resources/themes/images/default/grid/grid-blue-hd.gif) repeat center center"> ' + this.title + '</div>';
- this.callParent(arguments);
- this.show();
- },
- items: [{
- xtype: 'form',
- anchor: '100% 100%',
- bodyStyle: 'background: #E0EEEE;',
- url: basePath + 'hr/employee/updatePwd.action',
- padding: '10 10 20 10',
- defaults: {
- margin: '10 10 10 20'
- },
- items: [{
- xtype: 'displayfield',
- fieldLabel: '账号',
- value: em_name
- },{
- xtype: 'textfield',
- name: 'em_oldpassword',
- fieldLabel: '原密码',
- allowBlank : false,
- inputType: 'password'
- },{
- xtype: 'textfield',
- name: 'em_newpassword',
- id: 'em_newpassword',
- fieldLabel: '新密码',
- inputType: 'password',
- allowBlank : false,
- blankText : '密码不能为空',
- regex : /^[\s\S]{0,20}$/,
- regexText : '密码长度不能超过20个字符'
- },{
- xtype: 'textfield',
- name: 'em_reput',
- id: 'em_reput',
- fieldLabel: '新密码确认',
- inputType: 'password',
- allowBlank : false,
- vtype : 'confirmPwd',
- confirmPwd : {
- first : 'em_newpassword',
- second : 'em_reput'
- },
- blankText : '确认密码不能为空',
- regex : /^[\s\S]{0,20}$/,
- regexText : '确认密码长度不能超过20个字符'
- },{
- xtype: 'checkbox',
- boxLabel: '同时修改到其它帐套',
- name: 'sync',
- checked: true
- }],
- buttonAlign: 'center',
- buttons: [{
- text: '确认',
- cls: 'x-btn-blue',
- handler: function(btn) {
- var win = btn.up('window');
- win.updatePwd();
- }
- },{
- text: '关闭',
- cls: 'x-btn-blue',
- handler: function(btn) {
- var win = btn.up('window');
- win.close();
- }
- }]
- }],
- updatePwd: function() {
- var win = this;
- var form = win.down('form').getForm();
- if (form.isValid()) {
- form.submit({
- success: function(form, action) {
- Ext.Msg.alert('修改成功!', '请牢记您的新密码:' + win.down('#em_newpassword').value);
- win.close();
- },
- failure: function(form, action) {
- Ext.Msg.alert('修改失败!', action.result.result);
- }
- });
- }
- }
- });
- Ext.apply(Ext.form.VTypes, {
- confirmPwd : function(val, field) {
- if (field.confirmPwd) {
- var firstPwdId = field.confirmPwd.first;
- var secondPwdId = field.confirmPwd.second;
- this.firstField = Ext.getCmp(firstPwdId);
- this.secondField = Ext.getCmp(secondPwdId);
- var firstPwd = this.firstField.getValue();
- var secondPwd = this.secondField.getValue();
- if (firstPwd == secondPwd) {
- return true;
- } else {
- return false;
- }
- }
- },
- confirmPwdText : '两次输入的密码不一致!'
- });
|