Commit 40f60f66 authored by stone's avatar stone

【fix】增加社会信用代码和身份证号的校验

parent 828bae68
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
<!--<script src="${/request/@context_path}/modules/prj/PRJ500N/javascripts/input_validator.js" type="text/javascript"/>--> <!--<script src="${/request/@context_path}/modules/prj/PRJ500N/javascripts/input_validator.js" type="text/javascript"/>-->
<link href="${/request/@context_path}/css/lightbox.css" rel="stylesheet" type="text/css"/> <link href="${/request/@context_path}/css/lightbox.css" rel="stylesheet" type="text/css"/>
<script src="${/request/@context_path}/javascripts/lightbox.js" type="text/javascript"/> <script src="${/request/@context_path}/javascripts/lightbox.js" type="text/javascript"/>
<script src="${/request/@context_path}/modules/prj/PRJ500N/javascripts/input_validator.js" type="text/javascript"/>
<a:link id="hls303_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/> <a:link id="hls303_cdd_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
<a:link id="hls303_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/> <a:link id="hls303_cdd_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
<!-- <script src="${/request/@context_path}/modules/prj/PRJ500N/javascripts/check_org_code.js" type="text/javascript"/> --> <!-- <script src="${/request/@context_path}/modules/prj/PRJ500N/javascripts/check_org_code.js" type="text/javascript"/> -->
...@@ -30,6 +32,41 @@ ...@@ -30,6 +32,41 @@
Ext.ux.Lightbox.register('a[ref=img]', true); Ext.ux.Lightbox.register('a[ref=img]', true);
//提交审批 //提交审批
var save_flag = 'N'; var save_flag = 'N';
function CheckSocialCreditCode(Code) {
var patrn = /^[0-9A-Z]+$/;
//18位校验及大写校验
if ((Code.length != 18) || (patrn.test(Code) == false)) {
return false;
} else {
var Ancode;//统一社会信用代码的每一个值
var Ancodevalue;//统一社会信用代码每一个值的权重
var total = 0;
var weightedfactors = [1, 3, 9, 27, 19, 26, 16, 17, 20, 29, 25, 13, 8, 24, 10, 30, 28];//加权因子
var str = '0123456789ABCDEFGHJKLMNPQRTUWXY';
//不用I、O、S、V、Z
for (var i = 0; i < Code.length - 1; i++) {
Ancode = Code.substring(i, i + 1);
Ancodevalue = str.indexOf(Ancode);
total = total + Ancodevalue * weightedfactors[i];
//权重与加权因子相乘之和
}
var logiccheckcode = 31 - total % 31;
if (logiccheckcode == 31) {
logiccheckcode = 0;
}
var Str = "0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,T,U,W,X,Y";
var Array_Str = Str.split(',');
logiccheckcode = Array_Str[logiccheckcode];
var checkcode = Code.substring(17, 18);
if (logiccheckcode != checkcode) {
return false;
} else {
return true;
}
}
}
window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function() { window['${/parameter/@layout_code}_submit_approval_layout_dynamic_click'] = function() {
// //
...@@ -83,6 +120,22 @@ ...@@ -83,6 +120,22 @@
if (head_record.get('bp_code')) { if (head_record.get('bp_code')) {
return true; return true;
} }
//对统一社会信用代码和身份生进行校验
var social_code=head_record.get('social_code');
var id_card_no_leg=head_record.get('id_card_no_leg');
if(!checkCard(id_card_no_leg)){
$L.showErrorMessage("错误",'请输入合法的身份证号!',null,null);
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return false;
}
if(!CheckSocialCreditCode(social_code)){
$L.showErrorMessage("错误",'请输入正确的社会信用代码!',null,null);
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return false;
}
Leaf.request({ Leaf.request({
url: $('get_special_fields_link_id').getUrl(), url: $('get_special_fields_link_id').getUrl(),
para: { para: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment