87,996
社区成员




var window_add_duty = new Ext.Window({
title : '添加职务',
width : 340,
height : 250,
closeAction : 'hide',
autoHeight : true,
modal : true,
resizable : false,
bodyStyle : 'padding:5px 5px 0 0',
items : [new Ext.form.FormPanel({
url : 'duty/addDuty.action',
defaultType : 'textfield',
layout : 'form',
defaults : {
widht : 233,
msgTarget : 'side'
},
border : false,
baseCls : 'x-plain',
anchor : '100%',
labelWidth : 60,
labelAlign : 'right',
items : [{
fieldLabel : '职务名称',
id : 'duty_name',
name : 'duty_name',
allowBlank : false,
maxLength : 20,
width : '233'
}, {
fieldLabel : '备注',
xtype : 'textarea',
name : 'duty_remark',
maxLenght : 100,
width : 233
}],
buttonAlign : 'right',
minButtonWidth : 60,
buttons : [{
text : '添加',
handler : function(btn) {
var frm = this.ownerCt.form;
if (frm.isValid()) {
btn.disable();
var cnfield = frm.findField('duty_name');
frm.submit({
waitTitle : '请稍后...',
waitMsg : '正在提交表单数据,请稍后...',
success : function(form, action) {
var store = grid_duty.getStore();
var duty = new Duty({
dutyId : action.result.dutyId,
dutyName : cnfield.getValue(),
remark : form.findField('duty_remark')
.getValue()
});
store.insert(0, [duty]);
window_add_duty.setTitle('[' + frm.getValue()
+ ']添加成功!!');
cnfield.reset();
btn.enable();
},
failure : function() {
Ext.Msg.show({
title : ' 错误提示',
msg : '"' + cnfield.getValue() + '"'
+ '已经存在',
buttons : Ext.Msg.OK,
fn : function() {
cnfield.focus(true);
btn.enable();
},
icon : Ext.Msg.ERROR
});
}
});
}
}
}, {
text : '重置',
handler : function() {
this.ownerCt.form.reset();
}
}, {
text : '取消',
handler : function() {
this.ownerCt.ownerCt.hide();
}
}]
})]
});
success : function(form, action) {
var store = grid_duty.getStore();
var duty = new Duty({
dutyId : action.result.dutyId,
dutyName : cnfield.getValue(),
remark : form.findField('duty_remark').getValue()
});
store.insert(0, [duty]);
window_add_duty.setTitle('[' + frm.getValue()+ ']添加成功!!');
cnfield.reset();
btn.enable();
},