From 8c06f3336a4617ba125d4c2861c90a0093e3193d Mon Sep 17 00:00:00 2001 From: wangyx <2838268875@qq.com> Date: Fri, 18 Jul 2025 09:15:43 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=80=E6=88=BF=E6=A3=80=E6=9F=A5=E5=BF=85?= =?UTF-8?q?=E5=A1=AB=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagesA/checkout/detail/detail.vue | 50 ++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 14 deletions(-) diff --git a/pagesA/checkout/detail/detail.vue b/pagesA/checkout/detail/detail.vue index 173ef4e..fb83f57 100644 --- a/pagesA/checkout/detail/detail.vue +++ b/pagesA/checkout/detail/detail.vue @@ -159,20 +159,7 @@ export default { ], waterMeterValue: "", energyMeterValue: "", - checkStatus: [ - { - label: "完好", - value: "0", - }, - { - label: "破损", - value: "1", - }, - { - label: "丢失", - value: "2", - }, - ], + checkStatus: [], remark: "", fileList: [], img1: [], @@ -197,6 +184,8 @@ export default { getFacilities(id) { getRoomFacilities({ houseId: id }).then((res) => { this.deviceList = res.data; + // 初始化每个设备的状态为“完好” + this.checkStatus = this.deviceList.map(() => "0"); }); }, onDeviceChange(idx, val) { @@ -280,6 +269,39 @@ export default { }); }, onSubmit() { + // 校验设备检查是否全部完成 + const uncheckedDevices = this.deviceList.filter((item, index) => { + return this.checkStatus[index] === undefined || this.checkStatus[index] === ''; + }); + + if (uncheckedDevices.length > 0) { + uni.showToast({ + title: '请完成所有设备检查', + icon: 'none', + duration: 2000 + }); + return; + } + + // 校验水电表是否填写 + if (!this.waterMeterValue || this.waterMeterValue.trim() === '') { + uni.showToast({ + title: '请输入水表数', + icon: 'none', + duration: 2000 + }); + return; + } + + if (!this.energyMeterValue || this.energyMeterValue.trim() === '') { + uni.showToast({ + title: '请输入电表数', + icon: 'none', + duration: 2000 + }); + return; + } + const facilitiesCheckResults = this.deviceList.map((item, index) => ({ facilityId: item.id, checkResult: this.checkStatus[index],