|
@@ -91,7 +91,7 @@ export const useShipMapStore = defineStore('shipMap', () => {
|
|
|
})
|
|
|
state.map.addOverlay(state.ws.overlayTrack)
|
|
|
// 预警助手
|
|
|
- // initWarningWS()
|
|
|
+ initWarningWS()
|
|
|
}
|
|
|
const mapPointerMove = (ev) => {
|
|
|
let pixel = ev.pixel
|
|
@@ -400,22 +400,61 @@ export const useShipMapStore = defineStore('shipMap', () => {
|
|
|
});
|
|
|
state.ws.layerShip.setSource(vectorSource)
|
|
|
}
|
|
|
- const mockWarningWS = () => {
|
|
|
- state.warningInfo = {
|
|
|
- name: v4(),
|
|
|
- time: new Date().getTime(),
|
|
|
- }
|
|
|
- }
|
|
|
const initWarningWS = () => {
|
|
|
- setInterval(() => {
|
|
|
+ // const js = {
|
|
|
+ // "createBy" : "admin",
|
|
|
+ // "createTime" : "2025-01-14 11:19:26",
|
|
|
+ // "updateBy" : "admin",
|
|
|
+ // "updateTime" : "2025-01-14 11:19:26",
|
|
|
+ // "id" : "0b3bae57-c422-4b5e-a700-860e346755b1",
|
|
|
+ // "modelCode" : "TJ_CB_00_01",
|
|
|
+ // "modelId" : "1",
|
|
|
+ // "ruleId" : "d4dde331749847618f163e6a0c25472d",
|
|
|
+ // "ruleName" : "北斗终端异常-10分钟",
|
|
|
+ // "modelName" : "北斗终端异常",
|
|
|
+ // "warnTime" : "2025-01-14 11:10:18.464",
|
|
|
+ // "dynamicShipList" : [ {
|
|
|
+ // "mergeId" : "814640307768528896",
|
|
|
+ // "mergeTarget" : "100000000015005642",
|
|
|
+ // "mergeTime" : "2025-01-14 11:00:18.176",
|
|
|
+ // "mergeType" : "BEIDOU",
|
|
|
+ // "targetName" : "万0308014",
|
|
|
+ // "targetShipType" : "30",
|
|
|
+ // "targetNationality" : "412",
|
|
|
+ // "targetSpeed" : 0.0,
|
|
|
+ // "targetCourse" : 0.0,
|
|
|
+ // "targetLongitude" : 110.390722,
|
|
|
+ // "targetLatitude" : 18.704444,
|
|
|
+ // "targetLength" : 13.7,
|
|
|
+ // "targetSource" : [ {
|
|
|
+ // "id" : "1724073477",
|
|
|
+ // "time" : "2025-01-14 11:00:14",
|
|
|
+ // "type" : "BEIDOU",
|
|
|
+ // "signalLoss" : false,
|
|
|
+ // "trackDeviceNo" : "15005642",
|
|
|
+ // "trackId" : "15005642"
|
|
|
+ // } ]
|
|
|
+ // } ]
|
|
|
+ // }
|
|
|
+ // setTimeout(() => {
|
|
|
+ // state.warningInfo = js
|
|
|
+ // }, 1000)
|
|
|
+ const ws = new WebSocket(`ws://${location.host}/ws-api/shipwarnrecord`)
|
|
|
+ ws.onopen = (e) => {
|
|
|
+ }
|
|
|
+ ws.onmessage = (e) => {
|
|
|
if (state.warningOpen) {
|
|
|
- mockWarningWS()
|
|
|
+ try {
|
|
|
+ const json = JSON.parse(e.data)
|
|
|
+ console.log(json)
|
|
|
+ state.warningInfo = json
|
|
|
+ } catch (e) {
|
|
|
+ }
|
|
|
}
|
|
|
- }, 1000)
|
|
|
+ }
|
|
|
}
|
|
|
return {
|
|
|
...toRefs(state),
|
|
|
initMap,
|
|
|
- mockWarningWS,
|
|
|
}
|
|
|
})
|