1
<%@page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="rdp" uri="http://www.szfesc.cn/rdp" %> <!DOCTYPE html>
<html lang="zh-cn">
<head>
<title>新增客户黑名单信息</title>
<script type="text/javascript">
//去掉无证件下拉选择项
$(document).ready(function() {
$('#certTypes option[value="00"]').remove();
}); //提交表单时校验
function checkSubForm(){
var obj = $('#myForm'),
certyType = $.trim($('#certTypes option:selected').val()),
chgflag = false;
console.log(certyType);
//验证身份证格式
if(certyType == '01'){
var idcard = $.trim($('#certno').val());
if(idcard.length !=0 ){
chgflag = isIdCardNo(idcard)
}
if(!chgflag){
$('#certno').focus();
return false;
}
}
obj.submit();
return true;
}
</script>
</head>
<body>
<div class="row">
<div class="panel panel-default">
<div class="panel-heading">
<span class="glyphicon glyphicon-plus"></span>
新增客户黑名单信息
</div> <div class="panel-body">
<form class="form-horizontal rdpForm" role="form" id="myForm"
action="${ctx }/riskmgr/custblacklist/create" method="post" enctype="multipart/form-data">
<div class="form-group">
<label for="certtype" class="col-sm-2 control-label"><span>*</span>
证件类型</label>
<div class="col-sm-3">
<rdp:dictForm class="form-control" sectionId="certType" required="true"
selectedValue="${cblParam.certtype }" name="certtype" id="certTypes"
emptyOptionLabel="----请选择----" showValue="false" emptyOption="false"/>
</div>
<rdp:token />
</div>
<div class="form-group">
<label for="certno" class="col-sm-2 control-label"><span>*</span>
证件号</label>
<div class="col-sm-3">
<input type="text" class="form-control" name="certno" id="certno"
placeholder="证件号" required numberLetter="true"
lengthlimit="32" value="${cblParam.certno }">
</div>
</div>
<div class="form-group">
<label for="clientname" class="col-sm-2 control-label"><span>*</span>
姓名</label>
<div class="col-sm-3">
<input type="text" class="form-control" name="clientname"
placeholder="姓名" required
lengthlimit="120" value="${cblParam.clientname }">
</div>
</div>
<div class="form-group">
<label for="reasoncode" class="col-sm-2 control-label"><span>*</span>
录入原因码</label>
<div class="col-sm-3">
<rdp:dictForm sectionId="custBlacklistReasonCode" required="true" class="form-control"
name="reasoncode" selectedValue="${cblParam.reasoncode}"
emptyOptionLabel="----请选择----" emptyOption="false"/>
</div>
</div>
<div class="form-group">
<label for="blackreason" class="col-sm-2 control-label"><span>*</span>
录入原因</label>
<div class="col-sm-8">
<textarea rows="3" class="form-control" name="blackreason" required="true" lengthlimit="512" placeholder="只允许输入不超过512个字符!">${cblParam.blackreason }</textarea>
</div>
</div>
<div class="form-group">
<label for="context" class="col-sm-2 control-label">附件<a href="#" onclick="addFileInput();" title="新增附件" ><span class="glyphicon glyphicon-plus"></span></a></label>
<div class="col-sm-8">
<input type="hidden" name="filetype" value="11"/>
<input type="file" multiple="multiple" class="form-control" filetype="*.pdf;*.txt;*.doc;*.docx;*.xls;*.xlsx;*.jpg;*.jpeg;*.gif;*.png;*.bmp" name="uploadfile" placeholder="附件" value="" />
<span id="fileLabelId" style="color:#7B7B7B;">支持格式:*.pdf;*.txt;*.doc;*.docx;*.xls;*.xlsx;*.jpg;*.jpeg;*.gif;*.png;*.bmp;限制100M以内。</span>
</div>
</div>
<div class="form-group">
<label for="memo" class="col-sm-2 control-label">备注</label>
<div class="col-sm-8">
<textarea rows="5" cols="10" class="form-control" name="memo" lengthlimit="254" placeholder="只允许输入不超过254个字符!">${sysParam.memo }</textarea>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-success" onclick="return checkSubForm();">保存</button>
<a href="${ctx }/riskmgr/custblacklist?${qryStr}" class="btn btn-default">取消</a>
</div>
</div>
</form>
</div>
</div>
</div>
</body>
</html>
1
/**
* 身份证认证
* @param {Object} num
* @return {TypeName}
*/
function isIdCardNo(num){
num = num.toUpperCase();
//身份证号码为15位或者18位,15位时全为数字,18位前17位为数字,最后一位是校验位,可能为数字或字符X。
if (!(/(^\d{15}$)|(^\d{17}([0-9]|X)$)/.test(num))){
alert('输入的身份证号长度不对,或者号码不符合规定!\n15位号码应全为数字,18位号码末位可以为数字或X。');
return false;
}
//校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
//下面分别分析出生日期和校验位
var len, re;
len = num.length;
if (len == 15){
re = new RegExp(/^(\d{6})(\d{2})(\d{2})(\d{2})(\d{3})$/);
var arrSplit = num.match(re);
//检查生日日期是否正确
var dtmBirth = new Date('19' + arrSplit[2] + '/' + arrSplit[3] + '/' + arrSplit[4]);
var bGoodDay;
bGoodDay = (dtmBirth.getYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
if(!bGoodDay){
alert('身份证号码日期格式不正确!');
return false;
}else{
//将15位身份证转成18位
//校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
var nTemp = 0, i;
num = num.substr(0, 6) + '19' + num.substr(6, num.length - 6);
for(i = 0; i < 17; i ++){
nTemp += num.substr(i, 1) * arrInt[i];
}
num += arrCh[nTemp % 11];
return num;
}
}
if (len == 18){
re = new RegExp(/^(\d{6})(\d{4})(\d{2})(\d{2})(\d{3})([0-9]|X)$/);
var arrSplit = num.match(re);
//检查生日日期是否正确
var dtmBirth = new Date(arrSplit[2] + "/" + arrSplit[3] + "/" + arrSplit[4]);
var bGoodDay;
bGoodDay = (dtmBirth.getFullYear() == Number(arrSplit[2])) && ((dtmBirth.getMonth() + 1) == Number(arrSplit[3])) && (dtmBirth.getDate() == Number(arrSplit[4]));
if (!bGoodDay){
alert('身份证号码日期格式不正确!');
return false;
}else{
//检验18位身份证的校验码是否正确。
//校验位按照ISO 7064:1983.MOD 11-2的规定生成,X可以认为是数字10。
var valnum;
var arrInt = new Array(7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
var arrCh = new Array('1', '0', 'X', '9', '8', '7', '6', '5', '4', '3', '2');
var nTemp = 0, i;
for(i = 0; i < 17; i ++){
nTemp += num.substr(i, 1) * arrInt[i];
}
valnum = arrCh[nTemp % 11];
if (valnum != num.substr(17, 1)) {
alert('18位身份证的校验码不正确!应该为:' + valnum);
return false;
}
return num;
}
}
return true;
}
1