mirror of
http://112.124.100.131/GFRS/ebiz-h5.git
synced 2025-12-13 21:16:44 +08:00
【入司优化】---性别与家庭关系 身份证号校验
This commit is contained in:
@@ -375,6 +375,10 @@ export default {
|
||||
this.$validator.validate().then(valid => {
|
||||
if (true === valid) {
|
||||
this.userInfo.map(item => {
|
||||
//0 男 1 女 relationType:0 配偶 1 父亲 2 母亲
|
||||
if ((item.sex != 1 && item.relationType == 2) || (item.sex != 0 && item.relationType != 1)) {
|
||||
return this.$toast('性别录入与家庭关系不符')
|
||||
}
|
||||
if (item.idType == '1') {
|
||||
//身份证
|
||||
console.log('证件类型是身份证');
|
||||
@@ -384,6 +388,22 @@ export default {
|
||||
} else {
|
||||
this.idCardFlag = true;
|
||||
}
|
||||
if (this.userInfo.idNo.length == '18') {
|
||||
//18位身份证第17位是性别位, 奇男偶女
|
||||
let sexSign = item.idNo.substr(16, 1)
|
||||
if ((parseInt(sexSign) % 2 == 0 && item.sex != 1) || (parseInt(sexSign) % 2 != 0 && item.sex != 0)) {
|
||||
return this.$toast('性别录入与身份证不符')
|
||||
}
|
||||
//18位身份证第7-14位是生日位, 年月日
|
||||
let birthSign = item.idNo.substr(6, 8)
|
||||
if (
|
||||
item.birthday.substr(0, 4) != birthSign.substr(0, 4) ||
|
||||
item.birthday.substr(5, 2) != birthSign.substr(4, 2) ||
|
||||
item.birthday.substr(8, 2) != birthSign.substr(6, 2)
|
||||
) {
|
||||
return this.$toast('生日录入与身份证不符')
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// 循环存储勾选了‘无此亲属关系’选项的数组,给‘userInfo’的集合所对应的对象中添加一个新的字段,用于回显勾选了‘无此亲属关系’的选项
|
||||
@@ -500,7 +520,7 @@ export default {
|
||||
}
|
||||
//如果证件校验不通过,恢复默认值
|
||||
if (idToData(val.idNo).text) {
|
||||
//;[val.idNo, val.birthday] = ['', '']
|
||||
;[val.idNo, val.birthday] = ['', '']
|
||||
return this.$toast(idToData(val.idNo).text)
|
||||
}
|
||||
val.birthday = idToData(val.idNo).birthday
|
||||
|
||||
Reference in New Issue
Block a user