修复bug

This commit is contained in:
zhouyanli
2026-08-13 14:12:11 +08:00
parent 94146ce27a
commit 32765cc004
12 changed files with 145 additions and 48 deletions

View File

@@ -57,12 +57,11 @@ const fetchHouseList = async () => {
if (res.code === 200) {
const list = res.rows || []
houseList.value = list
if (houseList.value.length > 0) {
if (preSelectedHouseId.value) {
const found = houseList.value.find(item => String(item.id) === String(preSelectedHouseId.value))
selectedHouse.value = found || houseList.value[0]
} else {
selectedHouse.value = houseList.value[0]
// 仅当从表单页带入了房屋ID时自动选中对应房屋否则不默认选择
if (preSelectedHouseId.value) {
const found = houseList.value.find(item => String(item.id) === String(preSelectedHouseId.value))
if (found) {
selectedHouse.value = found
}
}
}
@@ -85,7 +84,7 @@ const selectHouse = (item) => {
// 确认选择并返回
const confirmSelect = () => {
if (!selectedHouse.value) {
if (!selectedHouse.value.id) {
uni.showToast({ title: '请选择房屋', icon: 'none' })
return
}
@@ -113,6 +112,8 @@ const confirmSelect = () => {
}
.house-list {
flex: 1;
min-height: 0;
overflow-y: auto;
}
.house-item {
display: flex;