Browse Source

退房检查必填校验

fenbao
wangyx 4 months ago
parent
commit
8c06f3336a
  1. 50
      pagesA/checkout/detail/detail.vue

50
pagesA/checkout/detail/detail.vue

@ -159,20 +159,7 @@ export default {
], ],
waterMeterValue: "", waterMeterValue: "",
energyMeterValue: "", energyMeterValue: "",
checkStatus: [ checkStatus: [],
{
label: "完好",
value: "0",
},
{
label: "破损",
value: "1",
},
{
label: "丢失",
value: "2",
},
],
remark: "", remark: "",
fileList: [], fileList: [],
img1: [], img1: [],
@ -197,6 +184,8 @@ export default {
getFacilities(id) { getFacilities(id) {
getRoomFacilities({ houseId: id }).then((res) => { getRoomFacilities({ houseId: id }).then((res) => {
this.deviceList = res.data; this.deviceList = res.data;
//
this.checkStatus = this.deviceList.map(() => "0");
}); });
}, },
onDeviceChange(idx, val) { onDeviceChange(idx, val) {
@ -280,6 +269,39 @@ export default {
}); });
}, },
onSubmit() { 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) => ({ const facilitiesCheckResults = this.deviceList.map((item, index) => ({
facilityId: item.id, facilityId: item.id,
checkResult: this.checkStatus[index], checkResult: this.checkStatus[index],

Loading…
Cancel
Save