Pārlūkot izejas kodu

船舶镜屏推送

wangkang3 4 gadi atpakaļ
vecāks
revīzija
7a3c1d2c4f

+ 1 - 1
ebc-middle-platform/src/constants.js

@ -16,4 +16,4 @@ export const GIS_SEA_LAYER_URL = 'http://192.168.74.189:9999/tdtvector' // 海
16 16
export const GIS_SEA_URL = 'http://192.168.74.216:5071/gisserver/dzht/dzht/wmts' // 海图地址
17 17
export const GIS_CENTER = [33.597844, 123.647472] // 海图中心点
18 18
export const GIS_ZOOM = 7 // 海图默认缩放
19
export const socketUrl = 'ws://127.0.0.1:7100/stomp'
19
export const socketUrl = 'ws://10.19.90.34:7100/stomp'

+ 3 - 0
ebc-middle-platform/src/ipu-stomp.js

@ -25,4 +25,7 @@ function successCallback() {
25 25
  stompClient.subscribe('personnel', msg => {
26 26
    EventBus.$emit('person', msg)
27 27
  })
28
  stompClient.subscribe('ship', msg => {
29
    EventBus.$emit('ship', msg)
30
  })
28 31
}

+ 76 - 0
ebc-middle-platform/src/modules/orientation/orientation.vue

@ -331,6 +331,10 @@ export default {
331 331
    EventBus.$on('person', (msg) => { // 获取镜屏推送消息
332 332
      this.changeLocation(msg)
333 333
    })
334
    EventBus.$on('ship', (msg) => { // 获取镜屏推送消息
335
      console.log(msg)
336
      this.changeShip(msg)
337
    })
334 338
  },
335 339
  methods: {
336 340
    async getGisToken() {
@ -345,6 +349,7 @@ export default {
345 349
    },
346 350
    changeLocation(msg) { // 修改人员信息状态等
347 351
      var obj = JSON.parse(msg.body)
352
      console.log('person' + obj)
348 353
      var flag = false
349 354
      this.layer.personLayer.eachLayer((e) => {
350 355
        if (e.getAttributes().deviceId == obj.deviceId) {
@ -368,6 +373,49 @@ export default {
368 373
        this.popupContent(obj, point)
369 374
      }
370 375
    },
376
    changeShip(msg) {
377
      var obj = JSON.parse(msg.body)
378
      console.log('ship' + obj)
379
      this.layer.equipmentLayer.eachLayer((point) => {
380
        if (point.getAttributes().DEVICE_NO == obj.deviceNo) {
381
          point.setLatLng([obj.latitude, obj.longitude])
382
          this.popupContentShip(obj, point)
383
        }
384
      })
385
    },
386
    popupContentShip(e, point) {
387
      point.on('click', (pointE) => {
388
        var content =
389
                  '<div class="tips-item"><div class="top"><div>' + e.shipName + '</div></div><div class="middle"><div class="row">' +
390
                  '<div>设备编号</div>' +
391
                  '<div>' + e.deviceNo + '</div>' +
392
                  '</div>' +
393
                  '<div class="row">' +
394
                  '<div>经度</div>' +
395
                  '<div>' + e.longitude + '</div>' +
396
                  '</div>' +
397
                  '<div class="row">' +
398
                  '<div>纬度</div>' +
399
                  '<div>' + e.latitude + '</div>' +
400
                  '</div>' +
401
                  '<div class="row">' +
402
                  '<div>最新定位时间</div>' +
403
                  '<div>' + e.newDate + '</div>' +
404
                  '</div>' +
405
                  '</div></div>' +
406
                  '</div></div>'
407
        Ai.Popup({
408
          minWidth: 300,
409
          offset: [0, -10],
410
          autoClose: true
411
        })
412
        // 设置弹出框弹出位置
413
          .setLatLng(point.getLatLng())
414
        // 设置弹出框弹出内容
415
          .setContent(content)
416
          .openOn(this.map)
417
      })
418
    },
371 419
    popupContent(e, point) { // 修改点的信息
372 420
      console.log(e, point)
373 421
      window.Vue = this
@ -589,6 +637,34 @@ export default {
589 637
              })
590 638
            })
591 639
            point.setAttributes(e)
640
            point.on('click', (pointE) => {
641
              var deviceContent = e.DEVICE_NO ? ('<div class="row"><div>设备编号</div><div>' + e.DEVICE_NO + '</div></div>') : ''
642
              var dateCOntent = e.NEW_DATE ? ('<div class="row"><div>最新定位时间</div><div>' + e.NEW_DATE + '</div></div>') : ''
643
              var content =
644
                  '<div class="tips-item"><div class="top"><div>' + e.FACILITY_NAME + '</div></div><div class="middle">' +
645
                  deviceContent +
646
                  '<div class="row">' +
647
                  '<div>经度</div>' +
648
                  '<div>' + e.LONGITUDE + '</div>' +
649
                  '</div>' +
650
                  '<div class="row">' +
651
                  '<div>纬度</div>' +
652
                  '<div>' + e.LATITUDE + '</div>' +
653
                  '</div>' +
654
                  dateCOntent +
655
                  '</div></div>' +
656
                  '</div></div>'
657
              Ai.Popup({
658
                minWidth: 300,
659
                offset: [0, -10],
660
                autoClose: true
661
              })
662
                // 设置弹出框弹出位置
663
                .setLatLng(point.getLatLng())
664
                // 设置弹出框弹出内容
665
                .setContent(content)
666
                .openOn(this.map)
667
            })
592 668
            if (['001', '002', '003'].indexOf(e.FACILITY_TYPE) !== -1) {
593 669
              this.layer.equipmentLayer.addLayer(point)
594 670
            }