master
lion 2 months ago
parent 6fb402184d
commit eec33547cf

@ -859,14 +859,24 @@ export default {
idcard: { idcard: {
rules: [ rules: [
{ {
required: true, // 访
errorMessage: validateFunction: (rule, value, data, callback) => {
"身份证号码不能为空 / ID card number cannot be empty", 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) {
pattern: callback();
"^[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]", return;
errorMessage: "身份证格式错误 / Invalid ID card format", }
if (!pattern.test(value)) {
callback(
new Error(
"身份证格式错误 / Invalid ID card format"
)
);
return;
}
callback();
},
}, },
], ],
}, },
@ -961,14 +971,24 @@ export default {
idcard: { idcard: {
rules: [ rules: [
{ {
required: true, validateFunction: (rule, value, data, callback) => {
errorMessage: const pattern =
"身份证号码不能为空 / ID card number cannot be empty", /^[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) {
pattern: callback();
"^[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]", return;
errorMessage: "身份证格式错误 / Invalid ID card format", }
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) { if (this.follw_people_obj.credent == 2) {
this.follw_people_obj.idcard = this.follw_people_obj.passcard; 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"] this.$refs["peopleform"]
.validate() .validate()
.then((res) => { .then((res) => {
@ -1459,6 +1493,26 @@ export default {
this.form.date = this.form.start_date; 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"] this.$refs["formdata"]
.validate() .validate()
.then(() => { .then(() => {
@ -1525,6 +1579,26 @@ export default {
this.form.date = this.form.start_date; 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"] this.$refs["formdata"]
.validate() .validate()
.then((res) => { .then((res) => {

Loading…
Cancel
Save