|
@@ -228,38 +228,27 @@ export const useShipMapStore = defineStore('shipMap', () => {
|
|
})
|
|
})
|
|
state.map.addLayer(lineLayer)
|
|
state.map.addLayer(lineLayer)
|
|
state.map.addLayer(pointsLayer)
|
|
state.map.addLayer(pointsLayer)
|
|
- // const ws = new WebSocket(`ws://${location.host}/history-track-ws-api/history-fkShips-track`)
|
|
|
|
- // ws.onopen = (e) => {
|
|
|
|
- // const str = {
|
|
|
|
- // shipId: feature.get('_id'),
|
|
|
|
- // startTime: YMDHms(new Date(d[state.trackKeys.mergeTime]).getTime() - 1000 * 60 * 60),
|
|
|
|
- // endTime: YMDHms(d[state.trackKeys.mergeTime]),
|
|
|
|
- // searchType: 1,
|
|
|
|
- // sendInterval: 1
|
|
|
|
- // }
|
|
|
|
- // ws.send(JSON.stringify(str))
|
|
|
|
- // }
|
|
|
|
- // ws.onmessage = (e) => {
|
|
|
|
- // try {
|
|
|
|
- // const json = JSON.parse(e.data)
|
|
|
|
- // if (json.message === '查询结束') {
|
|
|
|
- // ws.close()
|
|
|
|
- // } else if (json.data?.length > 0) {
|
|
|
|
- // state.trackMap.get(feature.get('_id')).history.push(...json.data.map(v => ({
|
|
|
|
- // targetName: v.shipName,
|
|
|
|
- // mergeTarget: v.shipId,
|
|
|
|
- // targetLongitude: v.shipLon,
|
|
|
|
- // targetLatitude: v.shipLat,
|
|
|
|
- // targetCourse: v.shipCourse,
|
|
|
|
- // targetSpeed: v.shipSpeed,
|
|
|
|
- // mergeTime: v.trackTime,
|
|
|
|
- // targetSourceJson: v.targetSource,
|
|
|
|
- // })))
|
|
|
|
- // state.trackMap.get(feature.get('_id')).refreshTrackStyle()
|
|
|
|
- // }
|
|
|
|
- // } catch (e) {
|
|
|
|
- // }
|
|
|
|
- // }
|
|
|
|
|
|
+ const ws = new WebSocket(`ws://${location.host}/history-track-ws-api/historyshiptrack`)
|
|
|
|
+ ws.onopen = (e) => {
|
|
|
|
+ const str = {
|
|
|
|
+ mergeTarget: feature.get('_id'),
|
|
|
|
+ startTime: YMDHms(new Date(d[state.trackKeys.mergeTime]).getTime() - 1000 * 60 * 60),
|
|
|
|
+ endTime: YMDHms(d[state.trackKeys.mergeTime]),
|
|
|
|
+ }
|
|
|
|
+ ws.send(JSON.stringify(str))
|
|
|
|
+ }
|
|
|
|
+ ws.onmessage = (e) => {
|
|
|
|
+ try {
|
|
|
|
+ const json = JSON.parse(e.data)
|
|
|
|
+ if (json.message === '查询结束') {
|
|
|
|
+ ws.close()
|
|
|
|
+ } else if (json.data?.length > 0) {
|
|
|
|
+ state.trackMap.get(feature.get('_id')).history.push(...json.data)
|
|
|
|
+ state.trackMap.get(feature.get('_id')).refreshTrackStyle()
|
|
|
|
+ }
|
|
|
|
+ } catch (e) {
|
|
|
|
+ }
|
|
|
|
+ }
|
|
initWebSocket()
|
|
initWebSocket()
|
|
}
|
|
}
|
|
}
|
|
}
|