房屋详情,单元变更

This commit is contained in:
Zy
2026-05-21 14:13:28 +08:00
parent 9645412534
commit 38274ab612
68 changed files with 1867 additions and 568 deletions

View File

@@ -41,7 +41,6 @@ export const useHouseStore = defineStore(
'buildToward': '',
'buildTall': '',
'buildStructure': '',
'unitCount': null,
'floorCount': null,
'remark': ''
});
@@ -73,37 +72,41 @@ export const useHouseStore = defineStore(
};
// 初始化
const initHouse = async (currentbuildingtype: string) => {
const initHouse = async () => {
currentBuildingInfoList.value = [];
// 获取当前小区 所有楼栋信息
const res2 = await getBuildinglistAPI(currentbuildingtype);
const res2 = await getBuildinglistAPI();
currentBuildingInfoList.value = res2.data;
// 得到小区 内 楼栋列表 -> 切换到第一个小区
if (res2.data.length > 0) {
switchBuilding(res2.data[0].id);
}
// 获取当前小区 第一个楼栋信息
// ! 不同住宅类型
if ((currentBuildingInfo.value && currentBuildingInfo.value.id === null) || buildingtype.value !== currentbuildingtype) {
currentBuildingInfo.value = res2.data[0];
// ! 相同住宅类型
} else if (buildingtype.value === currentbuildingtype) {
// 更新当前楼栋的 信息
currentBuildingInfo.value = res2.data.find((item) => item.id === currentBuildingInfo.value.id);
}
// // ! 不同住宅类型
// if ((currentBuildingInfo.value && currentBuildingInfo.value.id === null) || buildingtype.value !== currentbuildingtype) {
// currentBuildingInfo.value = res2.data[0];
// // ! 相同住宅类型
// } else if (buildingtype.value === currentbuildingtype) {
// // 更新当前楼栋的 信息
// currentBuildingInfo.value = res2.data.find((item) => item.id === currentBuildingInfo.value.id);
// }
if (currentBuildingInfo.value && currentBuildingInfo.value.id) {
// 获取当前 第一个楼栋的所有信息
const res3 = await getHouselistAPI(currentBuildingInfo.value.id);
currentHouseInfoList.value = res3.data;
floorslist.value = new Set();
// 得到所有的有房屋的 楼层 数组
currentHouseInfoList.value.units.forEach((item) => {
item.floors.forEach((floor) => {
floorslist.value.add(floor.floorNo);
});
});
if (buildingtype.value !== currentbuildingtype) {
buildingtype.value = currentbuildingtype;
}
}
// if (currentBuildingInfo.value && currentBuildingInfo.value.id) {
// // 获取当前 第一个楼栋的所有信息
// const res3 = await getHouselistAPI(currentBuildingInfo.value.id);
// currentHouseInfoList.value = res3.data;
// floorslist.value = new Set();
// // 得到所有的有房屋的 楼层 数组
// currentHouseInfoList.value.units.forEach((item) => {
// item.floors.forEach((floor) => {
// floorslist.value.add(floor.floorNo);
// });
// });
// if (buildingtype.value !== currentbuildingtype) {
// buildingtype.value = currentbuildingtype;
// }
// }
};
// 选中的房屋
@@ -118,7 +121,7 @@ export const useHouseStore = defineStore(
// 清空
currentBuildingInfoList.value = [];
// 获取当前小区 所有楼栋信息
const res2 = await getBuildinglistAPI(housetype);
const res2 = await getBuildinglistAPI();
currentBuildingInfoList.value = res2.data;
// 获取当前小区 第一个楼栋信息
if ((currentBuildingInfo.value && currentBuildingInfo.value.id === null) || buildingtype.value !== housetype) {
@@ -134,7 +137,6 @@ export const useHouseStore = defineStore(
'buildToward': '',
'buildTall': '',
'buildStructure': '',
'unitCount': null,
'floorCount': null,
'remark': ''
};
@@ -152,22 +154,24 @@ export const useHouseStore = defineStore(
// 更新当前楼栋信息
const updateCureentBuilding = async () => {
currentHouseInfoList.value = null;
// 获取当前 楼栋的所有信息
const res3 = await getHouselistAPI(currentBuildingInfo.value.id);
currentHouseInfoList.value = res3.data;
floorslist.value = new Set();
// 得到所有的有房屋的 楼层 数组
currentHouseInfoList.value.units.forEach((item) => {
item.floors.forEach((floor) => {
floorslist.value.add(floor.floorNo);
if (currentBuildingInfo.value && currentBuildingInfo.value.id) {
// 获取当前 楼栋的所有信息
const res3 = await getHouselistAPI(currentBuildingInfo.value.id);
currentHouseInfoList.value = res3.data;
floorslist.value = new Set();
// 得到所有的有房屋的 楼层 数组
currentHouseInfoList.value.units.forEach((item) => {
item.floors.forEach((floor) => {
floorslist.value.add(floor.floorNo);
});
});
});
}
};
// 根据房屋号,查询房屋
async function getHouseBybuildingNo(houseName: string) {
async function getHouseBybuildingNo(houseName: string, houseUseTypeId: string) {
currentHouseInfoList.value = null;
// 获取当前 楼栋的所有信息
const res3 = await getHouselistAPI(currentBuildingInfo.value.id, houseName);
const res3 = await getHouselistAPI(currentBuildingInfo.value.id, houseName, houseUseTypeId);
currentHouseInfoList.value = res3.data;
floorslist.value = null;
floorslist.value = new Set();
@@ -191,16 +195,15 @@ export const useHouseStore = defineStore(
'buildToward': '',
'buildTall': '',
'buildStructure': '',
'unitCount': null,
'floorCount': null,
'remark': ''
};
currentHouseInfoList.value = null;
currentBuildingInfo.value = currentBuildingInfoList.value.find((item) => item.id === buildingId);
getHouselistAPI(buildingId).then((res) => {
if (!res.data) return;
currentHouseInfoList.value = res.data;
// 获取当前楼栋信息并 赋值
currentBuildingInfo.value = currentBuildingInfoList.value.find((item) => item.id === buildingId);
// 清空 楼层信息
floorslist.value.clear();
// 重新获取楼层信息
@@ -215,7 +218,7 @@ export const useHouseStore = defineStore(
// 更新数据
const updateHouse = () => {
initHouse(buildingtype.value);
initHouse();
};
// 删除指定楼栋
const deleteBuildingFun = (buildingId: string) => {