?? user.js
字號(hào):
//不帶有修改用戶信息的UserJs
//全局設(shè)置
/*--------------------------------------設(shè)定占位符--------------------------------------*/
Ext.BLANK_IMAGE_URL = 'resources/images/default/s.gif';
/*--------------------------------------設(shè)定驗(yàn)證提示--------------------------------------*/
Ext.QuickTips.init();
/*--------------------------------------設(shè)定驗(yàn)證提示樣式--------------------------------------*/
Ext.form.Field.prototype.msgTarget = 'qtip';
var userAdd;
//定義省的數(shù)據(jù)源
var store=new Ext.data.Store({
autoLoad:true,
proxy:new Ext.data.HttpProxy({
url:'city.asp?cmd=cityn&a='+new Date().getTime()+''
}),
reader:new Ext.data.JsonReader({
id:'ID',
fields:['name','code']
}),
remoteSort:true
});
//定義市的數(shù)據(jù)源
var comstore =new Ext.data.Store({
autoLoad:false,
proxy:new Ext.data.HttpProxy({
url:'city.asp?cmd=cityt&a='+new Date().getTime()+'',
method:'post'
}),
reader:new Ext.data.JsonReader({
id:'ID',
fields:['name','code']
}),
remote:true
});
//定義區(qū)的數(shù)據(jù)源數(shù)據(jù)源
var Threestore =new Ext.data.Store({
autoLoad:false,
proxy:new Ext.data.HttpProxy({
url:'city.asp?cmd=citys&a='+new Date().getTime()+'',
method:'post'
}),
reader:new Ext.data.JsonReader({
id:'ID',
fields:['name','code']
}),
remote:true
});
//定義醫(yī)院的數(shù)據(jù)源數(shù)據(jù)
var hospital = new Ext.data.Store({
autoLoad : false,
proxy : new Ext.data.HttpProxy({
url : 'Hospital.asp?cmd=HospList&a='+new Date().getTime()+'',
method : 'post'
}),
reader : new Ext.data.JsonReader({
id : 'ID',
fields : ['name','code']
}),
remote : true
});
var store1="";
var comstore1="";
var Threestore1="";
//用戶注冊(cè)窗口
UserRegWindow = Ext.extend(Ext.Window,{
id:'RegWin',
title : '新用戶注冊(cè)',
width : 500,
iconCls:"icon-AddUser",
modal:true, //啟用遮罩
height : 420,
defaults : { border : false },
buttonAlign : 'center',
createFormPanel :function() { //創(chuàng)建FormPanel
return new Ext.form.FormPanel({
bodyStyle : 'padding-top:6px',
defaultType : 'textfield',
labelAlign : 'right',
labelWidth : 100,
labelPad : 0,
frame : true,
defaults : {
allowBlank : false,
width : 228,
selectOnFocus:true
},
items : [{
xtype:"combo",
name:'UserType',
fieldLabel:'會(huì)員類型',
displayField:'name',
valueField:'code',
store:new Ext.data.SimpleStore({
fields:['name','code'],
data:[["機(jī)構(gòu)",0],["企業(yè)",1],["專家",2],["醫(yī)生",3],["個(gè)人",4],["記者",5]]
}),
triggerAction:'all',
mode:'local',
selectOnFocus:true,
forceSelection: true,
allowBlank:false,
//editable: false,
hiddenName:'UserType',
emptyText:'請(qǐng)選擇會(huì)員類型',
blankText : '請(qǐng)選擇會(huì)員類型',
listeners:{
select:function(combo, record,index){
if(this.value==2 || this.value==3)
{
Ext.getCmp('SButton').show();
}
else
{
Ext.getCmp('SButton').hide();
}
}
}
},
{
xtype:"textfield",
name:'UserName',
id:'UserName',
fieldLabel:'用戶名',
emptyText:'填寫用戶名',
blankText : '用戶名不能為空'
//readOnly:true //設(shè)置input屬性為只讀
},
{
xtype:"textfield",
name : 'RealName',
fieldLabel : '姓名',
emptyText:'填寫真實(shí)姓名',
blankText : '姓名不能為空'
},
new Ext.ux.PasswordMeter({
fieldLabel: '用戶密碼',
name: 'PaddWord',
blankText : '密碼不能為空',
inputType : 'password'
}),
{
xtype:"combo",
name : 'UserAdd',
id:'sheng',
fieldLabel : '選擇省',
displayField:'name',
valueField:'code',
store:store,
triggerAction:'all',
mode:'local',
selectOnFocus:true,
forceSelection: true,
allowBlank:false,
editable: false,
hiddenName:'UserAdd',
emptyText:'請(qǐng)選擇省',
blankText : '請(qǐng)選擇省',
listeners:{
select:function(combo, record,index){
try{
userAdd = record.data.name;
store1 = record.data.name;
var parent=Ext.getCmp('shi');
parent.clearValue();
parent.store.reload({params:{action:this.value}});
}
catch(ex)
{
Ext.MessageBox.alert(ex);
}
}
}
},
{
xtype:"combo",
name : 'shi1',
id : 'shi',
fieldLabel : '選擇市',
displayField:'name',
valueField:'code',
triggerAction:'all',
store:comstore,
mode:'local',
selectOnFocus:true,
forceSelection: true,
allowBlank:false,
editable: false,
hiddenName:'shi1',
emptyText:'請(qǐng)選擇市',
blankText : '請(qǐng)選擇市',
listeners:{
select:function(combo, record,index){
try{
userAdd = userAdd + record.data.name;
comstore1 = record.data.name
var parent=Ext.getCmp('qu');
parent.clearValue();
//alert(record.data.name);
parent.store.reload({params:{action:this.value}});
}
catch(ex)
{
Ext.MessageBox.alert(ex);
}
}
}
},
{
xtype:"combo",
name : 'qu1',
id : 'qu',
fieldLabel : '選擇區(qū)',
displayField:'name',
valueField:'code',
triggerAction:'all',
store:Threestore,
mode:'local',
selectOnFocus:true,
forceSelection: true,
allowBlank:false,
editable: false,
hiddenName:'qu1',
emptyText:'請(qǐng)選擇區(qū)',
blankText : '請(qǐng)選擇區(qū)',
listeners:{
select:function(combo, record,index){
userAdd = userAdd + record.data.name;
Threestore1 = record.data.name;
Ext.getCmp("Usertxdz").setValue(userAdd);
}
}
},
{
xtype:"textfield",
name : 'UserUnits',
id : 'UserUnits',
fieldLabel : '單位',
emptyText:'填寫您的單位名稱',
itemCls:'code-male', //向左邊浮動(dòng),處理控件橫排
clearCls:'allow-float',
blankText : '單位名稱不能為空'
},
new Ext.Button({
id : "SButton",
text:"選擇醫(yī)院",
itemCls:'code-female',
clearCls:'allow-float',
hidden : true,
handler : function(){
var hospitalWin = new Ext.Window({
id:'HWin',
title : '選擇醫(yī)院',
width : 400,
height:180,
modal:true,
createFormPanel:function(){
return new Ext.form.FormPanel({
bodyStyle : 'padding-top:6px',
defaultType : 'textfield',
labelAlign : 'right',
labelWidth : 65,
labelPad : 0,
frame : true,
defaults : {
allowBlank : false,
width : 300,
selectOnFocus:true
},
items : [{
xtype:"combo",
name:'sheng',
id : 'hosp_sheng',
fieldLabel:'請(qǐng)選擇省',
displayField:'name',
valueField:'code',
store:store,
triggerAction:'all',
mode:'local',
selectOnFocus:true,
forceSelection: true,
allowBlank:false,
editable: false,
hiddenName:'sheng',
emptyText:'請(qǐng)選擇省',
blankText : '請(qǐng)選擇省',
listeners:{
select:function(combo, record,index){
try{
//userAdd = record.data.name;
var parent=Ext.getCmp('hosp_shi');
parent.clearValue();
parent.store.reload({params:{action:this.value}});
}
catch(ex)
{
Ext.MessageBox.alert(ex);
}
}
}
},
{
xtype:"combo",
name:'shi',
id : 'hosp_shi',
fieldLabel:'請(qǐng)選擇市',
displayField:'name',
valueField:'code',
store:comstore,
triggerAction:'all',
mode:'local',
selectOnFocus:true,
forceSelection: true,
allowBlank:false,
editable: false,
hiddenName:'shi',
emptyText:'請(qǐng)選擇市',
blankText : '請(qǐng)選擇市',
listeners:{
select:function(combo, record,index){
try{
var parent=Ext.getCmp('hosp_qu');
parent.clearValue();
//alert(record.data.name);
parent.store.reload({params:{action:this.value}});
}
catch(ex)
{
Ext.MessageBox.alert(ex);
}
}
}
},
{
xtype:"combo",
name:'qu',
id : 'hosp_qu',
fieldLabel:'請(qǐng)選擇區(qū)',
displayField:'name',
valueField:'code',
store:Threestore,
triggerAction:'all',
mode:'local',
selectOnFocus:true,
forceSelection: true,
allowBlank:false,
editable: false,
hiddenName:'qu',
emptyText:'請(qǐng)選擇區(qū)',
blankText : '請(qǐng)選擇區(qū)',
listeners:{
select:function(combo, record,index){
Ext.getCmp('gjz').focus();
}
}
},
{
xtype:"textfield",
itemCls:'stop-float',
name : 'gjz',
id : 'gjz',
fieldLabel : '關(guān)鍵字',
emptyText:'關(guān)鍵字',
allowBlank : true,
listeners :{
blur : function(){
var parent=Ext.getCmp('select_hosp');
var shengValue;
var shiValue;
var quValue;
if(typeof(Ext.getCmp('sheng').value)=="undefined")
{
shengValue = Ext.getCmp('hosp_sheng').value;
}
else
{
shengValue = Ext.getCmp('sheng').value;
}
if(typeof(Ext.getCmp('shi').value)=="undefined")
{
shiValue = Ext.getCmp('hosp_shi').value;
}
else
{
shiValue = Ext.getCmp('shi').value;
}
if(typeof(Ext.getCmp('qu').value)=="undefined")
{
quValue = Ext.getCmp('hosp_qu').value;
}
else
{
quValue = Ext.getCmp('qu').value;
}
var gjzValue = this.getValue();
parent.clearValue();
parent.store.reload({
params:{
Param1:shengValue,
Param2:shiValue,
Param3:quValue,
Param4:gjzValue
}
});
}
}
},
{
xtype:"combo",
name:'hospital',
id : 'select_hosp',
fieldLabel:'請(qǐng)選擇醫(yī)院',
displayField:'name',
valueField:'code',
store:hospital,
triggerAction:'all',
mode:'local',
selectOnFocus:true,
forceSelection: true,
allowBlank:false,
//editable: false,
hiddenName:'hospital',
emptyText:'請(qǐng)選擇醫(yī)院',
blankText : '請(qǐng)選擇醫(yī)院',
listeners:{
select:function(combo, record,index){
userDw = record.data.name;
Ext.getCmp("UserUnits").setValue(userDw);
Ext.getCmp("HWin").close();
}
}
}]
});
},
initComponent : function(){
//UserRegWindow.superclass.initComponent.call(this);
this.fp=this.createFormPanel();
this.add(this.fp);
}
});
if(store1!="")
{
Ext.getCmp('hosp_sheng').setValue(store1);
}
if(comstore1!="")
{
Ext.getCmp('hosp_shi').setValue(comstore1);
}
if(Threestore1!="")
{
Ext.getCmp('hosp_qu').setValue(Threestore1);
}
hospitalWin.show();
}
}),
{
xtype:"textfield",
itemCls:'stop-float',
name : 'UserDuty',
fieldLabel : '職務(wù)',
emptyText:'填寫您的職務(wù)名稱',
blankText : '職務(wù)不能為空'
},
{
xtype:"textfield",
name : 'UserTitle',
fieldLabel : '職稱',
emptyText:'填寫您的職稱',
blankText : '職稱不能為空'
},
{
xtype:"textfield",
id:'Usertxdz',
name : 'Usertxdz',
fieldLabel : '通訊地址',
emptyText:'填寫您的通訊地址',
//readOnly:true,
blankText : '通訊地址不能為空'
},
{
xtype:"textfield",
name : 'JoinTime',
fieldLabel : '添加時(shí)間',
readOnly:true,
emptyText:'選擇您的加入時(shí)間',
value:new Date().format('Y-m-d'),
blankText : '添加時(shí)間不能為空'
}] }); },
save:function() {
if(this.fp.form.isValid()){
this.fp.form.submit({
waitTitle:"請(qǐng)稍候",
waitMsg : "正在保存...",
url : 'service.asp?cmd=save',
success : function(form, action) {
var Result = action.result.success;
if(Result == false){
Ext.Msg.alert('提示', action.result.message,function(btn){
if(btn=='ok')
{
Ext.getCmp("UserName").reset();
Ext.getCmp("UserName").focus(true);return;
}
});
} else if(Result == true){
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -