|
|
@ -122,6 +122,8 @@ |
|
|
|
import { isArray, isString } from '/@/utils/is'; |
|
|
|
import { isArray, isString } from '/@/utils/is'; |
|
|
|
import { useI18n } from '/@/hooks/web/useI18n'; |
|
|
|
import { useI18n } from '/@/hooks/web/useI18n'; |
|
|
|
import { useDebounceFn } from '@vueuse/core'; |
|
|
|
import { useDebounceFn } from '@vueuse/core'; |
|
|
|
|
|
|
|
import { EventSourcePolyfill } from 'event-source-polyfill/src/eventsource'; |
|
|
|
|
|
|
|
import { getAccessToken } from '/@/utils/auth'; |
|
|
|
|
|
|
|
|
|
|
|
/** 类型规范统一声明定义区域 */ |
|
|
|
/** 类型规范统一声明定义区域 */ |
|
|
|
interface MapState { |
|
|
|
interface MapState { |
|
|
@ -168,6 +170,7 @@ |
|
|
|
let courierUserMarkerCluster; |
|
|
|
let courierUserMarkerCluster; |
|
|
|
let scanCourierUserCircleRange; |
|
|
|
let scanCourierUserCircleRange; |
|
|
|
let driving; |
|
|
|
let driving; |
|
|
|
|
|
|
|
let eventSource; |
|
|
|
const { t } = useI18n(); |
|
|
|
const { t } = useI18n(); |
|
|
|
const emit = defineEmits(['success']); |
|
|
|
const emit = defineEmits(['success']); |
|
|
|
const userStore = useUserStore(); |
|
|
|
const userStore = useUserStore(); |
|
|
@ -228,7 +231,6 @@ |
|
|
|
] |
|
|
|
] |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
const AForm = Form; |
|
|
|
const AForm = Form; |
|
|
|
const AFormItem = Form.Item; |
|
|
|
const AFormItem = Form.Item; |
|
|
|
const ASelect = Select; |
|
|
|
const ASelect = Select; |
|
|
@ -464,30 +466,22 @@ |
|
|
|
orgMarkerCluster?.setData(orgPoints); |
|
|
|
orgMarkerCluster?.setData(orgPoints); |
|
|
|
|
|
|
|
|
|
|
|
// sse长轮询连接获取收样员gps位置 |
|
|
|
// sse长轮询连接获取收样员gps位置 |
|
|
|
if (!!window.EventSource) { |
|
|
|
eventSource = new EventSourcePolyfill(mapDesigner.sseUrl, { |
|
|
|
// 建立连接 |
|
|
|
headers: { Authorization: `Bearer ${getAccessToken()}` } |
|
|
|
const source = new EventSource(mapDesigner.sseUrl); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
source.addEventListener('open', function (e) { |
|
|
|
eventSource.onopen =function (ev) { |
|
|
|
console.info(e,'建立连接。。。'); |
|
|
|
console.info(ev,'建立连接。。。'); |
|
|
|
}, false); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
source.addEventListener('message', function (e) { |
|
|
|
eventSource.onmessage = function (ev) { |
|
|
|
source.close(); |
|
|
|
console.info(ev); |
|
|
|
console.info(e); |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
source.addEventListener('error', function (e) { |
|
|
|
eventSource.onerror = function (ev) { |
|
|
|
console.info(e); |
|
|
|
console.info(ev); |
|
|
|
}, false); |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
notification.error({ |
|
|
|
|
|
|
|
message: '你的浏览器不支持SSE', |
|
|
|
|
|
|
|
description: '请更换浏览器,在尝试使用此功能!', |
|
|
|
|
|
|
|
duration: 2 |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 加载完毕 |
|
|
|
// 加载完毕 |
|
|
|
complete(); |
|
|
|
complete(); |
|
|
|
}).catch(error => { |
|
|
|
}).catch(error => { |
|
|
@ -497,6 +491,7 @@ |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
onUnmounted(() => { |
|
|
|
onUnmounted(() => { |
|
|
|
|
|
|
|
eventSource.close(); |
|
|
|
if (map) { |
|
|
|
if (map) { |
|
|
|
// 销毁地图实例 |
|
|
|
// 销毁地图实例 |
|
|
|
map.destroy() && map.clearEvents(); |
|
|
|
map.destroy() && map.clearEvents(); |
|
|
|