|
|
@ -52,11 +52,7 @@ |
|
|
|
:value="multiIndex" |
|
|
|
:range="multiArray" |
|
|
|
> |
|
|
|
<view class="uni-input">{{ |
|
|
|
multiArray[0][multiIndex[0]] + |
|
|
|
multiArray[1][multiIndex[1]] + |
|
|
|
multiArray[2][multiIndex[2]] |
|
|
|
}}</view> |
|
|
|
<view class="uni-input">{{pickerDisplay}}</view> |
|
|
|
</picker> |
|
|
|
</view> |
|
|
|
<view v-else @click="handleShowToast" style="color: #cbcbcb" |
|
|
@ -80,9 +76,9 @@ |
|
|
|
> |
|
|
|
<text>水表号</text> |
|
|
|
</view> |
|
|
|
<u-input |
|
|
|
<u--input |
|
|
|
v-model="item.waterMeterNumber" |
|
|
|
type="digit" |
|
|
|
type="text" |
|
|
|
placeholder="请输入水表号" |
|
|
|
border="none" |
|
|
|
:disabled="item.isSystemWaterMeterNumber" |
|
|
@ -260,6 +256,14 @@ export default { |
|
|
|
immediate: true, |
|
|
|
}, |
|
|
|
}, |
|
|
|
computed: { |
|
|
|
pickerDisplay() { |
|
|
|
const a = this.multiArray?.[0]?.[this.multiIndex?.[0]] || '' |
|
|
|
const b = this.multiArray?.[1]?.[this.multiIndex?.[1]] || '' |
|
|
|
const c = (this.multiArray?.[2]?.length > 0) ? (this.multiArray[2][this.multiIndex?.[2]] || '') : '' |
|
|
|
return [a, b, c].filter(Boolean).join('') |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
this.getTree(); |
|
|
|
}, |
|
|
@ -330,13 +334,13 @@ export default { |
|
|
|
// 户 |
|
|
|
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); |
|
|
|
// if (!houseArray || houseArray.length === 0) { |
|
|
|
// console.warn("未获取到户信息"); |
|
|
|
// return; |
|
|
|
// } |
|
|
|
if(houseArray.length > 0 && houseArray[0]){ |
|
|
|
this.houseOptions = houseArray; |
|
|
|
const houseNames = houseArray.map((item) => item.name); |
|
|
|
this.blockForm.houseId = houseArray[0].id; |
|
|
|
this.waterMeterConfig = houseArray[0].waterMeterConfig; |
|
|
|
|
|
|
@ -344,6 +348,13 @@ export default { |
|
|
|
let house = houseArray[0]; |
|
|
|
|
|
|
|
this.multiArray = [buildingNames, unitNames, houseNames]; |
|
|
|
}else { |
|
|
|
this.houseOptions = []; |
|
|
|
this.multiArray = [buildingNames, unitNames, []]; |
|
|
|
} |
|
|
|
|
|
|
|
console.log(this.multiArray,"this.multiArray11"); |
|
|
|
|
|
|
|
if (this.waterMeterConfig == 1) { |
|
|
|
this.getHouseInfoBy(this.blockForm.houseId); |
|
|
|
} else if (this.waterMeterConfig == 2) { |
|
|
@ -371,89 +382,71 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
handleShowToast() { |
|
|
|
console.log(this.multiArray,"this.multiArray"); |
|
|
|
|
|
|
|
uni.showToast({ title: "请选择乐业社区", icon: "none" }); |
|
|
|
}, |
|
|
|
async bindMultiPickerColumnChange(e) { |
|
|
|
if (!this.multiArray[0].length) return; |
|
|
|
this.multiIndex[e.detail.column] = e.detail.value; |
|
|
|
if (!this.multiArray[0].length) return |
|
|
|
|
|
|
|
// 用 splice 保证响应式(替代 this.multiIndex[e.detail.column] = e.detail.value) |
|
|
|
this.multiIndex.splice(e.detail.column, 1, e.detail.value) |
|
|
|
|
|
|
|
switch (e.detail.column) { |
|
|
|
case 0: |
|
|
|
{ |
|
|
|
const unitArray = await this.getListByParentId( |
|
|
|
"3", |
|
|
|
this.buildingOptions[e.detail.value].id |
|
|
|
); |
|
|
|
|
|
|
|
// 验证单元数据 |
|
|
|
if (!unitArray || unitArray.length === 0) { |
|
|
|
console.warn("未获取到单元信息"); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
this.unitOptions = unitArray; |
|
|
|
const unitNames = unitArray.map((item) => 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) { |
|
|
@ -575,16 +568,19 @@ export default { |
|
|
|
(m) => String(m.roomId) === String(item.id) |
|
|
|
); |
|
|
|
if (meter) { |
|
|
|
const hasMeterNum = !!(meter.meterNumber && meter.meterNumber.trim() !== ''); |
|
|
|
return { |
|
|
|
...item, |
|
|
|
lastMeterReading: meter.thisMeterReading || 0, |
|
|
|
waterMeterNumber: meter.meterNumber || "", |
|
|
|
isSystemWaterMeterNumber: !!(meter.meterNumber && meter.meterNumber.trim() !== ''), |
|
|
|
waterMeterNumber: meter.meterNumber || '', |
|
|
|
isSystemWaterMeterNumber: hasMeterNum, // 有号则禁用 |
|
|
|
meterReadingTime: item.meterReadingTime || this.formatDateTime(new Date()), // 确保有抄表时间 |
|
|
|
}; |
|
|
|
} |
|
|
|
return item; |
|
|
|
}); |
|
|
|
|
|
|
|
console.log(this.form,"this.form11"); |
|
|
|
} |
|
|
|
}, |
|
|
|
// 初始化抄表时间 |
|
|
|