|
|
|
@ -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], |
|
|
|
|