test #8

Merged
zhuzhiyu merged 2 commits from test into master 7 months ago
  1. 10
      src/stores/root/getters.ts
  2. 1
      src/types/building.d.ts

10
src/stores/root/getters.ts

@ -27,7 +27,11 @@ export const getters: GenGetters = {
return this.buildingList.find(building => building.buildingCode === this.device.buildingCode) ?? ({} as Building)
},
currentBuildingFloorsList() {
return this.currentBuilding.floorList ?? []
const floors = this.currentBuilding.floorList ?? []
if (!floors?.length) {
return []
}
return floors.filter(floor => floor.status === 0)
},
recommendList() {
return this.BrandInfo?.recommendList ?? []
@ -35,8 +39,8 @@ export const getters: GenGetters = {
brandFloorList() {
const brandBuilding = this.BrandInfo.buildingList?.find(item => item.buildingCode === this.device.buildingCode)
const mergeFloorList = [
{ floorCode: 'ALL', floor: 'ALL', floorOrder: -1, floorMapUrl: '', floorMapCode: 'ALL' },
...(brandBuilding?.floorList ?? [])
{ floorCode: 'ALL', floor: 'ALL', floorOrder: -1, floorMapUrl: '', floorMapCode: 'ALL', status: 0 as const },
...(brandBuilding?.floorList?.filter(floor => floor.status === 0) ?? [])
]
return mergeFloorList
},

1
src/types/building.d.ts

@ -4,6 +4,7 @@ declare interface Floor {
floorOrder: number
floorMapUrl: string
floorMapCode: string
status: 0 | 1 // 0: 正常 1: 停用
}
declare interface Building {

Loading…
Cancel
Save