同步6/16

This commit is contained in:
Zy
2026-06-01 18:12:58 +08:00
parent 38274ab612
commit 50e7b14fd6
183 changed files with 8956 additions and 4803 deletions

View File

@@ -73,40 +73,14 @@ export const useHouseStore = defineStore(
// 初始化
const initHouse = async () => {
currentBuildingInfoList.value = [];
resertInit();
// 获取当前小区 所有楼栋信息
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) {
// // 获取当前 第一个楼栋的所有信息
// 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;
// }
// }
};
// 选中的房屋
@@ -173,6 +147,9 @@ export const useHouseStore = defineStore(
// 获取当前 楼栋的所有信息
const res3 = await getHouselistAPI(currentBuildingInfo.value.id, houseName, houseUseTypeId);
currentHouseInfoList.value = res3.data;
console.log(res3.data);
floorslist.value = null;
floorslist.value = new Set();
// 得到所有的有房屋的 楼层 数组
@@ -216,6 +193,24 @@ export const useHouseStore = defineStore(
});
};
function resertInit() {
currentBuildingInfo.value = {
'id': null,
'villageId': null,
'villageName': '',
'buildingName': '',
'buildingUse': null,
'buildToward': '',
'buildTall': '',
'buildStructure': '',
'floorCount': null,
'remark': ''
};
currentBuildingInfoList.value = [];
currentHouseInfoList.value = null;
floorslist.value.clear();
}
// 更新数据
const updateHouse = () => {
initHouse();

View File

@@ -8,34 +8,42 @@ interface NoticeItem {
time: string;
}
export const useNoticeStore = defineStore('notice', () => {
const state = reactive({
notices: [] as NoticeItem[]
});
const addNotice = (notice: NoticeItem) => {
state.notices.push(notice);
};
const removeNotice = (notice: NoticeItem) => {
state.notices.splice(state.notices.indexOf(notice), 1);
};
//实现全部已读
const readAll = () => {
state.notices.forEach((item: any) => {
item.read = true;
export const useNoticeStore = defineStore(
'notice',
() => {
const state = reactive({
notices: [] as NoticeItem[]
});
};
const clearNotice = () => {
state.notices = [];
};
return {
state,
addNotice,
removeNotice,
readAll,
clearNotice
};
});
const addNotice = (notice: NoticeItem) => {
state.notices.unshift(notice);
};
const removeNotice = (notice: NoticeItem) => {
state.notices.splice(state.notices.indexOf(notice), 1);
};
//实现全部已读
const readAll = () => {
state.notices.forEach((item: any) => {
item.read = true;
});
};
const clearNotice = () => {
state.notices = [];
};
return {
state,
addNotice,
removeNotice,
readAll,
clearNotice
};
},
{
persist: {
storage: sessionStorage
}
}
);

View File

@@ -70,16 +70,20 @@ export const usePermissionStore = defineStore('permission', () => {
};
const setRoutes = (newRoutes: RouteRecordRaw[]): void => {
addRoutes.value = [];
addRoutes.value = newRoutes;
routes.value = constantRoutes.concat(newRoutes);
};
const setDefaultRoutes = (routes: RouteRecordRaw[]): void => {
defaultRoutes.value = [];
defaultRoutes.value = constantRoutes.concat(routes);
};
const setTopbarRoutes = (routes: RouteRecordRaw[]): void => {
topbarRouters.value = [];
topbarRouters.value = routes;
};
const setSidebarRouters = (routes: RouteRecordRaw[]): void => {
sidebarRouters.value = [];
sidebarRouters.value = routes;
};
@@ -104,10 +108,6 @@ export const usePermissionStore = defineStore('permission', () => {
const defaultRoutes = filterAsyncRouter(defaultData);
const asyncRoutes = filterDynamicRoutes(dynamicRoutes);
asyncRoutes.forEach((route) => {
router.addRoute(route);
});
setRoutes(rewriteRoutes);
setSidebarRouters(constantRoutes.concat(sidebarRoutes));
setDefaultRoutes(sidebarRoutes);