UserPhoneTestWin = Ext.extend(Ext.Window, {
constructor : function() {
var tmId = "";
//copy 参数属性到当前对象
var cfg = cfg || {};
this.initCom();
UserPhoneTestWin.superclass.constructor.call(this, {
title:'按用户号码',
id:'_userTest',
width:500,
height:180,
frame :true,
border:false
});
},
initCom:function(){
var form = new FormPanel();
this.items=[form];
}
});
FormPanel = new Ext.extend(Ext.form.FormPanel,{
constructor : function() {
var tmId = "";
//copy 参数属性到当前对象
var cfg = cfg || {};
this.initCom();
UserPhoneTestWin.superclass.constructor.call(this, {
width:490,
height:150,
frame :true,
border:false,
items: [{
xtype: 'panel',
layout: 'column',
style: 'margin: 20px 0 0 10px;',
items: [
{
columnWidth: .8,
layout: 'form',
labelWidth: 60,
labelAlign:"right",
style: 'margin: 6px 0 0 30px;',
items: this.userphoneText
},{
columnWidth: .8,
layout: 'form',
style: 'margin: 5px 0 0 110px;',
items: this.info
},{
columnWidth: .8,
layout: 'form',
style: 'margin: 5px 0 0 110px;',
items: this.showInfo
}
]
}],
buttonAlign:'center',
buttons:[{text:'测试',id:'save',iconCls:'save',handler:this.doTest,scope:this},
{text:'重置',iconCls:'delete',handler:this.doCancel,scope:this},
{text:'关闭',iconCls:'close',handler:this.doClose,scope:this}]
});
},
initCom:function(){
this.userphoneText = new Ext.form.TextField({
allowBlank : false,
width : 240,
id : '_userphone',
fieldLabel : '用户号',
regex: /(^[0-9]{3,4}\-[0-9]{7,8}$)|(^[0-9]{7,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/,
regexText: '请输入正确的用户号码格式',
listeners: {
'focus': {fn: this.promptInfo, scope: this}
}
});
this.info = new Ext.form.Label({
id:'_info',
text: '请输入电话号码或宽带账号',
hidden: true,
style: 'font-size:13px;color:red;'
});
this.showInfo = new Ext.form.Label({
id:'_showInfo',
text: '该账号不存在,请重新输入',
hidden: true,
style: 'font-size:13px;color:red;'
});
},
promptInfo:function(){
this.info.hide();
this.showInfo.hide();
},
doTest:function(){
var phoneNumber = Ext.getCmp('_userphone').getValue();
if(phoneNumber == null || phoneNumber==""){
Ext.getCmp('_info').show();
Ext.getCmp('_showInfo').hide();
}else{
Ext.getCmp('_info').hide();
QueryTestResultManager.saveOdnNumberTestTask(phoneNumber,function(data){
if(data == ""){
Ext.getCmp('_showInfo').show();
}else if(data != null && data != ""){
tmId = data;
var fulls = "left=0,top=0,location=yes,resizable=yes"; //定义弹出窗口的参数
if (window.screen) {
var ah = screen.availHeight - 30;
var aw = screen.availWidth - 10;
fulls += ",height=" + ah;
fulls += ",width=" + aw;
}
//
}
},this);
}
},
doCancel:function(){
Ext.getCmp('_userphone').reset();
},
doClose:function(){
Ext.getCmp('_userTest').close();
}
});