温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:酒店管理系统(ExtJs)源码
当前文件:
MyHotelManager/HotelUI/Js/DelUser.js,打开代码结构图
MyHotelManager/HotelUI/Js/DelUser.js,打开代码结构图1//删除普通员工 2
function DelUser() 3
{ 4
//获得所有的用户名(当前登陆除外) 5
var strLoginName=new Ext.data.Store 6
( 7
{ 8
proxy: new Ext.data.HttpProxy 9
( 10
{ 11
url:'/HotelUI/Json/GetUser.aspx' 12
} 13
), 14
//读取Json 15
reader: new Ext.data.JsonReader 16
( 17
{root:'data'}, 18
[ 19
{name:'UserId',type:'string'}, 20
{name:'LoginName',type:'string'} 21
] 22
) 23
} 24
); 25
strLoginName.load(); 26
27
28
Ext.QuickTips.init(); 29
Ext.form.Field.prototype.msgTarget = 'side'; 30
var delUser = new Ext.FormPanel 31
( 32
{ 33
labelWidth : 75, 34
frame : true, 35
title : '请仔细填写表单', 36
width : 300, 37
waitMsgTarget : true, 38
items: 39
[ 40
new Ext.form.ComboBox 41
( 42
{ 43
fieldLabel: ' 请选择员工', 44
labelStyle: 'width:100px', 45
width:150, 46
editable: false, //不允许输入 47
name: 'LoginName', 48
store:strLoginName, 49
emptyText:'请选择', 50
allowBlank:false, //不允许为空 51
blankText:'请选择员工', //错误提示信息 52
displayField:'LoginName', 53
valueField: 'UserId', 54
hiddenName:'LoginName', //提交到后台的input的name 55
mode: 'client', //数据是在本地 56
triggerAction: 'all', 57
selectOnFocus:true 58
} 59
) 60
], 61
buttons: 62
[ 63
{ 64
id:'btnOk', 65
text:'确 定', 66
handler:function() 67
{ 68
//如果验证合法 69
if (delUser.form.isValid()) 70
{ 71
//弹出效果 72
Ext.MessageBox.show 73
( 74
{ 75
msg: '正在删除,请稍等...', 76
progressText: 'Saving...', 77
width:300, 78
wait:true, 79
waitConfig: {interval:200}, 80
icon:'download', 81
animEl: 'saving' 82
} 83
); 84
setTimeout(function(){}, 10000); 85
//提交到服务器 86
delUser.form.submit 87
( 88
{ 89
url:'/HotelUI/Form/DelUser.aspx', //提交的页面路径 90
method:'post', //提交方式为post 91
//提交成功的回调函数 92
success:function(form,action) 93
{ 94
var flage = action.result.success; 95
//如果服务器端传过来的数据为true则表示删除成功 96
if (flage == true) 97
{ 98
Ext.MessageBox.alert('恭喜','删除员工成功!'); 99
newWin.hide(); 100
} 101
}, 102
//提交失败的回调函数 103
failure:function() 104
{ 105
Ext.MessageBox.alert('错误','服务器出现错误请稍后再试!'); 106
} 107
} 108
); 109
} 110
} 111
//disabled:false 112
}, 113
{ 114
text:'取 消', 115
handler:function() 116
{ 117
newWin.hide(); 118
} 119
} 120
] 121
} 122
); 123
//定义窗体 124
newWin = new Ext.Window 125
( 126
{ 127
layout : 'fit', 128
width : 320, 129
height : 150, 130
collapsible:true, //允许缩放条 131
closeAction : 'hide', 132
closable:true, 133
plain : true, 134
modal: 'true', 135
title : '删除普通员工', 136
items : delUser 137
} 138
); 139
newWin.show(); 140
} 141
142





}
}