wangkang3 %!s(int64=4) %!d(string=hace) años
padre
commit
ee5c1bbae7

+ 21 - 0
ebc-middle-platform/src/assets/styles/_reset.scss

@ -18,4 +18,25 @@ html,
18 18
19 19
.form--lg .form-checkbox .form-checkbox__inner {
20 20
  padding-left: 26px;
21
}
22
23
.menu--dark.menu{
24
  background-color: $theme-dark-menu-bg;
25
}
26
.navs--light.navs--horizontal > .navs__item:hover{
27
  color:$white;
28
  border-bottom-color: $white;
29
}
30
.navs--light .navs__item, .navs--light .navs__submenu-title{
31
  color: rgba(255, 255, 255, 0.65);
32
}
33
.navs--light .navs__item, .navs--light .navs__submenu-title:has(.navs__item--checked){
34
  color: $brand-primary;
35
  background-color: transparent;
36
  border-color: $brand-primary;
37
}
38
.navs--light .navs__item--checked{
39
  color: $brand-primary;
40
  background-color: transparent;
41
  border-color: $brand-primary;
21 42
}

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

@ -16,3 +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 - 99
ebc-middle-platform/src/ipu-stomp.js

@ -1,108 +1,28 @@
1 1
import SockJS from 'sockjs-client'
2 2
import Stomp from 'stompjs'
3
// import UUID from './uuid'
3
import {socketUrl} from '@/constants'
4
import EventBus from './bus'
4 5
5
// define(["sockjs", "stomp", "uuid"],function(SockJS, Stomp, UUID) {
6
// var IpuStomp = {};
6
var socket = null
7
var stompClient = null
7 8
8
export default function (params, callbacks) {
9
  var onConnected, onFailure
10
  if (callbacks) {
11
    /* 供stomp.js中做判断:args[1] instanceof Function */
12
    onConnected = callbacks.onConnected ? callbacks.onConnected : new Function()
13
    onFailure = callbacks.onFailure ? callbacks.onFailure : new Function()
14
  } else {
15
    onConnected = new Function()
16
    onFailure = new Function()
17
  }
18
  var client
19
  if (params.url.startsWith('http') || params.url.startsWith('https')) { // SockJS支持http和https前缀
20
    var socket = new SockJS(params.url)
21
    client = Stomp.over(socket)
9
export default function initWebSocket(params) {
10
  if (socketUrl.startsWith('http') || socketUrl.startsWith('https')) {
11
    socket = new SockJS(socketUrl)// 连接服务端
12
    stompClient = Stomp.over(socket)
22 13
  } else { // SockJS支持ws前缀
23
    client = Stomp.client(params.url)
14
    stompClient = Stomp.client(socketUrl)
24 15
  }
25
  var headers = {'name': params.name, 'passcode': params.passcode, 'host': params.host, 'uuid': params.UUID}
26
  client.connect(headers, onConnected, onFailure)
27
  return new StompClient(client)
28
}
29
30
// IpuStomp.connect = function(url, login, passcode, callbacks, host){
31
// 	if(url.startsWith("http")||url.startsWith("https")){
32
// 		return connectWithSockJS(url, login, passcode, callbacks, host); //SockJS支持http和https前缀
33
// 	}else {
34
// 		return connectWithStomp(url, login, passcode, callbacks, host); //SockJS支持ws前缀
35
// 	}
36
// }
37
//
38
// function connectWithStomp(url, login, passcode, callbacks, host){
39
// 	var onConnected, onFailure;
40
//     if(callbacks){
41
//     	/*供stomp.js中做判断:args[1] instanceof Function*/
42
//     	onConnected = callbacks.onConnected?callbacks.onConnected:new Function();
43
//         onFailure = callbacks.onFailure?callbacks.onFailure:new Function();
44
//     }else{
45
//     	onConnected = new Function();
46
//     	onFailure = new Function();
47
//     }
48
//     var client = Stomp.client(url);
49
//     var headers = {"login":login,"passcode":passcode,"host":host,"uuid":UUID};
50
//     client.connect(headers, onConnected, onFailure);
51
//     return new StompClient(client);
52
// }
53
//
54
// function connectWithSockJS(url, login, passcode, callbacks, host){
55
// 	var onConnected, onFailure;
56
//     if(callbacks){
57
//     	/*供stomp.js中做判断:args[1] instanceof Function*/
58
//     	onConnected = callbacks.onConnected?callbacks.onConnected:new Function();
59
//         onFailure = callbacks.onFailure?callbacks.onFailure:new Function();
60
//     }else{
61
//     	onConnected = new Function();
62
//     	onFailure = new Function();
63
//     }
64
//
65
// 	var socket = new SockJS(url);
66
//     var client = Stomp.over(socket);
67
//     var headers = {"login":login,"passcode":passcode,"host":host,"uuid":UUID};
68
//     client.connect(headers, onConnected, onFailure);
69
//     return new StompClient(client);
70
// }
71
72
function StompClient(client) {
73
  this.client = client
74
}
75
76
StompClient.prototype.setTopicPath = function(topicPath) {
77
//   topicPath = topicPath.startsWith('/') ? topicPath : '/' + topicPath
78
//   topicPath = topicPath.endsWith('/') ? topicPath : topicPath + '/'
79
//   console.log(topicPath)
80
  this.topicPath = topicPath
81
}
82
83
StompClient.prototype.disconnect = function() {
84
  this.client.disconnect()
85
}
86
87
StompClient.prototype.connected = function() {
88
  return this.client.connected
16
  stompClient.connect(params, (frame) => {
17
    successCallback()
18
  }, () => {
19
    initWebSocket(params)
20
  })
21
  return stompClient
89 22
}
90 23
91
StompClient.prototype.subscribe = function(topic, callback) {
92
//   return this.client.subscribe(this.topicPath + topic, callback)
93
  return this.client.subscribe(this.topicPath, callback)
24
function successCallback() {
25
  stompClient.subscribe('personnel', msg => {
26
    EventBus.$emit('person', msg)
27
  })
94 28
}
95
96
StompClient.prototype.publish = function(topic, text) {
97
//   this.client.send(this.topicPath + topic, {}, text)
98
  this.client.send(this.topicPath, {}, text)
99
}
100
101
// return IpuStomp;
102
// })
103
104
// export default {
105
//     IpuStomp: {
106
//         connect:IpuStomp.connect
107
//     }
108
// }

+ 25 - 29
ebc-middle-platform/src/modules/layouts/BasicLayout.vue

@ -43,8 +43,8 @@
43 43
44 44
<script>
45 45
import GlobalLayout from '../page/GlobalLayout.vue'
46
import IpuStomp from '../../ipu-stomp'
47 46
import EventBus from '../../bus'
47
import initWebSocket from '../../ipu-stomp'
48 48
export default {
49 49
  name: 'BasicLayout',
50 50
  components: {
@ -67,38 +67,34 @@ export default {
67 67
  },
68 68
  mounted() {
69 69
    // 镜屏调用
70
    var client
71
    var callbacks = {}
72
    callbacks.onConnected = msg => {
73
      console.log('连接成功:' + msg)
74
      client.subscribe('zhangsan', msg => {
75
        var obj = JSON.parse(msg.body)
76
        if (obj.isNewAlarm == '1') {
77
          this.alarmObj.alarmType = obj.alarmType
78
          this.alarmObj.alarmLocation = obj.longitude + ' , ' + obj.latitude
79
          this.alarmObj.userName = obj.userName
80
          this.modal = true
81
        }
82
        EventBus.$emit('person', msg)
83
      })
84
    }
85
    callbacks.onFailure = msg => {
86
      console.log('连接失败:' + msg)
87
    }
88
    client = IpuStomp(
89
      {
90
        url: 'ws://10.19.90.34:7100/stomp',
91
        name: 'zhangsan',
92
        passcode: '123456',
93
        UUID: 'zhangsan'
94
      },
95
      callbacks
96
    )
97
    client.setTopicPath('personnel')
70
    initWebSocket({name: 'zhangsan', passcode: '123456', uuid: this.uuid()})
71
    EventBus.$on('person', (msg) => { // 获取镜屏推送消息
72
      console.log(msg)
73
      var obj = JSON.parse(msg.body)
74
      if (obj.isNewAlarm == '1') {
75
        this.alarmObj.alarmType = obj.alarmType
76
        this.alarmObj.alarmLocation = obj.longitude + ' , ' + obj.latitude
77
        this.alarmObj.userName = obj.userName
78
        this.modal = true
79
      }
80
    })
98 81
  },
99 82
  methods: {
100 83
    closeAlarmModal() {
101 84
      this.modal = false
85
    },
86
    uuid() {
87
      var s = []
88
      var hexDigits = '0123456789abcdef'
89
      for (var i = 0; i < 36; i++) {
90
        s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1)
91
      }
92
      s[14] = '4' // bits 12-15 of the time_hi_and_version field to 0010
93
      s[19] = hexDigits.substr((s[19] & 0x3) | 0x8, 1) // bits 6-7 of the clock_seq_hi_and_reserved to 01
94
      s[8] = s[13] = s[18] = s[23] = '-'
95
96
      var uuid = s.join('')
97
      return uuid
102 98
    }
103 99
  }
104 100
}

+ 17 - 1
ebc-middle-platform/src/modules/orientation/orientation.vue

@ -345,12 +345,28 @@ export default {
345 345
    },
346 346
    changeLocation(msg) { // 修改人员信息状态等
347 347
      var obj = JSON.parse(msg.body)
348
      var flag = false
348 349
      this.layer.personLayer.eachLayer((e) => {
349 350
        if (e.getAttributes().deviceId == obj.deviceId) {
351
          flag = true
350 352
          e.setLatLng([obj.latitude, obj.longitude])
351 353
          this.popupContent(obj, e)
352 354
        }
353 355
      })
356
      if (!flag) {
357
        var point = Ai.Point([obj.latitude, obj.longitude], {
358
          icon: Ai.Icon({
359
            iconUrl: '/static/images/normalworker.png',
360
            // 设置图标大小
361
            iconSize: [20, 20],
362
            // 设置点对象和图标的相对偏移量
363
            iconAnchor: [0, 0]
364
          })
365
        })
366
        point.setAttributes(obj)
367
        this.layer.personLayer.addLayer(point)
368
        this.popupContent(obj, point)
369
      }
354 370
    },
355 371
    popupContent(e, point) { // 修改点的信息
356 372
      console.log(e, point)
@ -399,7 +415,7 @@ export default {
399 415
        if (e.locationStatus == '2') {
400 416
          other = '<div class="row outline">' +
401 417
                  '<div>定点停留超时</div>' +
402
                  '<div>' + e.fixedLong + 'min</div>' +
418
                  '<div>已停留' + e.fixedLong + 'min</div>' +
403 419
                  '</div>'
404 420
        } else {
405 421
          other = '<div class="row outline">' +

+ 3 - 7
ebc-middle-platform/src/modules/system-management/map-mark.vue

@ -188,8 +188,7 @@
188 188
<script>
189 189
import './map-mark.scss'
190 190
import services from '../../conf/services'
191
import {GIS_SEA_LAYER_URL, GIS_SEA_URL, GIS_CENTER,
192
  GIS_ZOOM} from '../../constants'
191
import {GIS_SEA_LAYER_URL, GIS_SEA_URL, GIS_CENTER, GIS_ZOOM} from '../../constants'
193 192
export default {
194 193
  data() {
195 194
    return {
@ -202,8 +201,6 @@ export default {
202 201
        }
203 202
      },
204 203
      queryCondition: {
205
        type: '',
206
        alarmPerson: '',
207 204
        userName: ''
208 205
      },
209 206
      rangeDate: '',
@ -263,7 +260,7 @@ export default {
263 260
      this.polygonDrawer.enable() // 激活多边形绘制工具
264 261
      this.map.on(AiDrawEvent.CREATED, (e) => {
265 262
      // debugger
266
        console.log(1)
263
        console.log(e)
267 264
        this.layer = this.polygonDrawer.polygon(e) // 获取多边形信息
268 265
        // console.log(this.polygonDrawer.getPoints())
269 266
        this.modalData = this.layer._latlngs[0]
@ -472,8 +469,7 @@ export default {
472 469
      return year + '-' + mon + '-' + da + ' ' + h + '-' + m + '-' + s
473 470
    },
474 471
    cancel() {
475
      console.log(this.layer)
476
      if (this.layer !== undefined) {
472
      if (this.map.hasLayer(this.layer)) {
477 473
        this.map.removeLayer(this.layer)
478 474
      }
479 475
      this.polygonDrawer.disable()