From 3a317252db7533224246926952fbff61289881c7 Mon Sep 17 00:00:00 2001 From: "1747191978@qq.com" <1942943850@qq.com> Date: Mon, 14 Apr 2025 18:00:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=AD=9B=E6=9F=A5=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=8F=90=E4=BA=A4=E6=8E=A5=E5=8F=A3=E4=BC=A0=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=89=8D=E7=9A=84=E6=89=8B=E6=9C=BA=E5=8F=B7=E5=92=8C?= =?UTF-8?q?=E5=A7=93=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/screening/h5eva.vue | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) 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;