var state = 0;
$("#gb011").keyup(function(event){
last = event.timeStamp;//利用event的timeStamp来标记时间,这样每次的keyup事件都会修改last的值,注意last必需为全局变量
setTimeout(function(){
$.showLoad({isMask:true});
$("#gb011").blur();
if(last-event.timeStamp==0){
var newgb011= $("#gb011").val();
var oldgb011 = $("#gb011old").val();
$.ajax({
url:'${ctx}/peoBase/checkIdCard',
data:{"gb011old":oldgb011,"gb011":newgb011},
type:'get',
dataType:'JSON',
timeout:10000,
error:function(request){
state = 1;
$.validator.errorShow($("#gb011"),'对不起,服务器响应超时,请联系管理员');
$.hideLoad();
return false;
},
success:function(result){
$.hideLoad();
if(result != '1'){
state = 1;
$.validator.errorShow($("#gb011"),'对不起,系统已经存在此身份证号');
return false;
}else{
if(checkCard(newgb011)==true){
var year =newgb011.substring(6,10);
var mouth = newgb011.substring(10,12);
var day = newgb011.substring(12,14);
var sex = newgb011.substring(16,17);
var select = $("select[name='vgb002']").children("option").attr("disabled","disabled");
if(newgb011!=""){
$("input[name='gb012']").val(year+"-"+mouth+"-"+day);
$("input[name='gb012']").removeAttr("onFocus");
var sexCode = 2;
//sex%2==1?sexCode=1:sexCode;
if(sex%2==1){
var s = select.eq(2).attr("selected","selected").removeAttr("disabled").val();
}else {
var s = select.eq(3).attr("selected","selected").removeAttr("disabled").val();
}
var ss = s.split("-");
$("input[name='gb002']").val(ss[0]);
$("input[name='hgb002']").val(ss[1]);
}else{
select.attr("selected","selected").removeAttr("disabled");
$("input[name='gb012']").attr("onFocus","WdatePicker({isShowClear:true,readOnly:true,maxDate: '%y-%M-%d'})");
}
}
}
}
});
}
},3000)
});
0 回复
添加回复
请先登陆