chenxr3 4 年 前
コミット
91c381823f
共有2 個のファイルを変更した51 個の追加23 個の削除を含む
  1. 13 0
      ebc-middle-platform/src/modules/layouts/BasicLayout.vue
  2. 38 23
      ebc-middle-platform/src/modules/orientation/orientation.vue

+ 13 - 0
ebc-middle-platform/src/modules/layouts/BasicLayout.vue

@ -74,8 +74,20 @@ export default {
74 74
    // 镜屏调用
75 75
    this.load()
76 76
    this.connect()
77
    this.getGisToken()
77 78
  },
78 79
  methods: {
80
    async getGisToken() { // 获取GIS token并存入store
81
      await this.$test
82
          .post(services.mapTag.GET_MAP_PARAM, '')
83
          .then((res) => {
84
            this.$store.commit('setGisToken', res.data.ak)
85
            this.$store.commit('setMapParam', {center: [res.data.latitude, res.data.longitude], zoom: res.data.scale})
86
          })
87
          .catch((res) => {
88
            // 请求失败处理...
89
          })
90
    },
79 91
    load() {
80 92
      this.$test
81 93
        .post(services.organization.BIND_DEVICE, {})
@ -154,6 +166,7 @@ export default {
154 166
      this.stompClient.subscribe('alarm', (msg) => {
155 167
        console.log('alarm' + msg)
156 168
        this.alarmOpen(msg)
169
        EventBus.$emit('person', msg.body)
157 170
      })
158 171
      this.stompClient.subscribe('ship', (msg) => {
159 172
        console.log(msg)

+ 38 - 23
ebc-middle-platform/src/modules/orientation/orientation.vue

@ -271,12 +271,14 @@ export default {
271 271
    }
272 272
  },
273 273
  mounted() {
274
    this.getTagType()
275
    this.getToolType()
276
    this.getGisToken().then(() => { // 获取gistoken后加载地图
277
      this.initMap()
278
      this.initTrackMap()
279
      this.initStatusCount()
274
    // this.getGisToken().then(() => { // 获取gistoken后加载地图
275
    // })
276
    this.getTagType().then(() => {
277
      this.getToolType().then(() => {
278
        this.initMap()
279
        this.initTrackMap()
280
        this.initStatusCount()
281
      })
280 282
    })
281 283
    setInterval(() => { // 当前时间
282 284
      this.nowDate = new Date()
@ -301,19 +303,19 @@ export default {
301 303
    })
302 304
  },
303 305
  methods: {
304
    async getGisToken() { // 获取GIS token并存入store
306
    // async getGisToken() { // 获取GIS token并存入store
307
    //   await this.$test
308
    //     .post(services.mapTag.GET_MAP_PARAM, '')
309
    //     .then((res) => {
310
    //       this.$store.commit('setGisToken', res.data.ak)
311
    //       this.$store.commit('setMapParam', {center: [res.data.latitude, res.data.longitude], zoom: res.data.scale})
312
    //     })
313
    //     .catch((res) => {
314
    //       // 请求失败处理...
315
    //     })
316
    // },
317
    async getTagType() {
305 318
      await this.$test
306
        .post(services.mapTag.GET_MAP_PARAM, '')
307
        .then((res) => {
308
          this.$store.commit('setGisToken', res.data.ak)
309
          this.$store.commit('setMapParam', {center: [res.data.latitude, res.data.longitude], zoom: res.data.scale})
310
        })
311
        .catch((res) => {
312
          // 请求失败处理...
313
        })
314
    },
315
    getTagType: function () {
316
      this.$test
317 319
        .post(services.mapTag.MAP_TAG_TYPE, {})
318 320
        .then((res) => {
319 321
          // 请求成功处理...
@ -326,8 +328,8 @@ export default {
326 328
          // 请求失败处理...
327 329
        })
328 330
    },
329
    getToolType: function () {
330
      this.$test.post(services.equipment.EQUIPMENT_TYPE, {}
331
    async getToolType() {
332
      await this.$test.post(services.equipment.EQUIPMENT_TYPE, {}
331 333
      ).then(res => {
332 334
        // 请求成功处理...
333 335
        this.toolTypes = res.data
@ -711,7 +713,7 @@ export default {
711 713
          return 'sso'
712 714
          break
713 715
        case '040': // 手动告警 ------ 红色
714
          return 'sso'
716
          return 'sos'
715 717
          break
716 718
        case '030': // 离线 ------ 灰色
717 719
          return 'offline'
@ -806,10 +808,16 @@ export default {
806 808
        .then((res) => {
807 809
          console.log(res)
808 810
          res.data.forEach(e => {
811
            var url = ''
812
            this.toolTypes.forEach(t => {
813
              if (e.resourceToolType == t.resourceToolType) {
814
                url = t.iconUrl
815
              }
816
            })
809 817
            var point = Ai.Point([e.latitude, e.longitude], {
810 818
              icon: Ai.Icon({
811 819
                // 设置图标URL路径
812
                iconUrl: '/static/images/fan.png',
820
                iconUrl: url,
813 821
                // 设置图标大小
814 822
                iconSize: [20, 20],
815 823
                // 设置点对象和图标的相对偏移量
@ -920,7 +928,14 @@ export default {
920 928
            var la = new Ai.FeatureGroup()
921 929
            res.data.forEach(e => {
922 930
              var wktstr = e.mapAreaContent
923
              var polygon = Ai.Polygon(wktstr, {color: 'red'})
931
              debugger
932
              var areaColor = ''
933
              this.markTypes.forEach(m => {
934
                if (m.mapAreaBusinessType == e.businessType) {
935
                  areaColor = m.color
936
                }
937
              })
938
              var polygon = Ai.Polygon(wktstr, {color: areaColor, opacity: 1.0, weight: 1.2})
924 939
              la.addLayer(polygon)
925 940
            })
926 941
            this.trackMap.addLayer(la)