【入司优化】---性别校验

This commit is contained in:
dwq
2021-08-25 12:00:13 +08:00
parent 78f8d09516
commit f7eb0f18b7

View File

@@ -377,7 +377,7 @@ export default {
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('性别录入与家庭关系不符')
return this.$toast(item.name+'性别录入与家庭关系不符')
}
if (item.idType == '1') {
//身份证
@@ -388,11 +388,11 @@ export default {
} else {
this.idCardFlag = true;
}
if (this.userInfo.idNo.length == '18') {
if (item.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('性别录入与身份证不符')
return this.$toast(item.name+'性别录入与身份证不符')
}
//18位身份证第7-14位是生日位, 年月日
let birthSign = item.idNo.substr(6, 8)
@@ -401,7 +401,7 @@ export default {
item.birthday.substr(5, 2) != birthSign.substr(4, 2) ||
item.birthday.substr(8, 2) != birthSign.substr(6, 2)
) {
return this.$toast('生日录入与身份证不符')
return this.$toast(item.name+'生日录入与身份证不符')
}
}
}