diff --git a/acupuncture-前台/src/views/screening/h5eva.vue b/acupuncture-前台/src/views/screening/h5eva.vue index 09c754dc..e2f628c8 100644 --- a/acupuncture-前台/src/views/screening/h5eva.vue +++ b/acupuncture-前台/src/views/screening/h5eva.vue @@ -317,6 +317,18 @@ import { export default { name: "Notice", data() { + var numberValidator = (rule, value, callback) => { + // 年龄范围需要在18-65岁之间 + if (!value) { + callback(new Error("年龄不能为空")); + return; + } + if (value < 18 || value > 65) { + callback(new Error("年龄范围需要在18-65岁之间")); + } else { + callback(); + } + }; return { popupRadio: 1, open: false, @@ -567,7 +579,7 @@ export default { "SCWJ-AGE": [ { required: true, - message: "年龄不能为空", + validator: numberValidator, trigger: ["blur", "change"], }, ], @@ -656,7 +668,10 @@ export default { // 编辑信息 handlePopupVerify() { if (this.popupRadio === 1) { - this.form = { ...this.form, ...this.detailList }; + this.form = { + ...this.form, + ...JSON.parse(JSON.stringify(this.detailList)), + }; setTimeout(() => { this.open = false; }, 500); @@ -679,11 +694,10 @@ export default { if (name && phone && /^1[3456789]\d{9}$/.test(phone)) { queryDetailNoToken({ param: { name: name, phone: phone } }).then( (res) => { - this.detailList = {}; if (res.data.list.length) { + this.detailList = {}; let data = res.data.list[0]; this.detailId = data.id; - console.log("this.detailId", this.detailId); data.detailList.forEach((item) => { this.detailList[item.questionCode] = item.answer; }); @@ -955,6 +969,11 @@ export default { await this.saveAnswer(this.tips, "SCREEN-JL"); // ------ 提交筛查 ------ const submitParams = { param: { detailId: this.detailId } }; + // 判断对象是否为空 this.detailList + if (Object.keys(this.detailList).length !== 0) { + submitParams.param.phone = this.detailList["SCWJ-PHONE"]; + submitParams.param.name = this.detailList["SCWJ-NAME"]; + } await screenSubmit(submitParams).then((response) => { this.loading = false; this.disabled = false;