|
|
|
@ -122,7 +122,7 @@
@@ -122,7 +122,7 @@
|
|
|
|
|
import { isArray, isString } from '/@/utils/is'; |
|
|
|
|
import { useI18n } from '/@/hooks/web/useI18n'; |
|
|
|
|
import { useDebounceFn } from '@vueuse/core'; |
|
|
|
|
import { EventSourcePolyfill } from 'event-source-polyfill/src/eventsource'; |
|
|
|
|
import { NativeEventSource, EventSourcePolyfill } from 'event-source-polyfill/src/eventsource'; |
|
|
|
|
import { getAccessToken } from '/@/utils/auth'; |
|
|
|
|
|
|
|
|
|
/** 类型规范统一声明定义区域 */ |
|
|
|
@ -466,11 +466,12 @@
@@ -466,11 +466,12 @@
|
|
|
|
|
orgMarkerCluster?.setData(orgPoints); |
|
|
|
|
|
|
|
|
|
// sse长轮询连接获取收样员gps位置 |
|
|
|
|
eventSource = new EventSourcePolyfill(mapDesigner.sseUrl, { |
|
|
|
|
const EventSource = EventSourcePolyfill; |
|
|
|
|
eventSource = new EventSource(mapDesigner.sseUrl, { |
|
|
|
|
headers: { Authorization: `Bearer ${getAccessToken()}` } |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
eventSource.onopen =function (ev) { |
|
|
|
|
eventSource.onopen = function (ev) { |
|
|
|
|
console.info(ev,'建立连接。。。'); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
@ -491,6 +492,7 @@
@@ -491,6 +492,7 @@
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
onUnmounted(() => { |
|
|
|
|
console.log('结束'); |
|
|
|
|
eventSource.close(); |
|
|
|
|
if (map) { |
|
|
|
|
// 销毁地图实例 |
|
|
|
@ -500,6 +502,7 @@
@@ -500,6 +502,7 @@
|
|
|
|
|
|
|
|
|
|
/** 地图创建完成(动画关闭) */ |
|
|
|
|
function complete () { |
|
|
|
|
eventSource.close(); |
|
|
|
|
if (map) { |
|
|
|
|
map.on('complete', () => { |
|
|
|
|
setMapDataJson(mapProps.options); |
|
|
|
|