如果家属角色为配偶,选择性别出现一致时,提示配偶与本人性别不可一致。

This commit is contained in:
liyuetong
2021-08-25 16:23:10 +08:00
parent bac3218e48
commit c29096bd6a

View File

@@ -154,19 +154,20 @@ export default {
{
relationType: '', // 关系
name: '', // 姓名
sex: '0', // 性别(枚举值)
sex: '', // 性别(枚举值)
idType: '', // 证件类型(枚举值)
idNo: '', // 证件号码
birthday: '', // 出生日期
mobile: '' // 联系方式
}
],
//默认值,父亲性别默认男,母亲性别默认值女,配偶、子女性别默认不选中
// 定义当用户基本信息中婚姻状态选择的是已婚的情况时的数据格式
userInfoMarried: [
{
relationType: '0',
name: '',
sex: '0',
sex: '',
idType: '',
idNo: '',
birthday: '',
@@ -186,7 +187,7 @@ export default {
{
relationType: '2',
name: '',
sex: '0',
sex: '1',
idType: '',
idNo: '',
birthday: '',
@@ -196,7 +197,7 @@ export default {
{
relationType: '3',
name: '',
sex: '0',
sex: '',
idType: '',
idNo: '',
birthday: '',
@@ -219,7 +220,7 @@ export default {
{
relationType: '2',
name: '',
sex: '0',
sex: '1',
idType: '',
idNo: '',
birthday: '',
@@ -229,7 +230,7 @@ export default {
{
relationType: '3',
name: '',
sex: '0',
sex: '',
idType: '',
idNo: '',
birthday: '',
@@ -257,7 +258,8 @@ export default {
gtFlag2: true,
currentTime: beforeDate.getBeforeDays(1),
checkedRelationshipList: [], // 定义一个数组集合,储存当前是哪个对象勾选了‘无此亲属关系’选项
sexDisabled:false
sexDisabled:false,
ebizEnterCustomerDto:{} //本人信息
};
},
mounted() {
@@ -302,7 +304,7 @@ export default {
if (res.result == '0') {
localStorage.removeItem('marriageEnumInfo');
localStorage.setItem('marriageEnumInfo', res.content.ebizEnterCustomerDto.marriage);
this.ebizEnterCustomerDto = res.content.ebizEnterCustomerDto
if (res.content.ebizRelationDtoLst.length != 0) {
let result = res.content.ebizRelationDtoLst;
if (result) {
@@ -374,10 +376,21 @@ export default {
//表单校验, 成功跳转
this.$validator.validate().then(valid => {
if (true === valid) {
this.userInfo.map(item => {
for(let i = 0; i < this.userInfo.length; i ++) {
let item = this.userInfo[i]
//在家属信息页面录入后,点击【下一步】做提示,如果家属角色为父亲,选择性别为女,则提示“父亲性别不可为女”,母亲同此规则
//0 男 1 女 relationType:0 配偶 1 父亲 2 母亲
if ((item.sex != 1 && item.relationType == 2) || (item.sex != 0 && item.relationType == 1)) {
return this.$toast(item.name+'性别录入与家庭关系不符')
if (item.sex == 1 && item.relationType == 1) {
return this.$toast('父亲性别不可为女')
}
if (item.sex == 0 && item.relationType == 2) {
return this.$toast('母亲性别不可为男')
}
//如果家属角色为配偶,选择性别出现一致时,提示“配偶与本人性别不可一致。”
if (item.relationType == 0) {
if(item.sex == this.ebizEnterCustomerDto.sex){
return this.$toast('配偶与本人性别不可一致。')
}
}
if (item.idType == '1') {
//身份证
@@ -390,9 +403,10 @@ export default {
}
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(item.name+'性别录入与身份证不符')
return this.$toast(item.name+'性别与证件性别不一致,请修改。')
}
//18位身份证第7-14位是生日位, 年月日
let birthSign = item.idNo.substr(6, 8)
@@ -405,7 +419,7 @@ export default {
}
}
}
});
}
// 循环存储勾选了无此亲属关系选项的数组userInfo的集合所对应的对象中添加一个新的字段用于回显勾选了无此亲属关系的选项
this.checkedRelationshipList.forEach(item => {
this.userInfo[item].checkedIndex = item;