完成访客搭建,完善之前审核界面
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
import { getCommunitylistAPI } from '@/api/system/community';
|
||||
import { communitylist_rows_type } from '@/api/system/community/type';
|
||||
import { deleteHouseApi, getBuildinglistAPI, getHouselistAPI } from '@/api/system/house';
|
||||
import { deleteHouseApi, getBuildinglistAPI, getHouselistAPI, getVillageTree } from '@/api/system/house';
|
||||
import type { addBuildingType, BuildingUnit, BuildingVo } from '@/api/system/house/type';
|
||||
import { convertBuildingToTree } from '@/utils/house';
|
||||
import { defineStore } from 'pinia';
|
||||
// 数字排序
|
||||
function sortNumberStr(a: string, b: string) {
|
||||
@@ -25,6 +26,8 @@ export const useHouseStore = defineStore(
|
||||
const buildingtype = ref<number>(0);
|
||||
// 住宅列表
|
||||
const buildingtypelist = ref([]);
|
||||
// 房屋树状结构
|
||||
const treedata = ref([]);
|
||||
|
||||
// 当前小区 所有楼栋信息
|
||||
const currentBuildingInfoList = ref<BuildingVo[]>([]);
|
||||
@@ -154,6 +157,15 @@ export const useHouseStore = defineStore(
|
||||
}
|
||||
};
|
||||
|
||||
// 房屋 树状结构类型
|
||||
const getCurrentVilageTreeHouse = async () => {
|
||||
const res = await getCommunitylistAPI();
|
||||
const currentVilage = res.rows.find((item) => item.choiceStatus === 0);
|
||||
currentVilageInfo.value = currentVilage;
|
||||
getVillageTree(currentVilageInfo.value.villageId).then((res) => {
|
||||
treedata.value = convertBuildingToTree(res.data.buildings);
|
||||
});
|
||||
};
|
||||
return {
|
||||
currentVilageInfo,
|
||||
currentBuildingInfoList,
|
||||
@@ -163,12 +175,14 @@ export const useHouseStore = defineStore(
|
||||
checkoutHouses,
|
||||
buildingtype,
|
||||
buildingtypelist,
|
||||
treedata,
|
||||
checkoutHousesFun,
|
||||
initHouse,
|
||||
switchHouseType,
|
||||
switchBuilding,
|
||||
updateHouse,
|
||||
deleteBuildingFun
|
||||
deleteBuildingFun,
|
||||
getCurrentVilageTreeHouse
|
||||
};
|
||||
},
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ import { LoginData } from '@/api/types';
|
||||
import defAva from '@/assets/images/profile.jpg';
|
||||
import { defineStore } from 'pinia';
|
||||
import { ref } from 'vue';
|
||||
import { useHouseStore } from './house';
|
||||
|
||||
export const useUserStore = defineStore('user', () => {
|
||||
const token = ref(getToken());
|
||||
@@ -39,7 +40,7 @@ export const useUserStore = defineStore('user', () => {
|
||||
const data = res.data;
|
||||
const user = data.user;
|
||||
const profile = user.avatar == '' || user.avatar == null ? defAva : user.avatar;
|
||||
|
||||
useHouseStore().getCurrentVilageTreeHouse();
|
||||
if (data.roles && data.roles.length > 0) {
|
||||
// 验证返回的roles是否是一个非空数组
|
||||
roles.value = data.roles;
|
||||
|
||||
Reference in New Issue
Block a user