diff --git a/pagesA/sdPage/dfReport.vue b/pagesA/sdPage/dfReport.vue
index b3354a0..8db84f5 100644
--- a/pagesA/sdPage/dfReport.vue
+++ b/pagesA/sdPage/dfReport.vue
@@ -81,8 +81,9 @@
>
电表号
- item.name);
- this.blockForm.unitId = unitArray[0].id;
-
- const houseArray = await this.getListByParentId(
- "4",
- unitArray[0].id
- );
-
- // 验证户数据
- if (!houseArray || houseArray.length === 0) {
- console.warn("未获取到户信息");
- return;
- }
+ if (!this.multiArray[0].length) return
- this.houseOptions = houseArray;
- const houseNames = houseArray.map((item) => item.name);
- this.blockForm.houseId = houseArray[0].id;
- this.blockForm.roomId = houseArray[0].roomId;
+ // 替换行 450:用 splice 确保响应式
+ this.multiIndex.splice(e.detail.column, 1, e.detail.value)
- 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
- );
+ switch (e.detail.column) {
+ case 0: {
+ const unitArray = await this.getListByParentId('3', this.buildingOptions[e.detail.value].id)
+ if (!unitArray || unitArray.length === 0) return
+ this.unitOptions = unitArray
+ const unitNames = unitArray.map(item => item.name)
+ this.blockForm.unitId = unitArray[0].id
- // 验证户数据
- if (!houseArray || houseArray.length === 0) {
- console.warn("未获取到户信息");
- return;
- }
+ const houseArray = await this.getListByParentId('4', unitArray[0].id)
+ if (!houseArray || houseArray.length === 0) return
+ this.houseOptions = houseArray
+ const houseNames = houseArray.map(item => item.name)
+ this.blockForm.houseId = houseArray[0].id
+ this.blockForm.roomId = houseArray[0].roomId
- 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;
- } //拖动第2列
- this.multiIndex.splice(2, 1, 0);
+ // 替换行 485/486:用 $set 或整体替换
+ this.$set(this.multiArray, 1, unitNames)
+ this.$set(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)
+ if (!houseArray || houseArray.length === 0) return
+ this.houseOptions = houseArray
+ const houseNames = houseArray.map(item => item.name)
+ this.blockForm.houseId = houseArray[0].id
+ this.blockForm.roomId = houseArray[0].roomId
- break;
+ // 替换行 508:用 $set
+ this.$set(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;
- this.energyMeterConfig =
- this.houseOptions[e.detail.value].energyMeterConfig;
+ // 第三列索引同样需要响应式设置(虽然上面已统一 splice,这里再确保一次)
+ this.multiIndex.splice(2, 1, e.detail.value)
+ 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
+ this.energyMeterConfig = this.houseOptions[e.detail.value].energyMeterConfig
+ break
}
}
- // 确保在调用方法之前有有效的配置
if (this.energyMeterConfig && this.blockForm.houseId) {
if (this.energyMeterConfig == 1) {
- this.getHouseInfoBy(this.blockForm.houseId);
+ this.getHouseInfoBy(this.blockForm.houseId)
} else if (this.energyMeterConfig == 2) {
- this.getRoomByHouseId(this.blockForm.houseId);
+ this.getRoomByHouseId(this.blockForm.houseId)
}
}
-
- this.$forceUpdate();
},
onDelete(event, index) {
if (this.form[index] && Array.isArray(this.form[index].fileList)) {
diff --git a/pagesA/sdPage/sfReport.vue b/pagesA/sdPage/sfReport.vue
index 39edef2..9bee439 100644
--- a/pagesA/sdPage/sfReport.vue
+++ b/pagesA/sdPage/sfReport.vue
@@ -76,8 +76,9 @@
>
水表号
- item.name);
- this.blockForm.unitId = unitArray[0].id;
+ case 0: {
+ const unitArray = await this.getListByParentId('3', this.buildingOptions[e.detail.value].id)
+ if (!unitArray || unitArray.length === 0) return
+ this.unitOptions = unitArray
+ const unitNames = unitArray.map(item => item.name)
+ this.blockForm.unitId = unitArray[0].id
- const houseArray = await this.getListByParentId(
- "4",
- unitArray[0].id
- );
-
- // 验证户数据
- if (!houseArray || houseArray.length === 0) {
- console.warn("未获取到户信息");
- return;
- }
-
- 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
- );
-
- // 验证户数据
- if (!houseArray || houseArray.length === 0) {
- console.warn("未获取到户信息");
- return;
- }
-
- 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;
+ const houseArray = await this.getListByParentId('4', unitArray[0].id)
+ if (!houseArray || houseArray.length === 0) return
+ this.houseOptions = houseArray
+ const houseNames = houseArray.map(item => item.name)
+ this.blockForm.houseId = houseArray[0].id
+ this.blockForm.roomId = houseArray[0].roomId
+
+ // 更新列数据
+ this.$set(this.multiArray, 1, unitNames)
+ this.$set(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)
+ if (!houseArray || houseArray.length === 0) return
+ this.houseOptions = houseArray
+ const houseNames = houseArray.map(item => item.name)
+ this.blockForm.houseId = houseArray[0].id
+ this.blockForm.roomId = houseArray[0].roomId
+
+ this.$set(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;
+ // 第三列仅变更索引,也需要 splice 才能触发视图更新(已在顶部统一处理)
+ 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
+ break
}
}
-
- // 确保在调用方法之前有有效的配置
+
+ // 依据配置加载数据
if (this.waterMeterConfig && this.blockForm.houseId) {
if (this.waterMeterConfig == 1) {
- this.getHouseInfoBy(this.blockForm.houseId);
+ this.getHouseInfoBy(this.blockForm.houseId)
} else if (this.waterMeterConfig == 2) {
- this.getRoomByHouseId(this.blockForm.houseId);
+ this.getRoomByHouseId(this.blockForm.houseId)
}
}
-
- this.$forceUpdate();
},
//图片超过大小时取消上传
oversize(e) {
@@ -598,6 +579,8 @@ export default {
}
return item;
});
+
+ console.log(this.form,"this.form11");
}
},
// 初始化抄表时间