Browse Source

水电

fenbao
wangyx 4 weeks ago
parent
commit
bebcaa01b7
  1. 27
      pagesA/sdPage/dfReport.vue
  2. 41
      pagesA/sdPage/sfReport.vue

27
pagesA/sdPage/dfReport.vue

@ -70,7 +70,7 @@
</view> </view>
</view> </view>
</view> </view>
<scroll-view class="house-view" scroll-y="true"> <scroll-view class="house-view" scroll-y="true" :scroll-top="scrollTop">
<view <view
class="section-card" class="section-card"
v-for="(item, index) in form" v-for="(item, index) in form"
@ -312,13 +312,6 @@ export default {
this.blockForm.houseId = houseArray[0].id; this.blockForm.houseId = houseArray[0].id;
this.energyMeterConfig = houseArray[0].energyMeterConfig; this.energyMeterConfig = houseArray[0].energyMeterConfig;
this.waterMeterConfig = houseArray[0].waterMeterConfig; 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();
let house = houseArray[0]; let house = houseArray[0];
// for (let index = 0; index < house.type; index++) { // for (let index = 0; index < house.type; index++) {
// this.form.waterMeters.push({ // this.form.waterMeters.push({
@ -328,6 +321,12 @@ export default {
// }); // });
// } // }
this.multiArray = [buildingNames, unitNames, houseNames]; this.multiArray = [buildingNames, unitNames, houseNames];
if (this.energyMeterConfig == 1) {
this.getRoomByHouseId(this.blockForm.houseId);
} else if (this.energyMeterConfig == 2) {
this.getRoomByHouseId(this.blockForm.houseId);
}
this.getLastMeter();
} }
}, },
handleShowToast() { handleShowToast() {
@ -358,6 +357,7 @@ export default {
const houseNames = houseArray.map((item) => item.name); const houseNames = houseArray.map((item) => item.name);
this.blockForm.houseId = houseArray[0].id; this.blockForm.houseId = houseArray[0].id;
this.blockForm.roomId = houseArray[0].roomId; this.blockForm.roomId = houseArray[0].roomId;
this.multiArray[1] = unitNames; this.multiArray[1] = unitNames;
this.multiArray[2] = houseNames; this.multiArray[2] = houseNames;
} //1 } //1
@ -386,6 +386,8 @@ export default {
this.houseOptions[e.detail.value].waterMeterConfig; this.houseOptions[e.detail.value].waterMeterConfig;
this.energyMeterConfig = this.energyMeterConfig =
this.houseOptions[e.detail.value].energyMeterConfig; this.houseOptions[e.detail.value].energyMeterConfig;
}
}
if (this.energyMeterConfig == 1) { if (this.energyMeterConfig == 1) {
this.getHouseInfoBy(this.blockForm.houseId); this.getHouseInfoBy(this.blockForm.houseId);
} else if (this.energyMeterConfig == 2) { } else if (this.energyMeterConfig == 2) {
@ -398,8 +400,7 @@ export default {
"this.waterMeterConfig, this.energyMeterConfig" "this.waterMeterConfig, this.energyMeterConfig"
); );
console.log(this.houseOptions[e.detail.value]); console.log(this.houseOptions[e.detail.value]);
}
}
this.$forceUpdate(); this.$forceUpdate();
}, },
onDelete(event, index) { onDelete(event, index) {
@ -457,11 +458,15 @@ export default {
async getHouseInfoBy(id) { async getHouseInfoBy(id) {
const res = await getHouseInfo(id); const res = await getHouseInfo(id);
if (res.code == 200) { if (res.code == 200) {
if (this.energyMeterConfig == 1) {
this.form = [{}];
} else if (this.energyMeterConfig == 2) {
this.form = this.form.map((item) => ({ this.form = this.form.map((item) => ({
...item, ...item,
electricMeterNumber: res.data.electricMeterNumber, electricMeterNumber: res.data.electricMeterNumber,
})); }));
} }
}
}, },
// //
async getLastMeter(item) { async getLastMeter(item) {
@ -518,7 +523,7 @@ export default {
} else if (this.energyMeterConfig == 2) { } else if (this.energyMeterConfig == 2) {
this.form = res.data; this.form = res.data;
} }
this.getLastMeter(); // this.getLastMeter();
console.log(this.form, "this.form"); console.log(this.form, "this.form");
// if (this.waterMeterConfig == 1 && this.energyMeterConfig == 1) { // if (this.waterMeterConfig == 1 && this.energyMeterConfig == 1) {

41
pagesA/sdPage/sfReport.vue

@ -53,9 +53,7 @@
:range="multiArray" :range="multiArray"
> >
<view class="uni-input">{{ <view class="uni-input">{{
multiIndex[0] === -1 multiArray[0][multiIndex[0]] +
? "请选择"
: multiArray[0][multiIndex[0]] +
multiArray[1][multiIndex[1]] + multiArray[1][multiIndex[1]] +
multiArray[2][multiIndex[2]] multiArray[2][multiIndex[2]]
}}</view> }}</view>
@ -74,6 +72,7 @@
</view> </view>
<scroll-view class="house-view" scroll-y="true"> <scroll-view class="house-view" scroll-y="true">
<view class="section-card" v-for="(item, index) in form" :key="index"> <view class="section-card" v-for="(item, index) in form" :key="index">
<view class="section-title">{{ item.roomTypeName }}</view>
<view class="meter-row"> <view class="meter-row">
<view class="meter-label"> <view class="meter-label">
<view style="color: #f93838; margin-right: 4rpx; font-size: 24rpx" <view style="color: #f93838; margin-right: 4rpx; font-size: 24rpx"
@ -193,7 +192,7 @@ export default {
unitOptions: [], unitOptions: [],
houseOptions: [], houseOptions: [],
multiArray: [[], [], []], multiArray: [[], [], []],
multiIndex: [-1, -1, -1], multiIndex: [0, 0, 0],
form: [ form: [
{ {
meterNumber: "", meterNumber: "",
@ -296,12 +295,7 @@ export default {
this.blockForm.houseId = houseArray[0].id; this.blockForm.houseId = houseArray[0].id;
this.energyMeterConfig = houseArray[0].energyMeterConfig; this.energyMeterConfig = houseArray[0].energyMeterConfig;
this.waterMeterConfig = houseArray[0].waterMeterConfig; 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; this.blockForm.roomId = houseArray[0].roomId;
let house = houseArray[0]; let house = houseArray[0];
// for (let index = 0; index < house.type; index++) { // for (let index = 0; index < house.type; index++) {
@ -314,6 +308,12 @@ export default {
// }); // });
// } // }
this.multiArray = [buildingNames, unitNames, houseNames]; this.multiArray = [buildingNames, unitNames, houseNames];
if (this.energyMeterConfig == 1) {
this.getHouseInfoBy(this.blockForm.houseId);
} else if (this.energyMeterConfig == 2) {
this.getRoomByHouseId(this.blockForm.houseId);
}
this.getLastMeter();
} }
}, },
handleShowToast() { handleShowToast() {
@ -366,13 +366,14 @@ export default {
this.blockForm.roomId = this.houseOptions[e.detail.value].roomId; this.blockForm.roomId = this.houseOptions[e.detail.value].roomId;
this.waterMeterConfig = this.waterMeterConfig =
this.houseOptions[e.detail.value].waterMeterConfig; this.houseOptions[e.detail.value].waterMeterConfig;
}
}
if (this.waterMeterConfig == 1) { if (this.waterMeterConfig == 1) {
this.getHouseInfoBy(this.blockForm.houseId); this.getHouseInfoBy(this.blockForm.houseId);
} else if (this.waterMeterConfig == 2) { } else if (this.waterMeterConfig == 2) {
this.getRoomByHouseId(this.blockForm.houseId); this.getRoomByHouseId(this.blockForm.houseId);
} }
} this.getLastMeter();
}
this.$forceUpdate(); this.$forceUpdate();
}, },
// //
@ -465,7 +466,7 @@ export default {
} else if (this.waterMeterConfig == 2) { } else if (this.waterMeterConfig == 2) {
this.form = res.data; this.form = res.data;
} }
this.getLastMeter(); // this.getLastMeter();
} }
}, },
onDelete(event, index) { onDelete(event, index) {
@ -489,13 +490,13 @@ export default {
for (let i = 0; i < this.form.length; i++) { for (let i = 0; i < this.form.length; i++) {
const item = this.form[i]; const item = this.form[i];
if (this.waterMeterConfig == 2) { if (this.waterMeterConfig == 2) {
if (!item.electricMeterNumber) { // if (!item.electricMeterNumber) {
uni.showToast({ // uni.showToast({
title: `${i + 1}个房间请填写水表号`, // title: `${i + 1}`,
icon: "none", // icon: "none",
}); // });
return; // return;
} // }
// if (!item.lastMeterReading && item.lastMeterReading !== 0) { // if (!item.lastMeterReading && item.lastMeterReading !== 0) {
// uni.showToast({ // uni.showToast({
// title: `${i + 1}`, // title: `${i + 1}`,

Loading…
Cancel
Save