|
|
|
|
@ -859,14 +859,24 @@ export default {
|
|
|
|
|
idcard: {
|
|
|
|
|
rules: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
errorMessage:
|
|
|
|
|
"身份证号码不能为空 / ID card number cannot be empty",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
pattern:
|
|
|
|
|
"^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]",
|
|
|
|
|
errorMessage: "身份证格式错误 / Invalid ID card format",
|
|
|
|
|
// 主访客身份证:统一改为“非必填,填了就校验格式”
|
|
|
|
|
validateFunction: (rule, value, data, callback) => {
|
|
|
|
|
const pattern =
|
|
|
|
|
/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
|
|
|
|
|
if (!value) {
|
|
|
|
|
callback();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!pattern.test(value)) {
|
|
|
|
|
callback(
|
|
|
|
|
new Error(
|
|
|
|
|
"身份证格式错误 / Invalid ID card format"
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
callback();
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
@ -961,14 +971,24 @@ export default {
|
|
|
|
|
idcard: {
|
|
|
|
|
rules: [
|
|
|
|
|
{
|
|
|
|
|
required: true,
|
|
|
|
|
errorMessage:
|
|
|
|
|
"身份证号码不能为空 / ID card number cannot be empty",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
pattern:
|
|
|
|
|
"^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]",
|
|
|
|
|
errorMessage: "身份证格式错误 / Invalid ID card format",
|
|
|
|
|
validateFunction: (rule, value, data, callback) => {
|
|
|
|
|
const pattern =
|
|
|
|
|
/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
|
|
|
|
|
// 随访人身份证:非必填,填了才校验格式
|
|
|
|
|
if (!value) {
|
|
|
|
|
callback();
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!pattern.test(value)) {
|
|
|
|
|
callback(
|
|
|
|
|
new Error(
|
|
|
|
|
"身份证格式错误 / Invalid ID card format"
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
callback();
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
@ -1389,6 +1409,20 @@ export default {
|
|
|
|
|
if (this.follw_people_obj.credent == 2) {
|
|
|
|
|
this.follw_people_obj.idcard = this.follw_people_obj.passcard;
|
|
|
|
|
}
|
|
|
|
|
// 随访人员:如选择身份证(credent == 1),填写了身份证则先做准确性校验
|
|
|
|
|
if (
|
|
|
|
|
this.follw_people_obj.credent == 1 &&
|
|
|
|
|
this.follw_people_obj.idcard
|
|
|
|
|
) {
|
|
|
|
|
const pattern =
|
|
|
|
|
/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
|
|
|
|
|
if (!pattern.test(this.follw_people_obj.idcard)) {
|
|
|
|
|
this.util.alert(
|
|
|
|
|
"身份证格式错误 / Invalid ID card format"
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
this.$refs["peopleform"]
|
|
|
|
|
.validate()
|
|
|
|
|
.then((res) => {
|
|
|
|
|
@ -1459,6 +1493,26 @@ export default {
|
|
|
|
|
this.form.date = this.form.start_date;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 使用身份证(credent=1) 且填写了证件号时,先做一次格式校验(普通访客/施工/物流均生效)
|
|
|
|
|
if (this.form.credent == 1 && this.form.idcard) {
|
|
|
|
|
const pattern =
|
|
|
|
|
/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
|
|
|
|
|
if (!pattern.test(this.form.idcard)) {
|
|
|
|
|
this.util.alert(
|
|
|
|
|
"身份证格式错误 / Invalid ID card format"
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 施工(type=2) / 物流(type=3) 且使用身份证(credent=1) 时,身份证必须填写
|
|
|
|
|
if (this.form.type != 1 && this.form.credent == 1 && !this.form.idcard) {
|
|
|
|
|
this.util.alert(
|
|
|
|
|
"身份证号码不能为空 / ID card number cannot be empty"
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.$refs["formdata"]
|
|
|
|
|
.validate()
|
|
|
|
|
.then(() => {
|
|
|
|
|
@ -1525,6 +1579,26 @@ export default {
|
|
|
|
|
this.form.date = this.form.start_date;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 使用身份证(credent=1) 且填写了证件号时,先做一次格式校验(普通访客/施工/物流均生效)
|
|
|
|
|
if (this.form.credent == 1 && this.form.idcard) {
|
|
|
|
|
const pattern =
|
|
|
|
|
/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/;
|
|
|
|
|
if (!pattern.test(this.form.idcard)) {
|
|
|
|
|
this.util.alert(
|
|
|
|
|
"身份证格式错误 / Invalid ID card format"
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 施工(type=2) / 物流(type=3) 且使用身份证(credent=1) 时,身份证必须填写
|
|
|
|
|
if (this.form.type != 1 && this.form.credent == 1 && !this.form.idcard) {
|
|
|
|
|
this.util.alert(
|
|
|
|
|
"身份证号码不能为空 / ID card number cannot be empty"
|
|
|
|
|
);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.$refs["formdata"]
|
|
|
|
|
.validate()
|
|
|
|
|
.then((res) => {
|
|
|
|
|
|