Commit 1a449a86 authored by Luochenglong's avatar Luochenglong Committed by 邓乾隆

证件类型校验

parent 580903cc
...@@ -800,15 +800,34 @@ ...@@ -800,15 +800,34 @@
if(record.get('bp_type') == 'TENANT'){ //if(record.get('bp_type') == 'TENANT'){
var credit_code = record.get('credit_code'); var credit_code = record.get('credit_code');
if (!Leaf.isEmpty(credit_code)) { if (!Leaf.isEmpty(credit_code)) {
//去除空格
credit_code = credit_code.trim(); credit_code = credit_code.trim();
credit_code = credit_code.replace(/[\t\r\f\n\s]*/g,""); credit_code = credit_code.replace(/[\t\r\f\n\s]*/g,"");
if (credit_code.length == '16'){ if (credit_code.length == '16'){
if(!(/^[A-Z][A-z0-9]*$/).test(credit_code)){ // if(!(/^[A-Z][A-z0-9]*$/).test(credit_code)){
Leaf.showMessage('提示', '中征码首字母需要大写'); // Leaf.showMessage('提示', '中征码首字母需要大写');
// window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
// setTimeout(function () {
// record.set('credit_code', '');
// }, 20);
// return false;
//
// }else {
// return true;
// }
let financeCode = new Array(16);
for (let i = 0; i < credit_code.length && i < 16; i++) {
financeCode[i] = credit_code.charCodeAt(i);
}
if(!checkDKK(financeCode)){
Leaf.showMessage('提示', '中征码错误');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('credit_code', '');
}, 20);
return false; return false;
}else { }else {
...@@ -817,10 +836,13 @@ ...@@ -817,10 +836,13 @@
}else { }else {
Leaf.showMessage('提示', '请输入16位中征码'); Leaf.showMessage('提示', '请输入16位中征码');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('credit_code', '');
}, 20);
return false; return false;
} }
} }
} //}
} }
if (name == 'org_type') { if (name == 'org_type') {
...@@ -839,8 +861,8 @@ ...@@ -839,8 +861,8 @@
record.getField('enterprise_scale_n').setRequired(true); record.getField('enterprise_scale_n').setRequired(true);
} }
} }
//法人承租人添加 法人姓名和法人身份证号 时,更新企业关联信息的法人数据 //法人承租人company_ds_id添加 法人姓名和法人身份证号 时,更新企业关联信息的法人数据
var company_ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master_company_info'); var company_ds_id= get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master_company_info');
if((name == 'legal_person'|| name == 'id_card_no_leg')){ if((name == 'legal_person'|| name == 'id_card_no_leg')){
var records_company = $(company_ds_id).getAll(); var records_company = $(company_ds_id).getAll();
for(var i=0;i<records_company.length;i++){ for(var i=0;i<records_company.length;i++){
...@@ -858,6 +880,193 @@ ...@@ -858,6 +880,193 @@
} }
} }
} }
if(company_ds_id=ds.id){
if (name == 'id_type' && value) {
if (value == '110'&&record.get('associate_id_no')) {
var associate_id_no =record.get('associate_id_no');
if (!checkCard(associate_id_no)) {
Leaf.showMessage('提示', '个人身份证号错误!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
} else if (associate_id_no.length == 18) {
new_id_card = record.get('associate_id_no');
//自动带出籍贯
//record.set('resident_addres', get_native_place(value));
record.set('date_of_birth', new Date(associate_id_no.substr(6, 4) + '/' + associate_id_no.substr(10, 2) + '/' + associate_id_no.substr(12, 2)));
record.set('age', new Date().getFullYear() - associate_id_no.substr(6, 4));
if (associate_id_no.substr(16, 1) % 2 == 1) {
record.set('gender', 'MALE');
record.set('gender_n', '男');
} else if (associate_id_no.substr(16, 1) % 2 == 0) {
record.set('gender', 'FEMALE');
record.set('gender_n', '女');
}
}
}else if(value == '140'&&record.get('associate_id_no')){
//护照
var associate_id_no =record.get('associate_id_no');
if (!Leaf.isEmpty(associate_id_no)) {
associate_id_no = associate_id_no.trim();
associate_id_no = associate_id_no.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=associate_id_no.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(associate_id_no)){
Leaf.showMessage('提示', '护照格式错误');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
}
}else if(value == '210'&&record.get('associate_id_no')){
//护照
var credit_code =record.get('associate_id_no');
if (!Leaf.isEmpty(credit_code)) {
credit_code = credit_code.trim();
credit_code = credit_code.replace(/[\t\r\f\n\s]*/g,"");
if (credit_code.length == '16'){
let financeCode = new Array(16);
for (let i = 0; i < credit_code.length && i < 16; i++) {
financeCode[i] = credit_code.charCodeAt(i);
}
if(!checkDKK(financeCode)){
Leaf.showMessage('提示', '中征码错误');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}else {
return true;
}
}else {
Leaf.showMessage('提示', '请输入16位中征码');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
}
} else if(value == '220'&&record.get('associate_id_no')){
//护照
var soc_code =record.get('associate_id_no');
if (soc_code) {
if (!CheckSocialCreditCode(soc_code)) {
Leaf.showMessage('提示', '统一社会信用代码有误,请重新输入!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
// window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return false;
}
}
}
}
if (name == 'associate_id_no'&&value) {
if (record.get('id_type') == '110') {
if (!checkCard(value)) {
Leaf.showMessage('${l:HLS.PROMPT}', '个人身份证号错误!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
} else {
if (value.length == 18) {
record.set('date_of_birth', new Date(value.substr(6, 4) + '/' + value.substr(10, 2) + '/' + value.substr(12, 2)));
record.set('age', new Date().getFullYear() - value.substr(6, 4));
if (value.substr(16, 1) % 2 == 1) {
record.set('gender', 'MALE');
record.set('gender_n', '男');
} else if (value.substr(16, 1) % 2 == 0) {
record.set('gender', 'FEMALE');
record.set('gender_n', '女');
}
}
}
}else if(record.get('id_type') == '140'){
//护照
if (!Leaf.isEmpty(value)) {
value = value.trim();
value = value.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=value.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(value)){
Leaf.showMessage('提示', '护照格式错误');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
}
}else if(record.get('id_type') == '210'&&value){
//护照
var credit_code =record.get('associate_id_no');
if (!Leaf.isEmpty(value)) {
value = value.trim();
value = value.replace(/[\t\r\f\n\s]*/g,"");
if (value.length == '16'){
let financeCode = new Array(16);
for (let i = 0; i < value.length && i < 16; i++) {
financeCode[i] = value.charCodeAt(i);
}
if(!checkDKK(financeCode)){
Leaf.showMessage('提示', '中征码错误');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}else {
return true;
}
}else {
Leaf.showMessage('提示', '请输入16位中征码');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
}
} else if(record.get('id_type') == '220'&&value){
//护照
var soc_code =record.get('associate_id_no');
if (value) {
if (!CheckSocialCreditCode(value)) {
Leaf.showMessage('提示', '统一社会信用代码有误,请重新输入!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
// window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return false;
}
}
}
}
}
//出资人 出资比例必填 //出资人 出资比例必填
if(name == 'other_relationships'){ if(name == 'other_relationships'){
if(value == '2'){ if(value == '2'){
...@@ -960,6 +1169,56 @@ ...@@ -960,6 +1169,56 @@
record.getField('parent_id_n').setReadOnly(true); record.getField('parent_id_n').setReadOnly(true);
} }
} }
if (name == 'id_type' && value) {
if (value == 'ID_CARD'&&record.get('id_card_no')) {
var id_card_no =record.get('id_card_no');
if (!checkCard(id_card_no)) {
Leaf.showMessage('提示', '个人身份证号错误!');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
} else if (id_card_no.length == 18) {
new_id_card = record.get('id_card_no');
//自动带出籍贯
//record.set('resident_addres', get_native_place(value));
record.set('date_of_birth', new Date(id_card_no.substr(6, 4) + '/' + id_card_no.substr(10, 2) + '/' + id_card_no.substr(12, 2)));
record.set('age', new Date().getFullYear() - id_card_no.substr(6, 4));
if (id_card_no.substr(16, 1) % 2 == 1) {
record.set('gender', 'MALE');
record.set('gender_n', '男');
} else if (id_card_no.substr(16, 1) % 2 == 0) {
record.set('gender', 'FEMALE');
record.set('gender_n', '女');
}
}
}else if(value == 'PASSPORT'&&record.get('id_card_no')){
//护照
var id_card_no =record.get('id_card_no');
if (!Leaf.isEmpty(id_card_no)) {
id_card_no = id_card_no.trim();
id_card_no = id_card_no.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=id_card_no.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(id_card_no)){
Leaf.showMessage('提示', '护照格式错误');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
}
}
}
}
if (name == 'id_card_no') { if (name == 'id_card_no') {
// record = $(hls_bp_master_ds_id).getCurrentRecord(); // record = $(hls_bp_master_ds_id).getCurrentRecord();
// var id_num = record.get('id_card_no'); // var id_num = record.get('id_card_no');
...@@ -989,11 +1248,84 @@ ...@@ -989,11 +1248,84 @@
} }
} }
}else if(record.get('id_type') == 'PASSPORT'){
//护照
if (!Leaf.isEmpty(value)) {
value = value.trim();
value = value.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=value.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(value)){
Leaf.showMessage('提示', '护照格式错误');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
}
}
} }
// ds.fields.id_card_no.pro.validator = id_card_no_validate; // ds.fields.id_card_no.pro.validator = id_card_no_validate;
//自动带出籍贯 //自动带出籍贯
// record.set('resident_addres', get_native_place(value)) // record.set('resident_addres', get_native_place(value))
} }
if (name == 'card_type_sp' && value) {
if (value == 'ID_CARD'&&record.get('id_no_sp')) {
var id_no_sp =record.get('id_no_sp');
if (!checkCard(id_no_sp)) {
Leaf.showMessage('提示', '配偶信息中,请输入正确格式的身份证!');
setTimeout(function () {
record.set('id_no_sp', '');
}, 20);
return false;
} else if (id_no_sp.length == 18) {
new_id_card = record.get('id_no_sp');
//自动带出籍贯
//record.set('resident_addres', get_native_place(value));
record.set('date_of_birth', new Date(id_no_sp.substr(6, 4) + '/' + id_no_sp.substr(10, 2) + '/' + id_no_sp.substr(12, 2)));
record.set('age', new Date().getFullYear() - id_no_sp.substr(6, 4));
if (id_no_sp.substr(16, 1) % 2 == 1) {
record.set('gender', 'MALE');
record.set('gender_n', '男');
} else if (id_no_sp.substr(16, 1) % 2 == 0) {
record.set('gender', 'FEMALE');
record.set('gender_n', '女');
}
}
}else if(value == 'PASSPORT'&&record.get('id_no_sp')){
//护照
var id_no_sp =record.get('id_no_sp');
if (!Leaf.isEmpty(id_no_sp)) {
id_no_sp = id_no_sp.trim();
id_no_sp = id_no_sp.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=id_no_sp.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('id_no_sp', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(id_no_sp)){
Leaf.showMessage('提示', '护照格式错误');
setTimeout(function () {
record.set('id_no_sp', '');
}, 20);
return false;
}
}
}
}
if (name == 'id_no_sp' && value) { if (name == 'id_no_sp' && value) {
if (!value) { if (!value) {
...@@ -1012,6 +1344,27 @@ ...@@ -1012,6 +1344,27 @@
record.set('date_of_birth_sp', new Date(value.substr(6, 4) + '/' + value.substr(10, 2) + '/' + value.substr(12, 2))); record.set('date_of_birth_sp', new Date(value.substr(6, 4) + '/' + value.substr(10, 2) + '/' + value.substr(12, 2)));
} }
} }
}else if(record.get('card_type_sp') == 'PASSPORT'){
//护照
if (!Leaf.isEmpty(value)) {
value = value.trim();
value = value.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=value.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(value)){
Leaf.showMessage('提示', '配偶护照格式错误');
setTimeout(function () {
record.set('id_no_sp', '');
}, 20);
return false;
}
}
} }
// ds.fields.id_no_sp.pro.validator = id_card_no_validate; // ds.fields.id_no_sp.pro.validator = id_card_no_validate;
// record.set('resident_addres_sp', get_native_place(value)) // record.set('resident_addres_sp', get_native_place(value))
......
...@@ -583,15 +583,33 @@ ...@@ -583,15 +583,33 @@
//中征码校验 //中征码校验
if (record.get('bp_class') == 'ORG') { if (record.get('bp_class') == 'ORG') {
if(record.get('bp_type') == 'TENANT' && name =='credit_code'){ //if(record.get('bp_type') == 'TENANT' && name =='credit_code'){
var credit_code = record.get('credit_code'); var credit_code = record.get('credit_code');
if (!Leaf.isEmpty(credit_code)) { if (!Leaf.isEmpty(credit_code)) {
credit_code = credit_code.trim(); credit_code = credit_code.trim();
credit_code = credit_code.replace(/[\t\r\f\n\s]*/g,""); credit_code = credit_code.replace(/[\t\r\f\n\s]*/g,"");
if (credit_code.length == '16'){ if (credit_code.length == '16'){
if(!(/^[A-Z][A-z0-9]*$/).test(credit_code)){ // if(!(/^[A-Z][A-z0-9]*$/).test(credit_code)){
Leaf.showMessage('提示', '中征码首字母需要大写'); // Leaf.showMessage('提示', '中征码首字母需要大写');
// window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
// setTimeout(function () {
// record.set('credit_code', '');
// }, 20);
// return false;
//
// }else {
// return true;
// }
let financeCode = new Array(16);
for (let i = 0; i < credit_code.length && i < 16; i++) {
financeCode[i] = credit_code.charCodeAt(i);
}
if(!checkDKK(financeCode)){
Leaf.showMessage('提示', '中征码错误');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('credit_code', '');
}, 20);
return false; return false;
}else { }else {
...@@ -600,10 +618,13 @@ ...@@ -600,10 +618,13 @@
}else { }else {
Leaf.showMessage('提示', '请输入16位中征码'); Leaf.showMessage('提示', '请输入16位中征码');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('credit_code', '');
}, 20);
return false; return false;
} }
} }
} //}
} }
if (gird_ds_id == ds.id || gird_ds_id2 == ds.id) { if (gird_ds_id == ds.id || gird_ds_id2 == ds.id) {
...@@ -729,6 +750,255 @@ ...@@ -729,6 +750,255 @@
} }
} }
var company_ds_id= get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master_company_info');
if(company_ds_id=ds.id){
if (name == 'id_type' && value) {
if (value == '110'&&record.get('associate_id_no')) {
var associate_id_no =record.get('associate_id_no');
if (!checkCard(associate_id_no)) {
Leaf.showMessage('提示', '个人身份证号错误!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
} else if (associate_id_no.length == 18) {
new_id_card = record.get('associate_id_no');
//自动带出籍贯
//record.set('resident_addres', get_native_place(value));
record.set('date_of_birth', new Date(associate_id_no.substr(6, 4) + '/' + associate_id_no.substr(10, 2) + '/' + associate_id_no.substr(12, 2)));
record.set('age', new Date().getFullYear() - associate_id_no.substr(6, 4));
if (associate_id_no.substr(16, 1) % 2 == 1) {
record.set('gender', 'MALE');
record.set('gender_n', '男');
} else if (associate_id_no.substr(16, 1) % 2 == 0) {
record.set('gender', 'FEMALE');
record.set('gender_n', '女');
}
}
}else if(value == '140'&&record.get('associate_id_no')){
//护照
var associate_id_no =record.get('associate_id_no');
if (!Leaf.isEmpty(associate_id_no)) {
associate_id_no = associate_id_no.trim();
associate_id_no = associate_id_no.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=associate_id_no.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(associate_id_no)){
Leaf.showMessage('提示', '护照格式错误');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
}
}else if(value == '210'&&record.get('associate_id_no')){
//护照
var credit_code =record.get('associate_id_no');
if (!Leaf.isEmpty(credit_code)) {
credit_code = credit_code.trim();
credit_code = credit_code.replace(/[\t\r\f\n\s]*/g,"");
if (credit_code.length == '16'){
let financeCode = new Array(16);
for (let i = 0; i < credit_code.length && i < 16; i++) {
financeCode[i] = credit_code.charCodeAt(i);
}
if(!checkDKK(financeCode)){
Leaf.showMessage('提示', '中征码错误');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}else {
return true;
}
}else {
Leaf.showMessage('提示', '请输入16位中征码');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
}
} else if(value == '220'&&record.get('associate_id_no')){
//护照
var soc_code =record.get('associate_id_no');
if (soc_code) {
if (!CheckSocialCreditCode(soc_code)) {
Leaf.showMessage('提示', '统一社会信用代码有误,请重新输入!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
// window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return false;
}
}
}
}
if (name == 'associate_id_no'&&value) {
if (record.get('id_type') == '110') {
if (!checkCard(value)) {
Leaf.showMessage('${l:HLS.PROMPT}', '个人身份证号错误!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
} else {
if (value.length == 18) {
record.set('date_of_birth', new Date(value.substr(6, 4) + '/' + value.substr(10, 2) + '/' + value.substr(12, 2)));
record.set('age', new Date().getFullYear() - value.substr(6, 4));
if (value.substr(16, 1) % 2 == 1) {
record.set('gender', 'MALE');
record.set('gender_n', '男');
} else if (value.substr(16, 1) % 2 == 0) {
record.set('gender', 'FEMALE');
record.set('gender_n', '女');
}
}
}
}else if(record.get('id_type') == '140'){
//护照
if (!Leaf.isEmpty(value)) {
value = value.trim();
value = value.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=value.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(value)){
Leaf.showMessage('提示', '护照格式错误');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
}
}else if(record.get('id_type') == '210'&&value){
//护照
var credit_code =record.get('associate_id_no');
if (!Leaf.isEmpty(value)) {
value = value.trim();
value = value.replace(/[\t\r\f\n\s]*/g,"");
if (value.length == '16'){
let financeCode = new Array(16);
for (let i = 0; i < value.length && i < 16; i++) {
financeCode[i] = value.charCodeAt(i);
}
if(!checkDKK(financeCode)){
Leaf.showMessage('提示', '中征码错误');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}else {
return true;
}
}else {
Leaf.showMessage('提示', '请输入16位中征码');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
}
} else if(record.get('id_type') == '220'&&value){
//护照
var soc_code =record.get('associate_id_no');
if (value) {
if (!CheckSocialCreditCode(value)) {
Leaf.showMessage('提示', '统一社会信用代码有误,请重新输入!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
// window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return false;
}
}
}
}
}
//法人身份证号校验
if (name == 'id_card_no_leg' && value){
var id_card_no_leg = record.get('id_card_no_leg');
if (!checkCard(id_card_no_leg)) {
Leaf.showMessage('${l:HLS.PROMPT}', '法人代表身份证号格式错误!');
setTimeout(function () {
record.set('id_card_no_leg', '');
}, 20);
return false;
}
}
if (name == 'id_type' && value) {
if (value == 'ID_CARD'&&record.get('id_card_no')) {
var id_card_no =record.get('id_card_no');
if (!checkCard(id_card_no)) {
Leaf.showMessage('提示', '基本信息中,请输入正确格式的身份证!');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
} else if (id_card_no.length == 18) {
new_id_card = record.get('id_card_no');
//自动带出籍贯
//record.set('resident_addres', get_native_place(value));
record.set('date_of_birth', new Date(id_card_no.substr(6, 4) + '/' + id_card_no.substr(10, 2) + '/' + id_card_no.substr(12, 2)));
record.set('age', new Date().getFullYear() - id_card_no.substr(6, 4));
if (id_card_no.substr(16, 1) % 2 == 1) {
record.set('gender', 'MALE');
record.set('gender_n', '男');
} else if (id_card_no.substr(16, 1) % 2 == 0) {
record.set('gender', 'FEMALE');
record.set('gender_n', '女');
}
}
}else if(value == 'PASSPORT'&&record.get('id_card_no')){
//护照
var id_card_no =record.get('id_card_no');
if (!Leaf.isEmpty(id_card_no)) {
id_card_no = id_card_no.trim();
id_card_no = id_card_no.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=id_card_no.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(id_card_no)){
Leaf.showMessage('提示', '护照格式错误');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
}
}
}
}
if (name == 'id_card_no' && value) { if (name == 'id_card_no' && value) {
if (record.get('id_type') == 'ID_CARD') { if (record.get('id_type') == 'ID_CARD') {
if (!checkCard(value)) { if (!checkCard(value)) {
...@@ -752,6 +1022,77 @@ ...@@ -752,6 +1022,77 @@
} }
} }
}else if(record.get('id_type') == 'PASSPORT'){
//护照
if (!Leaf.isEmpty(value)) {
value = value.trim();
value = value.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=value.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(value)){
Leaf.showMessage('提示', '护照格式错误');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
}
}
}
}
if (name == 'card_type_sp' && value) {
if (value == 'ID_CARD'&&record.get('id_no_sp')) {
var id_no_sp =record.get('id_no_sp');
if (!checkCard(id_no_sp)) {
Leaf.showMessage('提示', '配偶信息中,请输入正确格式的身份证!');
setTimeout(function () {
record.set('id_no_sp', '');
}, 20);
return false;
} else if (id_no_sp.length == 18) {
new_id_card = record.get('id_no_sp');
//自动带出籍贯
//record.set('resident_addres', get_native_place(value));
record.set('date_of_birth', new Date(id_no_sp.substr(6, 4) + '/' + id_no_sp.substr(10, 2) + '/' + id_no_sp.substr(12, 2)));
record.set('age', new Date().getFullYear() - id_no_sp.substr(6, 4));
if (id_no_sp.substr(16, 1) % 2 == 1) {
record.set('gender', 'MALE');
record.set('gender_n', '男');
} else if (id_no_sp.substr(16, 1) % 2 == 0) {
record.set('gender', 'FEMALE');
record.set('gender_n', '女');
}
}
}else if(value == 'PASSPORT'&&record.get('id_no_sp')){
//护照
var id_no_sp =record.get('id_no_sp');
if (!Leaf.isEmpty(id_no_sp)) {
id_no_sp = id_no_sp.trim();
id_no_sp = id_no_sp.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=id_no_sp.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('id_no_sp', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(id_no_sp)){
Leaf.showMessage('提示', '护照格式错误');
setTimeout(function () {
record.set('id_no_sp', '');
}, 20);
return false;
}
}
} }
} }
...@@ -781,6 +1122,27 @@ ...@@ -781,6 +1122,27 @@
}*/ }*/
} }
}else if(record.get('card_type_sp') == 'PASSPORT'){
//护照
if (!Leaf.isEmpty(value)) {
value = value.trim();
value = value.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=value.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(value)){
Leaf.showMessage('提示', '配偶护照格式错误');
setTimeout(function () {
record.set('id_no_sp', '');
}, 20);
return false;
}
}
} }
} }
......
...@@ -615,15 +615,33 @@ ...@@ -615,15 +615,33 @@
//中征码校验 //中征码校验
if (record.get('bp_class') == 'ORG') { if (record.get('bp_class') == 'ORG') {
if(record.get('bp_type') == 'TENANT' && name =='credit_code'){ //if(record.get('bp_type') == 'TENANT' && name =='credit_code'){
var credit_code = record.get('credit_code'); var credit_code = record.get('credit_code');
if (!Leaf.isEmpty(credit_code)) { if (!Leaf.isEmpty(credit_code)) {
credit_code = credit_code.trim(); credit_code = credit_code.trim();
credit_code = credit_code.replace(/[\t\r\f\n\s]*/g,""); credit_code = credit_code.replace(/[\t\r\f\n\s]*/g,"");
if (credit_code.length == '16'){ if (credit_code.length == '16'){
if(!(/^[A-Z][A-z0-9]*$/).test(credit_code)){ // if(!(/^[A-Z][A-z0-9]*$/).test(credit_code)){
Leaf.showMessage('提示', '中征码首字母需要大写'); // Leaf.showMessage('提示', '中征码首字母需要大写');
// window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
// setTimeout(function () {
// record.set('credit_code', '');
// }, 20);
// return false;
//
// }else {
// return true;
// }
let financeCode = new Array(16);
for (let i = 0; i < credit_code.length && i < 16; i++) {
financeCode[i] = credit_code.charCodeAt(i);
}
if(!checkDKK(financeCode)){
Leaf.showMessage('提示', '中征码错误');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('credit_code', '');
}, 20);
return false; return false;
}else { }else {
...@@ -632,10 +650,13 @@ ...@@ -632,10 +650,13 @@
}else { }else {
Leaf.showMessage('提示', '请输入16位中征码'); Leaf.showMessage('提示', '请输入16位中征码');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window'](); window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('credit_code', '');
}, 20);
return false; return false;
} }
} }
} //}
} }
if (gird_ds_id == ds.id || gird_ds_id2 == ds.id) { if (gird_ds_id == ds.id || gird_ds_id2 == ds.id) {
if (name == 'relationship_with_bp') { if (name == 'relationship_with_bp') {
...@@ -785,6 +806,67 @@ ...@@ -785,6 +806,67 @@
} }
} }
//法人身份证号校验
if (name == 'id_card_no_leg' && value){
var id_card_no_leg = record.get('id_card_no_leg');
if (!checkCard(id_card_no_leg)) {
Leaf.showMessage('${l:HLS.PROMPT}', '法人代表身份证号格式错误!');
setTimeout(function () {
record.set('id_card_no_leg', '');
}, 20);
return false;
}
}
if (name == 'id_type' && value) {
if (value == 'ID_CARD'&&record.get('id_card_no')) {
var id_card_no =record.get('id_card_no');
if (!checkCard(id_card_no)) {
Leaf.showMessage('提示', '基本信息中,请输入正确格式的身份证!');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
} else if (id_card_no.length == 18) {
new_id_card = record.get('id_card_no');
//自动带出籍贯
//record.set('resident_addres', get_native_place(value));
record.set('date_of_birth', new Date(id_card_no.substr(6, 4) + '/' + id_card_no.substr(10, 2) + '/' + id_card_no.substr(12, 2)));
record.set('age', new Date().getFullYear() - id_card_no.substr(6, 4));
if (id_card_no.substr(16, 1) % 2 == 1) {
record.set('gender', 'MALE');
record.set('gender_n', '男');
} else if (id_card_no.substr(16, 1) % 2 == 0) {
record.set('gender', 'FEMALE');
record.set('gender_n', '女');
}
}
}else if(value == 'PASSPORT'&&record.get('id_card_no')){
//护照
var id_card_no =record.get('id_card_no');
if (!Leaf.isEmpty(id_card_no)) {
id_card_no = id_card_no.trim();
id_card_no = id_card_no.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=id_card_no.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(id_card_no)){
Leaf.showMessage('提示', '护照格式错误');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
}
}
}
}
if (name == 'id_card_no' && value) { if (name == 'id_card_no' && value) {
if (record.get('id_type') == 'ID_CARD') { if (record.get('id_type') == 'ID_CARD') {
if (!checkCard(value)) { if (!checkCard(value)) {
...@@ -808,6 +890,77 @@ ...@@ -808,6 +890,77 @@
} }
} }
}else if(record.get('id_type') == 'PASSPORT'){
//护照
if (!Leaf.isEmpty(value)) {
value = value.trim();
value = value.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=value.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(value)){
Leaf.showMessage('提示', '护照格式错误');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
}
}
}
}
if (name == 'card_type_sp' && value) {
if (value == 'ID_CARD'&&record.get('id_no_sp')) {
var id_no_sp =record.get('id_no_sp');
if (!checkCard(id_no_sp)) {
Leaf.showMessage('提示', '配偶信息中,请输入正确格式的身份证!');
setTimeout(function () {
record.set('id_no_sp', '');
}, 20);
return false;
} else if (id_no_sp.length == 18) {
new_id_card = record.get('id_no_sp');
//自动带出籍贯
//record.set('resident_addres', get_native_place(value));
record.set('date_of_birth', new Date(id_no_sp.substr(6, 4) + '/' + id_no_sp.substr(10, 2) + '/' + id_no_sp.substr(12, 2)));
record.set('age', new Date().getFullYear() - id_no_sp.substr(6, 4));
if (id_no_sp.substr(16, 1) % 2 == 1) {
record.set('gender', 'MALE');
record.set('gender_n', '男');
} else if (id_no_sp.substr(16, 1) % 2 == 0) {
record.set('gender', 'FEMALE');
record.set('gender_n', '女');
}
}
}else if(value == 'PASSPORT'&&record.get('id_no_sp')){
//护照
var id_no_sp =record.get('id_no_sp');
if (!Leaf.isEmpty(id_no_sp)) {
id_no_sp = id_no_sp.trim();
id_no_sp = id_no_sp.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=id_no_sp.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('id_no_sp', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(id_no_sp)){
Leaf.showMessage('提示', '护照格式错误');
setTimeout(function () {
record.set('id_no_sp', '');
}, 20);
return false;
}
}
} }
} }
...@@ -837,8 +990,214 @@ ...@@ -837,8 +990,214 @@
}*/ }*/
} }
}else if(record.get('card_type_sp') == 'PASSPORT'){
//护照
if (!Leaf.isEmpty(value)) {
value = value.trim();
value = value.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=value.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('id_card_no', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(value)){
Leaf.showMessage('提示', '配偶护照格式错误');
setTimeout(function () {
record.set('id_no_sp', '');
}, 20);
return false;
}
}
}
}
}
var company_ds_id= get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hls_bp_master_com_req');
if(company_ds_id=ds.id){
if (name == 'id_type' && value) {
if (value == '110'&&record.get('associate_id_no')) {
var associate_id_no =record.get('associate_id_no');
if (!checkCard(associate_id_no)) {
Leaf.showMessage('提示', '个人身份证号错误!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
} else if (associate_id_no.length == 18) {
new_id_card = record.get('associate_id_no');
//自动带出籍贯
//record.set('resident_addres', get_native_place(value));
record.set('date_of_birth', new Date(associate_id_no.substr(6, 4) + '/' + associate_id_no.substr(10, 2) + '/' + associate_id_no.substr(12, 2)));
record.set('age', new Date().getFullYear() - associate_id_no.substr(6, 4));
if (associate_id_no.substr(16, 1) % 2 == 1) {
record.set('gender', 'MALE');
record.set('gender_n', '男');
} else if (associate_id_no.substr(16, 1) % 2 == 0) {
record.set('gender', 'FEMALE');
record.set('gender_n', '女');
}
}
}else if(value == '140'&&record.get('associate_id_no')){
//护照
var associate_id_no =record.get('associate_id_no');
if (!Leaf.isEmpty(associate_id_no)) {
associate_id_no = associate_id_no.trim();
associate_id_no = associate_id_no.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=associate_id_no.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(associate_id_no)){
Leaf.showMessage('提示', '护照格式错误');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
} }
}else if(value == '210'&&record.get('associate_id_no')){
//护照
var credit_code =record.get('associate_id_no');
if (!Leaf.isEmpty(credit_code)) {
credit_code = credit_code.trim();
credit_code = credit_code.replace(/[\t\r\f\n\s]*/g,"");
if (credit_code.length == '16'){
let financeCode = new Array(16);
for (let i = 0; i < credit_code.length && i < 16; i++) {
financeCode[i] = credit_code.charCodeAt(i);
}
if(!checkDKK(financeCode)){
Leaf.showMessage('提示', '中征码错误');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}else {
return true;
}
}else {
Leaf.showMessage('提示', '请输入16位中征码');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
}
} else if(value == '220'&&record.get('associate_id_no')){
//护照
var soc_code =record.get('associate_id_no');
if (soc_code) {
if (!CheckSocialCreditCode(soc_code)) {
Leaf.showMessage('提示', '统一社会信用代码有误,请重新输入!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
// window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return false;
}
}
}
}
if (name == 'associate_id_no'&&value) {
if (record.get('id_type') == '110') {
if (!checkCard(value)) {
Leaf.showMessage('${l:HLS.PROMPT}', '个人身份证号错误!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
} else {
if (value.length == 18) {
record.set('date_of_birth', new Date(value.substr(6, 4) + '/' + value.substr(10, 2) + '/' + value.substr(12, 2)));
record.set('age', new Date().getFullYear() - value.substr(6, 4));
if (value.substr(16, 1) % 2 == 1) {
record.set('gender', 'MALE');
record.set('gender_n', '男');
} else if (value.substr(16, 1) % 2 == 0) {
record.set('gender', 'FEMALE');
record.set('gender_n', '女');
}
}
}
}else if(record.get('id_type') == '140'){
//护照
if (!Leaf.isEmpty(value)) {
value = value.trim();
value = value.replace(/[\t\r\f\n\s]*/g,"");
var sub_no=value.substring(0,3);
if(!(/^[A-Z]{3}/).test(sub_no)){
Leaf.showMessage('提示', '护照证件号码格式前三位需为国籍代码!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
if(!(/^[A-Z]{3}.{0,9}$/).test(value)){
Leaf.showMessage('提示', '护照格式错误');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
}
}else if(record.get('id_type') == '210'&&value){
//护照
var credit_code =record.get('associate_id_no');
if (!Leaf.isEmpty(value)) {
value = value.trim();
value = value.replace(/[\t\r\f\n\s]*/g,"");
if (value.length == '16'){
let financeCode = new Array(16);
for (let i = 0; i < value.length && i < 16; i++) {
financeCode[i] = value.charCodeAt(i);
}
if(!checkDKK(financeCode)){
Leaf.showMessage('提示', '中征码错误');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}else {
return true;
}
}else {
Leaf.showMessage('提示', '请输入16位中征码');
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
return false;
}
}
} else if(record.get('id_type') == '220'&&value){
//护照
var soc_code =record.get('associate_id_no');
if (value) {
if (!CheckSocialCreditCode(value)) {
Leaf.showMessage('提示', '统一社会信用代码有误,请重新输入!');
setTimeout(function () {
record.set('associate_id_no', '');
}, 20);
// window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return false;
}
}
}
} }
} }
......
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