|
|
@ -1,28 +1,47 @@ |
|
|
|
<template> |
|
|
|
<view class="page-content sfReport"> |
|
|
|
<view class="bg-box"> |
|
|
|
<view class="bg-text"> |
|
|
|
<view class="bg-text"> |
|
|
|
<view>填写信息</view> |
|
|
|
<view>请您填写相关问题</view> |
|
|
|
</view> |
|
|
|
<image class="bg-img" src="/static/img/bsorbxBac.png" mode="aspectFill"></image> |
|
|
|
</view> |
|
|
|
<image |
|
|
|
class="bg-img" |
|
|
|
src="/static/img/bsorbxBac.png" |
|
|
|
mode="aspectFill" |
|
|
|
></image> |
|
|
|
</view> |
|
|
|
<view class="info-card"> |
|
|
|
<view class="meter-row"> |
|
|
|
<view class="meter-label"> |
|
|
|
<view style="color: #f93838;margin-right: 4rpx;font-size: 24rpx;">*</view> |
|
|
|
<view style="color: #f93838; margin-right: 4rpx; font-size: 24rpx" |
|
|
|
>*</view |
|
|
|
> |
|
|
|
<text>乐业社区</text> |
|
|
|
</view> |
|
|
|
<view class="picker-label"> |
|
|
|
<picker mode="selector" :range="deptNames" @change="onPickerChange($event,'乐业社区')"> |
|
|
|
<view :style="{'color':!form.apartmentName?'#cbcbcb':''}">{{form.apartmentName || pickerPlaceholder}}</view> |
|
|
|
<picker |
|
|
|
mode="selector" |
|
|
|
:range="deptNames" |
|
|
|
@change="onPickerChange($event, '乐业社区')" |
|
|
|
> |
|
|
|
<view |
|
|
|
:style="{ color: !blockForm.apartmentName ? '#cbcbcb' : '' }" |
|
|
|
>{{ blockForm.apartmentName || pickerPlaceholder }}</view |
|
|
|
> |
|
|
|
</picker> |
|
|
|
<image class="arrow-r" src="/static/img/arrow-right.png" mode="aspectFill"></image> |
|
|
|
<image |
|
|
|
class="arrow-r" |
|
|
|
src="/static/img/arrow-right.png" |
|
|
|
mode="aspectFill" |
|
|
|
></image> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="meter-row"> |
|
|
|
<view class="meter-label"> |
|
|
|
<view style="color: #f93838;margin-right: 4rpx;font-size: 24rpx;">*</view> |
|
|
|
<view style="color: #f93838; margin-right: 4rpx; font-size: 24rpx" |
|
|
|
>*</view |
|
|
|
> |
|
|
|
<text>房屋</text> |
|
|
|
</view> |
|
|
|
<view class="picker-label"> |
|
|
@ -42,53 +61,84 @@ |
|
|
|
}}</view> |
|
|
|
</picker> |
|
|
|
</view> |
|
|
|
<view v-else @click="handleShowToast" style="color:#cbcbcb">请选择社区</view> |
|
|
|
<image class="arrow-r" src="/static/img/arrow-right.png" mode="aspectFill"></image> |
|
|
|
<view v-else @click="handleShowToast" style="color: #cbcbcb" |
|
|
|
>请选择社区</view |
|
|
|
> |
|
|
|
<image |
|
|
|
class="arrow-r" |
|
|
|
src="/static/img/arrow-right.png" |
|
|
|
mode="aspectFill" |
|
|
|
></image> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<scroll-view class="house-view" scroll-y="true"> |
|
|
|
<view class="section-card" v-for="(item,index) in form.waterMeters" :key="item.id"> |
|
|
|
<view class="section-card" v-for="(item, index) in form" :key="index"> |
|
|
|
<view class="meter-row"> |
|
|
|
<text class="meter-label">水表号</text> |
|
|
|
<view class="meter-label"> |
|
|
|
<view style="color: #f93838; margin-right: 4rpx; font-size: 24rpx" |
|
|
|
>*</view |
|
|
|
> |
|
|
|
<text>水表号</text> |
|
|
|
</view> |
|
|
|
<u-input |
|
|
|
v-model="item.meterNumber" |
|
|
|
v-model="item.waterMeterNumber" |
|
|
|
type="digit" |
|
|
|
placeholder="请输入水表号" |
|
|
|
border="none" |
|
|
|
:disabled="!!item.meterNumber" |
|
|
|
:custom-style="item.meterNumber ? 'background:#fff;color:#bbb;' : ''" |
|
|
|
:disabled="!!item.waterMeterNumber" |
|
|
|
:custom-style=" |
|
|
|
item.waterMeterNumber ? 'background:#fff;color:#bbb;' : '' |
|
|
|
" |
|
|
|
/> |
|
|
|
</view> |
|
|
|
<view class="meter-row"> |
|
|
|
<text class="meter-label">上次表数</text> |
|
|
|
<view class="meter-label"> |
|
|
|
<view style="color: #f93838; margin-right: 4rpx; font-size: 24rpx" |
|
|
|
>*</view |
|
|
|
> |
|
|
|
<text>上次表数</text> |
|
|
|
</view> |
|
|
|
<u-input |
|
|
|
v-model="item.lastMeterReading" |
|
|
|
v-model="form[index].lastMeterReading" |
|
|
|
type="digit" |
|
|
|
placeholder="请输入上次表数" |
|
|
|
border="none" |
|
|
|
:disabled="!!item.lastMeterReading" |
|
|
|
:custom-style="item.lastMeterReading ? 'background:#fff;color:#bbb;' : ''" |
|
|
|
:custom-style=" |
|
|
|
form[index].electricMeterNumber |
|
|
|
? 'background:#fff;color:#bbb;' |
|
|
|
: '' |
|
|
|
" |
|
|
|
/> |
|
|
|
</view> |
|
|
|
<view class="meter-row"> |
|
|
|
<text class="meter-label">本次表数</text> |
|
|
|
<view class="meter-label"> |
|
|
|
<view style="color: #f93838; margin-right: 4rpx; font-size: 24rpx" |
|
|
|
>*</view |
|
|
|
> |
|
|
|
<text>本次表数</text> |
|
|
|
</view> |
|
|
|
<u-input |
|
|
|
v-model="item.thisMeterReading" |
|
|
|
v-model="form[index].thisMeterReading" |
|
|
|
type="digit" |
|
|
|
placeholder="请输入本次表数" |
|
|
|
border="none" |
|
|
|
/> |
|
|
|
</view> |
|
|
|
<view class="imeter-row"> |
|
|
|
<text class="meter-label">上传图片/视频</text> |
|
|
|
<view class="meter-label"> |
|
|
|
<view style="color: #f93838; margin-right: 4rpx; font-size: 24rpx" |
|
|
|
>*</view |
|
|
|
> |
|
|
|
<text>图片/视频</text> |
|
|
|
</view> |
|
|
|
<u-upload |
|
|
|
:max-count="10" |
|
|
|
:multiple="true" |
|
|
|
:preview-full-image="true" |
|
|
|
:deletable="true" |
|
|
|
:show-upload-list="true" |
|
|
|
:fileList="item.fileList || []" |
|
|
|
:fileList="form[index].fileList || []" |
|
|
|
:auto-upload="false" |
|
|
|
accept="all" |
|
|
|
:maxSize="10 * 1024 * 1024" |
|
|
@ -100,7 +150,11 @@ |
|
|
|
@click.stop="() => chooseMedia(index)" |
|
|
|
> |
|
|
|
<view class="icon-box"> |
|
|
|
<image class="camera-icon" src="/static/img/camera-icon.png" mode="aspectFill"></image> |
|
|
|
<image |
|
|
|
class="camera-icon" |
|
|
|
src="/static/img/camera-icon.png" |
|
|
|
mode="aspectFill" |
|
|
|
></image> |
|
|
|
</view> |
|
|
|
<view class="upload-tips">点击上传</view> |
|
|
|
</view> |
|
|
@ -109,57 +163,60 @@ |
|
|
|
</view> |
|
|
|
</scroll-view> |
|
|
|
<!-- 提交按钮 --> |
|
|
|
<view class="btn" @click="onSubmit">提交</view> |
|
|
|
<view class="btn" @click="onSubmit">提交</view> |
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
|
<script> |
|
|
|
|
|
|
|
import { |
|
|
|
queryDeptDropdownList, |
|
|
|
} from "@/common/rec"; |
|
|
|
import { getdeptList } from '@/common/api'; |
|
|
|
import { queryDeptDropdownList } from "@/common/rec"; |
|
|
|
import { getdeptList } from "@/common/api"; |
|
|
|
import { |
|
|
|
uploadImage, |
|
|
|
queryLastMeterReading, |
|
|
|
submitWaterAndElectricity |
|
|
|
} from '@/pages/api'; |
|
|
|
submitWaterAndElectricity, |
|
|
|
getRoomByHouseId, |
|
|
|
getHouseInfo, |
|
|
|
} from "@/pages/api"; |
|
|
|
|
|
|
|
export default { |
|
|
|
data() { |
|
|
|
return { |
|
|
|
pickerPlaceholder: '请选择', // 初始显示的文字 |
|
|
|
pickerPlaceholder: "请选择", // 初始显示的文字 |
|
|
|
waterMeter: 3245.1, |
|
|
|
electricMeter: 2672.6, |
|
|
|
remark: '', |
|
|
|
remark: "", |
|
|
|
fileList: [], |
|
|
|
deptNames: [], |
|
|
|
deptOptions: [], |
|
|
|
|
|
|
|
blockForm: {}, |
|
|
|
buildingOptions: [], |
|
|
|
unitOptions: [], |
|
|
|
houseOptions: [], |
|
|
|
multiArray: [[], [], []], |
|
|
|
multiIndex: [-1, -1, -1], |
|
|
|
form:{ |
|
|
|
apartmentId: '', |
|
|
|
apartmentName:'', |
|
|
|
buildingId: '', |
|
|
|
unitId: '', |
|
|
|
houseId: '', |
|
|
|
roomId: '', |
|
|
|
waterMeters: [], |
|
|
|
remark: '' |
|
|
|
}, |
|
|
|
} |
|
|
|
form: [ |
|
|
|
{ |
|
|
|
meterNumber: "", |
|
|
|
meterType: 2, // 1:电表 2:水表 |
|
|
|
houseId: "", // 初始化时可为空,选择房屋后赋值 |
|
|
|
roomId: "", |
|
|
|
lastMeterReading: "", |
|
|
|
thisMeterReading: "", |
|
|
|
fileList: [], |
|
|
|
remark: "", |
|
|
|
waterMeterNumber: "", |
|
|
|
}, |
|
|
|
], // |
|
|
|
waterMeterConfig: "", |
|
|
|
}; |
|
|
|
}, |
|
|
|
watch: { |
|
|
|
"form.apartmentId": { |
|
|
|
"blockForm.apartmentId": { |
|
|
|
handler(newVal, oldVal) { |
|
|
|
console.log("newVal", newVal); |
|
|
|
this.form.buildingId = null; |
|
|
|
this.form.unitId = null; |
|
|
|
this.form.houseId = null; |
|
|
|
this.blockForm.buildingId = null; |
|
|
|
this.blockForm.unitId = null; |
|
|
|
this.blockForm.houseId = null; |
|
|
|
this.buildingOptions = []; |
|
|
|
this.unitOptions = []; |
|
|
|
this.houseOptions = []; |
|
|
@ -168,11 +225,11 @@ export default { |
|
|
|
immediate: true, |
|
|
|
}, |
|
|
|
}, |
|
|
|
onLoad () { |
|
|
|
this.getTree() |
|
|
|
onLoad() { |
|
|
|
this.getTree(); |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
getTree(){ |
|
|
|
getTree() { |
|
|
|
getdeptList().then(async (res) => { |
|
|
|
this.deptOptions = this.handleTree( |
|
|
|
res.data, |
|
|
@ -209,8 +266,8 @@ export default { |
|
|
|
console.log("社区信息", apartmentInfo); |
|
|
|
console.log("社区信息11", this.deptOptions); |
|
|
|
|
|
|
|
this.form.apartmentName = apartmentInfo.deptName; |
|
|
|
this.form.apartmentId = apartmentInfo.deptId; |
|
|
|
this.blockForm.apartmentName = apartmentInfo.deptName; |
|
|
|
this.blockForm.apartmentId = apartmentInfo.deptId; |
|
|
|
// 楼 |
|
|
|
const buildingArray = await this.getListByParentId( |
|
|
|
"2", |
|
|
@ -221,7 +278,7 @@ export default { |
|
|
|
const buildingNames = buildingArray.map((item) => item.name); |
|
|
|
console.log("buildingNames:", buildingNames); |
|
|
|
|
|
|
|
this.form.buildingId = buildingArray[0].id; |
|
|
|
this.blockForm.buildingId = buildingArray[0].id; |
|
|
|
// 单元 |
|
|
|
const unitArray = await this.getListByParentId( |
|
|
|
"3", |
|
|
@ -231,13 +288,21 @@ export default { |
|
|
|
console.log("unitArray:", unitArray); |
|
|
|
|
|
|
|
const unitNames = unitArray.map((item) => item.name); |
|
|
|
this.form.unitId = unitArray[0].id; |
|
|
|
this.blockForm.unitId = unitArray[0].id; |
|
|
|
// 户 |
|
|
|
const houseArray = await this.getListByParentId("4", unitArray[0].id); |
|
|
|
this.houseOptions = houseArray; |
|
|
|
const houseNames = houseArray.map((item) => item.name); |
|
|
|
this.form.houseId = houseArray[0].id; |
|
|
|
this.form.roomId = houseArray[0].roomId; |
|
|
|
this.blockForm.houseId = houseArray[0].id; |
|
|
|
this.energyMeterConfig = houseArray[0].energyMeterConfig; |
|
|
|
this.waterMeterConfig = houseArray[0].waterMeterConfig; |
|
|
|
if (this.energyMeterConfig == 1) { |
|
|
|
this.getHouseInfoBy(this.blockForm.houseId); |
|
|
|
} else if (this.energyMeterConfig == 2) { |
|
|
|
this.getRoomByHouseId(this.blockForm.houseId); |
|
|
|
} |
|
|
|
this.getLastMeter(); |
|
|
|
this.blockForm.roomId = houseArray[0].roomId; |
|
|
|
let house = houseArray[0]; |
|
|
|
// for (let index = 0; index < house.type; index++) { |
|
|
|
// this.form.waterMeters.push({ |
|
|
@ -251,52 +316,64 @@ export default { |
|
|
|
this.multiArray = [buildingNames, unitNames, houseNames]; |
|
|
|
} |
|
|
|
}, |
|
|
|
handleShowToast(){ |
|
|
|
uni.showToast({ title: '请选择乐业社区', icon: 'none' }); |
|
|
|
handleShowToast() { |
|
|
|
uni.showToast({ title: "请选择乐业社区", icon: "none" }); |
|
|
|
}, |
|
|
|
async bindMultiPickerColumnChange (e) { |
|
|
|
if(!this.multiArray[0].length) return |
|
|
|
console.log('修改的列为:' + e.detail.column + ',值为:' + e.detail.value) |
|
|
|
this.multiIndex[e.detail.column] = e.detail.value |
|
|
|
async bindMultiPickerColumnChange(e) { |
|
|
|
if (!this.multiArray[0].length) return; |
|
|
|
this.multiIndex[e.detail.column] = e.detail.value; |
|
|
|
switch (e.detail.column) { |
|
|
|
case 0: { |
|
|
|
const unitArray = await this.getListByParentId("3", this.buildingOptions[e.detail.value].id); |
|
|
|
this.unitOptions = unitArray |
|
|
|
const unitNames = unitArray.map(item=> item.name) |
|
|
|
this.form.unitId = unitArray[0].id |
|
|
|
|
|
|
|
const houseArray = await this.getListByParentId("4", unitArray[0].id); |
|
|
|
this.houseOptions = houseArray |
|
|
|
const houseNames = houseArray.map(item=> item.name) |
|
|
|
this.form.houseId = houseArray[0].id |
|
|
|
this.form.roomId = houseArray[0].roomId |
|
|
|
|
|
|
|
this.multiArray[1] = unitNames |
|
|
|
this.multiArray[2] = houseNames |
|
|
|
|
|
|
|
}//拖动第1列 |
|
|
|
this.multiIndex.splice(1, 1, 0) |
|
|
|
this.multiIndex.splice(2, 1, 0) |
|
|
|
break |
|
|
|
case 1:{ |
|
|
|
const houseArray = await this.getListByParentId("4", this.unitOptions[e.detail.value].id); |
|
|
|
this.houseOptions = houseArray |
|
|
|
const houseNames = houseArray.map(item=> item.name) |
|
|
|
this.form.houseId = houseArray[0].id |
|
|
|
this.form.roomId = houseArray[0].roomId |
|
|
|
case 0: |
|
|
|
{ |
|
|
|
const unitArray = await this.getListByParentId( |
|
|
|
"3", |
|
|
|
this.buildingOptions[e.detail.value].id |
|
|
|
); |
|
|
|
this.unitOptions = unitArray; |
|
|
|
const unitNames = unitArray.map((item) => item.name); |
|
|
|
this.blockForm.unitId = unitArray[0].id; |
|
|
|
|
|
|
|
this.multiArray[2] = houseNames |
|
|
|
} //拖动第2列 |
|
|
|
this.multiIndex.splice(2, 1, 0) |
|
|
|
break |
|
|
|
case 2:{ |
|
|
|
this.form.houseId = this.houseOptions[e.detail.value].id |
|
|
|
this.form.roomId = this.houseOptions[e.detail.value].roomId |
|
|
|
console.log(this.houseOptions[e.detail.value]); |
|
|
|
const houseArray = await this.getListByParentId( |
|
|
|
"4", |
|
|
|
unitArray[0].id |
|
|
|
); |
|
|
|
this.houseOptions = houseArray; |
|
|
|
const houseNames = houseArray.map((item) => item.name); |
|
|
|
this.blockForm.houseId = houseArray[0].id; |
|
|
|
this.blockForm.roomId = houseArray[0].roomId; |
|
|
|
this.multiArray[1] = unitNames; |
|
|
|
this.multiArray[2] = houseNames; |
|
|
|
} |
|
|
|
this.multiIndex.splice(1, 1, 0); |
|
|
|
this.multiIndex.splice(2, 1, 0); |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
{ |
|
|
|
const houseArray = await this.getListByParentId( |
|
|
|
"4", |
|
|
|
this.unitOptions[e.detail.value].id |
|
|
|
); |
|
|
|
this.houseOptions = houseArray; |
|
|
|
const houseNames = houseArray.map((item) => item.name); |
|
|
|
this.blockForm.houseId = houseArray[0].id; |
|
|
|
this.blockForm.roomId = houseArray[0].roomId; |
|
|
|
this.multiArray[2] = houseNames; |
|
|
|
} |
|
|
|
this.multiIndex.splice(2, 1, 0); |
|
|
|
break; |
|
|
|
case 2: { |
|
|
|
this.blockForm.houseId = this.houseOptions[e.detail.value].id; |
|
|
|
this.blockForm.roomId = this.houseOptions[e.detail.value].roomId; |
|
|
|
this.waterMeterConfig = |
|
|
|
this.houseOptions[e.detail.value].waterMeterConfig; |
|
|
|
if (this.waterMeterConfig == 1) { |
|
|
|
this.getHouseInfoBy(this.blockForm.houseId); |
|
|
|
} else if (this.waterMeterConfig == 2) { |
|
|
|
this.getRoomByHouseId(this.blockForm.houseId); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.getLastMeter() |
|
|
|
this.$forceUpdate() |
|
|
|
this.$forceUpdate(); |
|
|
|
}, |
|
|
|
//图片超过大小时取消上传 |
|
|
|
oversize(e) { |
|
|
@ -304,11 +381,11 @@ export default { |
|
|
|
return false; |
|
|
|
}, |
|
|
|
chooseMedia(index) { |
|
|
|
if (!this.form.waterMeters[index].fileList) { |
|
|
|
this.$set(this.form.waterMeters[index], "fileList", []); |
|
|
|
if (!this.form[index].fileList) { |
|
|
|
this.$set(this.form[index], "fileList", []); |
|
|
|
} |
|
|
|
uni.chooseMedia({ |
|
|
|
count: 10 - this.form.waterMeters[index].fileList.length, |
|
|
|
count: 10 - this.form[index].fileList.length, |
|
|
|
mediaType: ["image", "video"], |
|
|
|
sourceType: ["album", "camera"], |
|
|
|
maxDuration: 60, |
|
|
@ -327,7 +404,7 @@ export default { |
|
|
|
: "image"); |
|
|
|
// 上传 |
|
|
|
const uploadRes = await uploadImage(filePath); |
|
|
|
this.form.waterMeters[index].fileList.push({ |
|
|
|
this.form[index].fileList.push({ |
|
|
|
url: uploadRes.data?.url || uploadRes.url || uploadRes.path, |
|
|
|
name: uploadRes.data?.name || uploadRes.name || "", |
|
|
|
type: type, |
|
|
@ -335,7 +412,9 @@ export default { |
|
|
|
}); |
|
|
|
} |
|
|
|
// 更新 imageList |
|
|
|
this.form.waterMeters[index].imageList = this.form.waterMeters[index].fileList.map((v) => v.url); |
|
|
|
this.form[index].imageList = this.form[index].fileList.map( |
|
|
|
(v) => v.url |
|
|
|
); |
|
|
|
} catch (e) { |
|
|
|
uni.showToast({ title: "上传失败", icon: "none" }); |
|
|
|
} finally { |
|
|
@ -347,72 +426,147 @@ export default { |
|
|
|
}, |
|
|
|
}); |
|
|
|
}, |
|
|
|
// 获取上次抄表 |
|
|
|
async getHouseInfoBy(id) { |
|
|
|
const res = await getHouseInfo(id); |
|
|
|
if (res.code == 200) { |
|
|
|
this.form = this.form.map((item) => ({ |
|
|
|
...item, |
|
|
|
waterMeterNumber: res.data.waterMeterNumber, |
|
|
|
})); |
|
|
|
} |
|
|
|
}, |
|
|
|
async getLastMeter() { |
|
|
|
const params = { |
|
|
|
houseId: this.form.houseId, |
|
|
|
roomId: this.form.roomId, |
|
|
|
meterType: 1, // 1是水表,2是电表 |
|
|
|
houseId: this.blockForm.houseId, |
|
|
|
roomId: this.blockForm.roomId, |
|
|
|
meterType: 2, // 2水表 |
|
|
|
meterNumber: "", |
|
|
|
}; |
|
|
|
const res = await queryLastMeterReading(params); |
|
|
|
if (Array.isArray(res.data) && res.data.length > 0) { |
|
|
|
this.form.waterMeters = res.data.map((item, idx) => ({ |
|
|
|
lastMeterReading: item.thisMeterReading, |
|
|
|
meterNumber: item.meterNumber, |
|
|
|
thisMeterReading: "", |
|
|
|
fileList: [], |
|
|
|
})); |
|
|
|
} else { |
|
|
|
// res.data 为空时,显示一个空表单 |
|
|
|
this.form.waterMeters = [ |
|
|
|
{ |
|
|
|
lastMeterReading: "", |
|
|
|
meterNumber: "", |
|
|
|
thisMeterReading: "", |
|
|
|
fileList: [], |
|
|
|
}, |
|
|
|
]; |
|
|
|
this.form = this.form.map((item) => { |
|
|
|
const meter = res.data.find( |
|
|
|
(m) => String(m.roomId) === String(item.id) |
|
|
|
); |
|
|
|
if (meter) { |
|
|
|
return { |
|
|
|
...item, |
|
|
|
lastMeterReading: meter.thisMeterReading, |
|
|
|
waterMeterNumber: meter.meterNumber, |
|
|
|
}; |
|
|
|
} |
|
|
|
return item; |
|
|
|
}); |
|
|
|
}, |
|
|
|
async getRoomByHouseId(id) { |
|
|
|
const res = await getRoomByHouseId({ houseId: id }); |
|
|
|
if (res.code == 200) { |
|
|
|
if (this.waterMeterConfig == 1) { |
|
|
|
this.form = [{}]; |
|
|
|
} else if (this.waterMeterConfig == 2) { |
|
|
|
this.form = res.data; |
|
|
|
} |
|
|
|
this.getLastMeter(); |
|
|
|
} |
|
|
|
}, |
|
|
|
onDelete(event, index) { |
|
|
|
if ( |
|
|
|
this.form.waterMeters[index] && |
|
|
|
Array.isArray(this.form.waterMeters[index].fileList) |
|
|
|
) { |
|
|
|
this.form.waterMeters[index].fileList.splice(event.index, 1); |
|
|
|
// 更新 imageList |
|
|
|
this.form.waterMeters[index].imageList = this.form.waterMeters[index].fileList.map((v) => v.url); |
|
|
|
if (this.form[index] && Array.isArray(this.form[index].fileList)) { |
|
|
|
this.form[index].fileList.splice(event.index, 1); |
|
|
|
// this.form.waterMeters[index].imageList = this.form.waterMeters[ |
|
|
|
// index |
|
|
|
// ].fileList.map((v) => v.url); |
|
|
|
} |
|
|
|
}, |
|
|
|
onSubmit() { |
|
|
|
let {buildingId, unitId, houseId} = this.form |
|
|
|
if(!this.form.apartmentName){ |
|
|
|
uni.showToast({ title: '请选择乐业社区', icon: 'none' }); |
|
|
|
return |
|
|
|
} else if(!buildingId && !unitId && !houseId){ |
|
|
|
uni.showToast({ title: '请选择房屋', icon: 'none' }); |
|
|
|
return |
|
|
|
let { buildingId, unitId, houseId } = this.blockForm; |
|
|
|
if (!this.blockForm.apartmentName) { |
|
|
|
uni.showToast({ title: "请选择乐业社区", icon: "none" }); |
|
|
|
return; |
|
|
|
} else if (!buildingId && !unitId && !houseId) { |
|
|
|
uni.showToast({ title: "请选择房屋", icon: "none" }); |
|
|
|
return; |
|
|
|
} |
|
|
|
// 必填校验:水表号、上次表数、本次表数、图片/视频 |
|
|
|
for (let i = 0; i < this.form.length; i++) { |
|
|
|
const item = this.form[i]; |
|
|
|
if (this.waterMeterConfig == 2) { |
|
|
|
if (!item.electricMeterNumber) { |
|
|
|
uni.showToast({ |
|
|
|
title: `第${i + 1}个房间请填写水表号`, |
|
|
|
icon: "none", |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
// if (!item.lastMeterReading && item.lastMeterReading !== 0) { |
|
|
|
// uni.showToast({ |
|
|
|
// title: `第${i + 1}个房间请填写上次表数`, |
|
|
|
// icon: "none", |
|
|
|
// }); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
if (!item.thisMeterReading && item.thisMeterReading !== 0) { |
|
|
|
uni.showToast({ |
|
|
|
title: `第${i + 1}个房间请填写本次表数`, |
|
|
|
icon: "none", |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!item.fileList || item.fileList.length === 0) { |
|
|
|
uni.showToast({ |
|
|
|
title: `第${i + 1}个房间请上传图片/视频`, |
|
|
|
icon: "none", |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
} else { |
|
|
|
// if (!item.electricMeterNumber) { |
|
|
|
// uni.showToast({ |
|
|
|
// title: `请填写水表号`, |
|
|
|
// icon: "none", |
|
|
|
// }); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
if (!item.lastMeterReading && item.lastMeterReading !== 0) { |
|
|
|
uni.showToast({ |
|
|
|
title: `请填写上次表数`, |
|
|
|
icon: "none", |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!item.thisMeterReading && item.thisMeterReading !== 0) { |
|
|
|
uni.showToast({ |
|
|
|
title: `请填写本次表数`, |
|
|
|
icon: "none", |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
if (!item.fileList || item.fileList.length === 0) { |
|
|
|
uni.showToast({ |
|
|
|
title: `请上传图片/视频`, |
|
|
|
icon: "none", |
|
|
|
}); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
this.submitAdd(); |
|
|
|
console.log('onSubmit',this.form); |
|
|
|
console.log("onSubmit", this.form); |
|
|
|
}, |
|
|
|
async submitAdd() { |
|
|
|
let params = []; |
|
|
|
this.form.waterMeters.forEach((item) => { |
|
|
|
params.push({ |
|
|
|
meterNumber: item.meterNumber, |
|
|
|
meterType: 1, // 1是水表,2是电表 |
|
|
|
houseId: this.form.houseId, |
|
|
|
roomId: this.form.roomId, |
|
|
|
lastMeterReading: item.lastMeterReading, |
|
|
|
thisMeterReading: item.thisMeterReading, |
|
|
|
images: item.fileList, |
|
|
|
remark: this.form.remark, |
|
|
|
}); |
|
|
|
}); |
|
|
|
console.log(params, "params"); |
|
|
|
|
|
|
|
let params = this.form.map((item) => ({ |
|
|
|
meterNumber: item.waterMeterNumber, |
|
|
|
meterType: 2, |
|
|
|
houseId: this.blockForm.houseId, |
|
|
|
roomId: item.id || "", |
|
|
|
lastMeterReading: parseFloat(item.lastMeterReading).toFixed(4), |
|
|
|
thisMeterReading: parseFloat(item.thisMeterReading).toFixed(4), |
|
|
|
images: (item.fileList || []).map((f) => ({ |
|
|
|
url: f.url, |
|
|
|
name: f.name, |
|
|
|
type: f.type, |
|
|
|
format: f.format || (f.url ? f.url.split(".").pop() : ""), |
|
|
|
})), |
|
|
|
remark: item.remark || "", |
|
|
|
})); |
|
|
|
const res = await submitWaterAndElectricity(params); |
|
|
|
if (res.code == 200) { |
|
|
|
uni.showToast({ |
|
|
@ -435,14 +589,13 @@ export default { |
|
|
|
icon: "none", |
|
|
|
}); |
|
|
|
} |
|
|
|
console.log(res, "reeees"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
}; |
|
|
|
</script> |
|
|
|
|
|
|
|
<style scoped> |
|
|
|
.page-content{ |
|
|
|
.page-content { |
|
|
|
background: #f7f7f7; |
|
|
|
min-height: 100vh; |
|
|
|
padding-bottom: 40rpx; |
|
|
@ -455,23 +608,23 @@ export default { |
|
|
|
position: relative; |
|
|
|
display: flex; |
|
|
|
} |
|
|
|
.bg-img{ |
|
|
|
.bg-img { |
|
|
|
position: absolute; |
|
|
|
top: 0; |
|
|
|
left: 0; |
|
|
|
width: 100%; |
|
|
|
height: 100%; |
|
|
|
} |
|
|
|
.bg-text{ |
|
|
|
.bg-text { |
|
|
|
margin: 50rpx 0 0 28rpx; |
|
|
|
z-index: 1; |
|
|
|
font-size: 44rpx; |
|
|
|
color:#101010; |
|
|
|
color: #101010; |
|
|
|
font-weight: bold; |
|
|
|
} |
|
|
|
.bg-text view:nth-child(2){ |
|
|
|
.bg-text view:nth-child(2) { |
|
|
|
font-size: 28rpx; |
|
|
|
color:#666666; |
|
|
|
color: #666666; |
|
|
|
margin-top: 10rpx; |
|
|
|
font-weight: 400; |
|
|
|
} |
|
|
@ -481,11 +634,11 @@ export default { |
|
|
|
border-radius: 20rpx; |
|
|
|
margin: -100rpx 24rpx 16rpx 24rpx; |
|
|
|
padding: 24rpx 24rpx 12rpx 24rpx; |
|
|
|
box-shadow: 0 4rpx 16rpx rgba(0,0,0,0.04); |
|
|
|
box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.04); |
|
|
|
position: relative; |
|
|
|
z-index: 2; |
|
|
|
} |
|
|
|
.house-view{ |
|
|
|
.house-view { |
|
|
|
height: calc(100vh - 600rpx); |
|
|
|
} |
|
|
|
.room-title { |
|
|
@ -515,7 +668,7 @@ export default { |
|
|
|
margin-bottom: 18rpx; |
|
|
|
} |
|
|
|
.device-row { |
|
|
|
display: flex; |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
padding: 0 24rpx; |
|
|
|
min-height: 64rpx; |
|
|
@ -544,12 +697,12 @@ display: flex; |
|
|
|
color: #68758b; |
|
|
|
font-size: 28rpx; |
|
|
|
} |
|
|
|
.picker-label{ |
|
|
|
.picker-label { |
|
|
|
display: flex; |
|
|
|
align-items: center; |
|
|
|
font-size: 28rpx; |
|
|
|
} |
|
|
|
.arrow-r{ |
|
|
|
.arrow-r { |
|
|
|
width: 30rpx; |
|
|
|
height: 30rpx; |
|
|
|
margin-left: 8rpx; |
|
|
@ -576,7 +729,7 @@ display: flex; |
|
|
|
justify-content: center; |
|
|
|
margin: 20rpx 16rpx 0 0; |
|
|
|
} |
|
|
|
.icon-box{ |
|
|
|
.icon-box { |
|
|
|
width: 60rpx; |
|
|
|
height: 60rpx; |
|
|
|
background: #ceeced; |
|
|
@ -585,7 +738,7 @@ display: flex; |
|
|
|
align-items: center; |
|
|
|
justify-content: center; |
|
|
|
} |
|
|
|
.camera-icon{ |
|
|
|
.camera-icon { |
|
|
|
width: 36rpx; |
|
|
|
height: 36rpx; |
|
|
|
} |
|
|
@ -634,7 +787,7 @@ display: flex; |
|
|
|
</style> |
|
|
|
|
|
|
|
<style> |
|
|
|
.sfReport .u-input__content__field-wrapper__field{ |
|
|
|
.sfReport .u-input__content__field-wrapper__field { |
|
|
|
text-align: right !important; |
|
|
|
} |
|
|
|
</style> |
|
|
|