?? adduserinfo.js
字號:
?// JScript 文件
AddUserInfoFn=function()
{
//------用戶類型
var AddUserRoleFields = Ext.data.Record.create([
{name: 'roleid',mapping:'roleid'},{name: 'rolename',mapping:'rolename'},{name:'roledesc',mapping:'roledesc'}
]);
var AddUserRoleStore = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url:'DATA/RoleInfo/GetRoleInfo.aspx'
}),
reader: new Ext.data.JsonReader({
root: 'data',
id: 'roleid'
},
AddUserRoleFields
)
});
AddUserRoleStore.load();
var AddUserInfoForm=new Ext.form.FormPanel({
width:315,
height:270,
plain:true,
layout:"form",
defaultType:"textfield",
labelWidth:45,
baseCls:"x-plain",
defaults:{anchor:"95%",msgTarget:"side"},
buttonAlign:"center",
bodyStyle:"padding:0 0 0 0",
items:[
{
name:"userid",
fieldLabel:"帳號",
allowBlank:false,
blankText:"帳號不允許為空"
},{
name:"userpwd",
fieldLabel:"密碼",
allowBlank:false,
blankText:"密碼不能為空",
inputType:"password"
},{
name:"userpwd1",
fieldLabel:"確認",
inputType:"password",
allowBlank:false,
blankText:"確認密碼不能為空",
invalidText:'兩次密碼不一致!',
validator:function(){
if(Ext.get('userpwd').dom.value == Ext.get('userpwd1').dom.value)
{
return true;
}else{
return false;
}
}
},{
name:"username",
fieldLabel:"稱謂",
allowBlank:false,
blankText:"稱呼不能為空",
regex:/^[\s\S]{1,10}$/,
regexText:"昵稱請不要超過10個字符"
},{
name:"userstate",
xtype:"combo",
fieldLabel:"狀態",
//傳入后臺真實值value field /value
hiddenName:"userstate",
editable: false,
mode:"local",
displayField:"show",
valueField:"value",
triggerAction:"all",
value:"0",
store:new Ext.data.SimpleStore({
fields:["show","value"],
data:[["正常","0"],["禁用","1"]]
})
},{
xtype:"combo",
tpl: '<tpl for="."><div ext:qtip="{rolename}. {roledesc}" class="x-combo-list-item">{rolename}</div></tpl>',
store: AddUserRoleStore,
typeAhead: true,
fieldLabel:'角色',
hiddenName:'roleid',
name:'roleid',
forceSelection: true,
triggerAction: 'all',
emptyText:'選擇角色類型',
selectOnFocus:true,
width:130,
editable: false,
allowBlank:false,
blankText:'請選擇角色類型',
displayField:'rolename',
valueField: 'roleid',
mode: 'remote'
}
]});
var AddUserInfoWin=new Ext.Window({
title:"添加新用戶",
width:350,
height:260,
plain:true,
layout:"form",
iconCls:"addicon",
//不可以隨意改變大小
resizable:false,
//是否可以拖動
//draggable:false,
defaultType:"textfield",
labelWidth:100,
collapsible:true, //允許縮放條
closeAction : 'hide',
closable:true,
//彈出模態窗體
modal: 'true',
buttonAlign:"center",
bodyStyle:"padding:10px 0 0 15px",
items:[AddUserInfoForm],
listeners:{
"show":function()
{
AddUserInfoForm.getForm().reset();
}
},
buttons:[{
text:"保存信息",
minWidth:70,
handler:function()
{
if(AddUserInfoForm.getForm().isValid())
{
//彈出效果
Ext.MessageBox.show
(
{
msg: '正在保存,請稍等...',
progressText: 'Saving...',
width:300,
wait:true,
waitConfig: {interval:200},
icon:'download',
animEl: 'saving'
}
);
setTimeout(function(){}, 1000);
AddUserInfoForm.form.submit({
url:"URL/UserInfo/AddUserInfo.aspx",
method:"POST",
success:function(form,action)
{
//成功后
var flag=action.result.success;
if(flag=="true")
{
Ext.MessageBox.alert("恭喜","添加新用戶成功!");
UserInfoStore.reload();
AddUserInfoWin.hide();
}
},
failure:function(form,action)
{
Ext.MessageBox.alert("提示!","添加新用戶失敗!");
}
});
}
}
},{
text:"重置",
minWidth:70,
qtip:"重置數據",
handler:function()
{
AddUserInfoForm.getForm().reset();
}
},{
text:"取 消",
minWidth:70,
handler:function()
{
AddUserInfoWin.hide();
}
}]
});
AddUserInfoWin.show();
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -