guoshipeng
2022-11-07 13906d0efa0d3411ee5cd4f01d086a56632ee74d
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<template>
<div class="Map">
  <div style="margin-bottom: 20px">
    <el-radio-group v-model="radioSeven" size="medium">
      <el-radio-button label="PM2.5" ></el-radio-button>
      <el-radio-button label="PM10"></el-radio-button>
      <el-radio-button label="SO2"></el-radio-button>
      <el-radio-button label="NO2"></el-radio-button>
      <el-radio-button label="CO"></el-radio-button>
      <el-radio-button label="03"></el-radio-button>
      <el-radio-button label="TVOC"></el-radio-button>
    </el-radio-group>
  </div>
  <div style="height: 90%;border: 1px solid;">
    <div id="map_container" style="width:100%; height:100%;" />
  </div>
</div>
</template>
 
<script>
export default {
  name: 'Map',
  data() {
    return {
      radioSeven: 'PM2.5',
      mapCenterlon: 0,
      mapCenterlat: 0,
      planData: [], // 飞行数据
      map: null
    }
  },
  mounted() {
    this.getData() // 无人机轨迹数据
  },
  methods: {
    // 走航车轨迹数据
    async getData() {
      this.$request({
        url: '/cruiser/cruiserTrajectory',
        method: 'get',
        params: {
          mac: 'p5dnd7a0243622',
          time1: '2022-11-01 00:00:00',
          time2: '2022-11-02 00:00:00'
        }
      }).then(res => {
        // console.log(res)
        this.planData = res.data
        this.mapCenterlon = res.data[0].flylon
        this.mapCenterlat = res.data[0].flylat
        // console.log(this.mapCenterlon, this.mapCenterlat)
        this.map = new window.BMapGL.Map('map_container')
        this.map.centerAndZoom(new BMapGL.Point(this.mapCenterlon, this.mapCenterlat), 19) // 初始化地图,设置中心点坐标和地图级别
        this.map.enableScrollWheelZoom() // 开启鼠标滚轮缩放
        // 地球模式
        this.map.setMapType(BMAP_EARTH_MAP) // 设置地图类型为地球模式
        this.map.setTilt(0) // 设置地图的倾斜角度
      })
    }
  }
}
</script>
 
<style scoped>
.Map{
  width: 100%;
  height: 100%;
}
</style>