Browse Source

楼层过滤

Reviewed-on: #8
master v1.1.0
朱志育 7 months ago
parent
commit
98e966e607
  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) return this.buildingList.find(building => building.buildingCode === this.device.buildingCode) ?? ({} as Building)
}, },
currentBuildingFloorsList() { currentBuildingFloorsList() {
return this.currentBuilding.floorList ?? []
const floors = this.currentBuilding.floorList ?? []
if (!floors?.length) {
return []
}
return floors.filter(floor => floor.status === 0)
}, },
recommendList() { recommendList() {
return this.BrandInfo?.recommendList ?? [] return this.BrandInfo?.recommendList ?? []
@ -35,8 +39,8 @@ export const getters: GenGetters = {
brandFloorList() { brandFloorList() {
const brandBuilding = this.BrandInfo.buildingList?.find(item => item.buildingCode === this.device.buildingCode) const brandBuilding = this.BrandInfo.buildingList?.find(item => item.buildingCode === this.device.buildingCode)
const mergeFloorList = [ 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 return mergeFloorList
}, },

1
src/types/building.d.ts

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

Loading…
Cancel
Save