zhangzengfei
2022-07-20 4a800a8fc83c6bd1f86a8e847b079a51a7532c09
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { findOnMap } from "../api/map"
 
export default class MapData {
  public deviceList: Array<object> = [];
  public onMapDeviceList: Array<object> = [];
  public currentFloor: Number = 0;
 
  public currentMarker: Object = {};
 
  constructor() {
    this.deviceList = []
    this.onMapDeviceList = []
    this.currentFloor = 0
    this.currentMarker = {}
  }
 
  async findOnMap(floor, isOnMap) {
    const res: any = await findOnMap({
      floor: floor,
      isOnMap: isOnMap
    })
    if (res && res.success) {
      // console.log(res,'查找所有未标记的设备')
      if (isOnMap) {
        this.onMapDeviceList = res.data.map(i => {
          i.isLock = true
          return i
        })
      } else {
        this.deviceList = res.data
      }
    }
  }
 
  refreshDeviceList() {
    this.findOnMap(-9999, true)
    this.findOnMap(-9999, false)
  }
}