|
@@ -1,19 +1,59 @@
|
|
|
<template>
|
|
|
<div class="business">
|
|
|
<ShipFilterCom class="ship-filter" :map="map" :mapFunc="mapFunc" @getShipFilter="handleShipFilter"/>
|
|
|
- <TrackListCom class="track-list" :map="map" :mapFunc="mapFunc"/>
|
|
|
+ <div class="track-list">
|
|
|
+ <div class="track-item track-item-head">
|
|
|
+ <div class="source">目标来源</div>
|
|
|
+ <div class="key">轨迹标识</div>
|
|
|
+ <div class="time">轨迹持续时间</div>
|
|
|
+ <div class="do">操作</div>
|
|
|
+ </div>
|
|
|
+ <div class="track-item-body">
|
|
|
+ <template v-for="([key, item], index) in trackMap">
|
|
|
+ <div class="track-item">
|
|
|
+ <div class="source" :style="`color: ${item.config?.name};`">{{item.config?.name}}</div>
|
|
|
+ <div class="key" :style="`color: ${item.color};background: #ffffff;`">
|
|
|
+ <CusEllipsis :value="key"/>
|
|
|
+ </div>
|
|
|
+ <div class="time">{{item.trackTime}}</div>
|
|
|
+ <div class="do">
|
|
|
+ <el-tooltip :enterable="false" placement="top" content="隐藏" v-if="item.show">
|
|
|
+ <img class="__hover" src="@/assets/images/ship-test/ship-track-visible.svg" @click="handleTrackHide(key)"/>
|
|
|
+ </el-tooltip>
|
|
|
+ <el-tooltip :enterable="false" placement="top" content="显示" v-else>
|
|
|
+ <img class="__hover" src="@/assets/images/ship-test/ship-track-invisible.svg" @click="handleTrackShow(key)"/>
|
|
|
+ </el-tooltip>
|
|
|
+ <el-tooltip :enterable="false" placement="top" content="定位">
|
|
|
+ <img class="__hover" src="@/assets/images/ship-test/tools-location.svg" @click="handleTrackLocation(key)"/>
|
|
|
+ </el-tooltip>
|
|
|
+ <el-tooltip :enterable="false" placement="top" content="调色盘">
|
|
|
+ <div class="color">
|
|
|
+ <img class="__hover" src="@/assets/images/ship-test/ship-track-speed.svg"/>
|
|
|
+ <el-color-picker v-model="item.color" @change="color => handleTrackColor(key, color)"/>
|
|
|
+ </div>
|
|
|
+ </el-tooltip>
|
|
|
+ <el-tooltip :enterable="false" placement="top" content="删除">
|
|
|
+ <img class="__hover" src="@/assets/images/ship-test/ship-track-delete.svg" @click="handleTrackDel(key)"/>
|
|
|
+ </el-tooltip>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
<div class="hover-info" ref="ref_shipHover">
|
|
|
<div class="hover-info-head">
|
|
|
- <span>{{ shipHoverInfo?.isHistory ? '历史' : '实时'}}</span>
|
|
|
+ <span>{{shipHoverInfo?.config?.name}}_{{ shipHoverInfo?.isHistory ? '历史' : '实时'}}</span>
|
|
|
</div>
|
|
|
<div class="hover-info-close __hover" @click="shipHover.setPosition(undefined)">
|
|
|
<img src="@/components/easyMap/images/close.png" alt=""/>
|
|
|
</div>
|
|
|
<div class="hover-main" v-if="shipHoverInfo?.data">
|
|
|
- <div class="hover-item">
|
|
|
- <div class="hover-item-label">名称:</div>
|
|
|
- <div class="hover-item-value">{{shipHoverInfo.data}}</div>
|
|
|
- </div>
|
|
|
+ <template v-for="item in shipHoverInfoCpt">
|
|
|
+ <div class="hover-item">
|
|
|
+ <div class="hover-item-label">{{item.label}}:</div>
|
|
|
+ <div class="hover-item-value">{{item.value}}</div>
|
|
|
+ </div>
|
|
|
+ </template>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -36,7 +76,6 @@ import {useStore} from 'vuex'
|
|
|
import {useRouter, useRoute} from 'vue-router'
|
|
|
import {ElMessage, ElMessageBox} from "element-plus";
|
|
|
import ShipFilterCom from "./ship-filter.vue";
|
|
|
-import TrackListCom from "./track-list.vue";
|
|
|
import * as source from "ol/source";
|
|
|
import * as layer from "ol/layer";
|
|
|
import ShipStyle from "@/views/ship-test/business/shipStyle";
|
|
@@ -47,7 +86,6 @@ export default defineComponent({
|
|
|
name: '',
|
|
|
components: {
|
|
|
ShipFilterCom,
|
|
|
- TrackListCom
|
|
|
},
|
|
|
props: {
|
|
|
map: <any>{},
|
|
@@ -60,7 +98,7 @@ export default defineComponent({
|
|
|
const that = (getCurrentInstance() as ComponentInternalInstance).appContext.config.globalProperties
|
|
|
const state = reactive({
|
|
|
zoomWMS: true,
|
|
|
- wsMap: new Map(),
|
|
|
+ currentWS: <any>null,
|
|
|
wsLayer: <any>null,
|
|
|
shipFilter: {
|
|
|
cql: null,
|
|
@@ -68,7 +106,8 @@ export default defineComponent({
|
|
|
},
|
|
|
trackMap: new Map(),
|
|
|
shipHover: <any>null,
|
|
|
- shipHoverInfo: <any>{}
|
|
|
+ shipHoverInfo: <any>{},
|
|
|
+ currentTime: 1
|
|
|
})
|
|
|
const ref_shipHover = ref()
|
|
|
const initMap = () => {
|
|
@@ -129,7 +168,7 @@ export default defineComponent({
|
|
|
}
|
|
|
const handleShipClick = (clickFeat) => {
|
|
|
const color = `rgb(${that.$util.randomNum(0, 255)}, ${that.$util.randomNum(0, 255)}, ${that.$util.randomNum(0, 255)})`
|
|
|
- const trackLayer: any = new layer.VectorImage({
|
|
|
+ const trackLayer: any = new layer.Vector({
|
|
|
zIndex: 10
|
|
|
})
|
|
|
props.map.addLayer(trackLayer)
|
|
@@ -141,7 +180,11 @@ export default defineComponent({
|
|
|
layer: trackLayer,
|
|
|
historyData: [],
|
|
|
realData: [],
|
|
|
- sourceId: clickFeat.get('_sourceId')
|
|
|
+ sourceId: clickFeat.get('_sourceId'),
|
|
|
+ config: clickFeat.get('_config'),
|
|
|
+ currentTime: 0,
|
|
|
+ show: true,
|
|
|
+ trackTime: '?'
|
|
|
})
|
|
|
initWebSocketShip()
|
|
|
const hWs = new WebSocket(clickFeat.get('_historyWsUrl'))
|
|
@@ -159,7 +202,9 @@ export default defineComponent({
|
|
|
const json = JSON.parse(e.data)
|
|
|
const s = 'json' + clickFeat.get('_historyWsDataFlag')
|
|
|
const data = eval(s)
|
|
|
- state.trackMap.get(trackId).historyData = data
|
|
|
+ const _historyData = [...state.trackMap.get(trackId).historyData, ...data]
|
|
|
+ state.trackMap.set(trackId, Object.assign(state.trackMap.get(trackId), {historyData: _historyData}))
|
|
|
+ draw()
|
|
|
} catch (e) {
|
|
|
}
|
|
|
}
|
|
@@ -174,53 +219,103 @@ export default defineComponent({
|
|
|
const json = JSON.parse(e.data)
|
|
|
const s = 'json' + clickFeat.get('_wsDataFlag')
|
|
|
const data = eval(s)
|
|
|
- const features: any = []
|
|
|
// 实时船舶
|
|
|
const DATA = data?.[0]
|
|
|
+ const getKeyData = (key) => {
|
|
|
+ if (clickFeat.get(key)) {
|
|
|
+ return eval(clickFeat.get(key))
|
|
|
+ } else {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+ }
|
|
|
if (DATA) {
|
|
|
- try {
|
|
|
- const getKeyData = (key) => {
|
|
|
- if (clickFeat.get(key)) {
|
|
|
- return eval(clickFeat.get(key))
|
|
|
- } else {
|
|
|
- return null
|
|
|
- }
|
|
|
- }
|
|
|
- const feat: any = new format.WKT().readFeature(getKeyData('trackWktKey'))
|
|
|
- feat.set('featureType', 'ship')
|
|
|
- feat.setId(getKeyData('trackPointKey'))
|
|
|
- feat.set('_hover', {
|
|
|
- data: DATA,
|
|
|
- config: clickFeat.get('_config'),
|
|
|
- isHistory: false
|
|
|
- })
|
|
|
- feat.setStyle(ShipStyle.ShipNormalStyle({
|
|
|
- course: clickFeat.get('_course'),
|
|
|
- speed: clickFeat.get('_speed'),
|
|
|
- head: clickFeat.get('_head'),
|
|
|
- color: color
|
|
|
- }))
|
|
|
- features.push(feat)
|
|
|
+ if (state.trackMap.get(trackId).realData.length === 0 || state.trackMap.get(trackId).realData[state.trackMap.get(trackId).realData.length - 1]._trackPointId != getKeyData('trackPointKey')) {
|
|
|
+ DATA._trackPointId = getKeyData('trackPointKey')
|
|
|
state.trackMap.get(trackId).realData.push(DATA)
|
|
|
- } catch (e) {
|
|
|
- console.log(e)
|
|
|
+ if (state.currentTime != state.trackMap.get(trackId).currentTime) {
|
|
|
+ draw()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- // 轨迹线
|
|
|
- const lineArr: any = []
|
|
|
- state.trackMap.get(trackId).historyData.forEach(DATA => {
|
|
|
- DATA.isHistory = true
|
|
|
- const getKeyData = (key) => {
|
|
|
- if (clickFeat.get(key)) {
|
|
|
- return eval(clickFeat.get(key))
|
|
|
- } else {
|
|
|
- return null
|
|
|
- }
|
|
|
+ } catch (e) {
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const draw = () => {
|
|
|
+ const timeArr: any = []
|
|
|
+ state.trackMap.get(trackId).currentTime = JSON.parse(JSON.stringify(state.currentTime))
|
|
|
+ const features: any = []
|
|
|
+ // 轨迹线
|
|
|
+ const lineArr: any = []
|
|
|
+ state.trackMap.get(trackId).historyData.forEach((DATA, i) => {
|
|
|
+ DATA.isHistory = true
|
|
|
+ const getKeyData = (key) => {
|
|
|
+ if (clickFeat.get(key)) {
|
|
|
+ return eval(clickFeat.get(key))
|
|
|
+ } else {
|
|
|
+ return null
|
|
|
}
|
|
|
- lineArr.push(getKeyData('historyTrackWktKey'))
|
|
|
- })
|
|
|
- state.trackMap.get(trackId).realData.forEach(DATA => {
|
|
|
- DATA.isHistory = false
|
|
|
+ }
|
|
|
+ lineArr.push(getKeyData('historyTrackWktKey'))
|
|
|
+ if (i === 0) {
|
|
|
+ timeArr.push(getKeyData('historyTrackTimeKey'))
|
|
|
+ } else if (i === state.trackMap.get(trackId).historyData.length - 1) {
|
|
|
+ timeArr.push(getKeyData('historyTrackTimeKey'))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ state.trackMap.get(trackId).realData.forEach((DATA, i) => {
|
|
|
+ DATA.isHistory = false
|
|
|
+ const getKeyData = (key) => {
|
|
|
+ if (clickFeat.get(key)) {
|
|
|
+ return eval(clickFeat.get(key))
|
|
|
+ } else {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+ }
|
|
|
+ lineArr.push(getKeyData('trackWktKey'))
|
|
|
+ if (i === 0) {
|
|
|
+ timeArr.push(getKeyData('trackTimeKey'))
|
|
|
+ } else if (i === state.trackMap.get(trackId).historyData.length - 1) {
|
|
|
+ timeArr.push(getKeyData('trackTimeKey'))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (lineArr.length > 0) {
|
|
|
+ const lineWkt = that.$easyMap.formatPosition.wptTwl(lineArr)
|
|
|
+ const feat: any = new format.WKT().readFeature(lineWkt)
|
|
|
+ feat.set('trackPointList', [...state.trackMap.get(trackId).historyData, ...state.trackMap.get(trackId).realData])
|
|
|
+ feat.set('featureType', 'shipTrack')
|
|
|
+ feat.setStyle((f, r) => ShipStyle.trackStyle(f, r, props.map, state.trackMap.get(trackId).color, (s, pointList) => {
|
|
|
+ const pointFeatures: any = []
|
|
|
+ pointList.forEach(DATA => {
|
|
|
+ try {
|
|
|
+ const getKeyData = (key) => {
|
|
|
+ if (clickFeat.get(key)) {
|
|
|
+ return eval(clickFeat.get(key))
|
|
|
+ } else {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const feat: any = new format.WKT().readFeature(DATA.isHistory ? getKeyData('historyTrackWktKey') : getKeyData('trackWktKey'))
|
|
|
+ feat.set('featureType', 'shipPoint')
|
|
|
+ feat.set('_hover', {
|
|
|
+ data: DATA,
|
|
|
+ config: clickFeat.get('_config'),
|
|
|
+ isHistory: DATA.isHistory
|
|
|
+ })
|
|
|
+ feat.setStyle(ShipStyle.trackPointNormalStyle(state.trackMap.get(trackId).color))
|
|
|
+ pointFeatures.push(feat)
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ trackLayer.getSource().addFeatures(pointFeatures)
|
|
|
+ return s
|
|
|
+ }))
|
|
|
+ features.push(feat)
|
|
|
+ }
|
|
|
+ // 船舶
|
|
|
+ if (state.trackMap.get(trackId).realData.length > 0) {
|
|
|
+ try {
|
|
|
+ const DATA = state.trackMap.get(trackId).realData[state.trackMap.get(trackId).realData.length - 1]
|
|
|
const getKeyData = (key) => {
|
|
|
if (clickFeat.get(key)) {
|
|
|
return eval(clickFeat.get(key))
|
|
@@ -228,52 +323,46 @@ export default defineComponent({
|
|
|
return null
|
|
|
}
|
|
|
}
|
|
|
- lineArr.push(getKeyData('trackWktKey'))
|
|
|
- })
|
|
|
- if (lineArr.length > 0) {
|
|
|
- const lineWkt = that.$easyMap.formatPosition.wptTwl(lineArr)
|
|
|
- const feat: any = new format.WKT().readFeature(lineWkt)
|
|
|
- feat.set('trackPointList', [...state.trackMap.get(trackId).historyData, ...state.trackMap.get(trackId).realData])
|
|
|
- feat.set('featureType', 'shipTrack')
|
|
|
- feat.setStyle((f, r) => ShipStyle.trackStyle(f, r, props.map, color, (s, pointList) => {
|
|
|
- const pointFeatures: any = []
|
|
|
- pointList.forEach(DATA => {
|
|
|
- try {
|
|
|
- const getKeyData = (key) => {
|
|
|
- if (clickFeat.get(key)) {
|
|
|
- return eval(clickFeat.get(key))
|
|
|
- } else {
|
|
|
- return null
|
|
|
- }
|
|
|
- }
|
|
|
- const feat: any = new format.WKT().readFeature(DATA.isHistory ? getKeyData('historyTrackWktKey') : getKeyData('trackWktKey'))
|
|
|
- feat.set('featureType', 'shipPoint')
|
|
|
- feat.set('_hover', {
|
|
|
- data: DATA,
|
|
|
- config: clickFeat.get('_config'),
|
|
|
- isHistory: DATA.isHistory
|
|
|
- })
|
|
|
- feat.setStyle(ShipStyle.trackPointNormalStyle(color))
|
|
|
- pointFeatures.push(feat)
|
|
|
- } catch (e) {
|
|
|
- console.log(e)
|
|
|
- }
|
|
|
- })
|
|
|
- trackLayer.getSource().addFeatures(pointFeatures)
|
|
|
- return s
|
|
|
+ const feat: any = new format.WKT().readFeature(getKeyData('trackWktKey'))
|
|
|
+ feat.set('featureType', 'ship')
|
|
|
+ feat.setId(getKeyData('trackPointKey'))
|
|
|
+ feat.set('_hover', {
|
|
|
+ data: DATA,
|
|
|
+ config: clickFeat.get('_config'),
|
|
|
+ isHistory: false
|
|
|
+ })
|
|
|
+ feat.setStyle(ShipStyle.ShipNormalStyle({
|
|
|
+ course: clickFeat.get('_course'),
|
|
|
+ speed: clickFeat.get('_speed'),
|
|
|
+ head: clickFeat.get('_head'),
|
|
|
+ color: state.trackMap.get(trackId).color
|
|
|
}))
|
|
|
features.push(feat)
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
}
|
|
|
- const vectorSource = new source.Vector({
|
|
|
- features: features,
|
|
|
- wrapX: false
|
|
|
- });
|
|
|
- trackLayer.setSource(vectorSource)
|
|
|
- } catch (e) {
|
|
|
+ }
|
|
|
+ const vectorSource = new source.Vector({
|
|
|
+ features: features,
|
|
|
+ wrapX: false
|
|
|
+ });
|
|
|
+ trackLayer.setSource(vectorSource)
|
|
|
+ if (timeArr.length > 1) {
|
|
|
+ state.trackMap.set(trackId, Object.assign(state.trackMap.get(trackId), {trackTime: that.$util.comTimeByArea(timeArr[0], timeArr[timeArr.length - 1], true)}))
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
const handleShipFilter = ({cql, shipParams}) => {
|
|
|
+ state.currentWS?.close()
|
|
|
+ state.currentWS = null
|
|
|
+ const tileLayer = props.map.getLayers().getArray().filter(v => v.get('layerName') === 'WMSShip')?.[0]
|
|
|
+ if (tileLayer) {
|
|
|
+ props.map.removeLayer(tileLayer)
|
|
|
+ }
|
|
|
+ if (state.wsLayer) {
|
|
|
+ props.map.removeLayer(state.wsLayer)
|
|
|
+ state.wsLayer = null
|
|
|
+ }
|
|
|
state.shipFilter.cql = cql
|
|
|
state.shipFilter.config = shipParams
|
|
|
console.log(state.shipFilter.config)
|
|
@@ -296,10 +385,8 @@ export default defineComponent({
|
|
|
if (state.wsLayer) {
|
|
|
state.wsLayer.getSource().clear()
|
|
|
}
|
|
|
- for (let key of state.wsMap.keys()) {
|
|
|
- state.wsMap.get(key).close()
|
|
|
- state.wsMap.delete(key)
|
|
|
- }
|
|
|
+ state.currentWS?.close()
|
|
|
+ state.currentWS = null
|
|
|
const hasLayer = props.map.getLayers().getArray().filter(v => v.get('layerName') === 'WMSShip')?.[0]
|
|
|
if (hasLayer) {
|
|
|
props.map.removeLayer(hasLayer)
|
|
@@ -327,9 +414,12 @@ export default defineComponent({
|
|
|
}
|
|
|
const initWebSocketShip = () => {
|
|
|
const str = {
|
|
|
- cql: <any>null
|
|
|
+ cql: `(BBOX(location, ${props.mapFunc.getBBOX().join(',')})`,
|
|
|
}
|
|
|
- str.cql = `(BBOX(location, ${props.mapFunc.getBBOX().join(',')}) and ${state.shipFilter.cql})`
|
|
|
+ if (state.shipFilter.cql) {
|
|
|
+ str.cql += ` and ${state.shipFilter.cql}`
|
|
|
+ }
|
|
|
+ str.cql += ')'
|
|
|
let ids: any = []
|
|
|
state.trackMap.forEach((value, key) => {
|
|
|
if (value.sourceId === state.shipFilter.config.id) {
|
|
@@ -339,13 +429,13 @@ export default defineComponent({
|
|
|
if (ids.length > 0) {
|
|
|
str.cql += ` and (${state.shipFilter.config.track.trackKey.split('DATA.')[1]} not in (${ids.join(',')}))`
|
|
|
}
|
|
|
- if (state.wsMap.has(state.shipFilter.config.id)) {
|
|
|
- if (state.wsMap.get(state.shipFilter.config.id).readyState === 1) {
|
|
|
- state.wsMap.get(state.shipFilter.config.id).send(JSON.stringify(str))
|
|
|
+ if (state.currentWS) {
|
|
|
+ if (state.currentWS.readyState === 1) {
|
|
|
+ state.currentWS.send(JSON.stringify(str))
|
|
|
}
|
|
|
} else {
|
|
|
const ws = new WebSocket(state.shipFilter.config.wsUrl)
|
|
|
- state.wsMap.set(state.shipFilter.config.id, ws)
|
|
|
+ state.currentWS = ws
|
|
|
ws.onopen = (e) => {
|
|
|
ws.send(JSON.stringify(str))
|
|
|
}
|
|
@@ -362,13 +452,14 @@ export default defineComponent({
|
|
|
}
|
|
|
const initShip = (data) => {
|
|
|
if (!state.wsLayer) {
|
|
|
- state.wsLayer = new layer.VectorImage({
|
|
|
+ state.wsLayer = new layer.Vector({
|
|
|
zIndex: 10,
|
|
|
style: (f) => {
|
|
|
return ShipStyle.ShipNormalStyle({
|
|
|
course: f.get('_course'),
|
|
|
speed: f.get('_speed'),
|
|
|
- head: f.get('_head')
|
|
|
+ head: f.get('_head'),
|
|
|
+ color: state.shipFilter.config.color
|
|
|
})
|
|
|
}
|
|
|
})
|
|
@@ -423,13 +514,95 @@ export default defineComponent({
|
|
|
watch(() => state.zoomWMS, () => {
|
|
|
refreshMap()
|
|
|
})
|
|
|
+ const shipHoverInfoCpt = computed(() => {
|
|
|
+ const arr: any = []
|
|
|
+ const DATA = state.shipHoverInfo.data
|
|
|
+ if (DATA.isHistory) {
|
|
|
+ state.shipHoverInfo.config.hover.forEach(h => {
|
|
|
+ if (h.historyValue) {
|
|
|
+ let value = eval(h.historyValue)
|
|
|
+ h.options?.forEach(v => {
|
|
|
+ if (String(value) == v.value) {
|
|
|
+ value = v.label
|
|
|
+ }
|
|
|
+ })
|
|
|
+ arr.push({
|
|
|
+ label: h.name,
|
|
|
+ value: value
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ state.shipHoverInfo.config.hover.forEach(h => {
|
|
|
+ let value = eval(h.value)
|
|
|
+ h.options?.forEach(v => {
|
|
|
+ if (String(value) == v.value) {
|
|
|
+ value = v.label
|
|
|
+ }
|
|
|
+ })
|
|
|
+ arr.push({
|
|
|
+ label: h.name,
|
|
|
+ value: value
|
|
|
+ })
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ return arr
|
|
|
+ })
|
|
|
+ const handleTrackDel = (id) => {
|
|
|
+ const l = state.trackMap.get(id)?.layer
|
|
|
+ const ws = state.trackMap.get(id)?.webSocket
|
|
|
+ if (l) {
|
|
|
+ props.map.removeLayer(l)
|
|
|
+ }
|
|
|
+ ws.close()
|
|
|
+ state.trackMap.delete(id)
|
|
|
+ initWebSocketShip()
|
|
|
+ }
|
|
|
+ const handleTrackShow = (id) => {
|
|
|
+ const l = state.trackMap.get(id)?.layer
|
|
|
+ l?.setVisible(true)
|
|
|
+ state.trackMap.set(id, Object.assign(state.trackMap.get(id), {show: true}))
|
|
|
+ }
|
|
|
+ const handleTrackHide = (id) => {
|
|
|
+ const l = state.trackMap.get(id)?.layer
|
|
|
+ l?.setVisible(false)
|
|
|
+ state.trackMap.set(id, Object.assign(state.trackMap.get(id), {show: false}))
|
|
|
+ }
|
|
|
+ const handleTrackColor = (id, color) => {
|
|
|
+ state.trackMap.set(id, Object.assign(state.trackMap.get(id), {color: color}))
|
|
|
+ }
|
|
|
+ const handleTrackLocation = (id) => {
|
|
|
+ const config = state.trackMap.get(id).config
|
|
|
+ const arr: any = []
|
|
|
+ state.trackMap.get(id).realData.forEach(DATA => {
|
|
|
+ try {
|
|
|
+ const feat: any = new format.WKT().readFeature(eval(config.track['trackWktKey']))
|
|
|
+ arr.push(feat.getGeometry().getCoordinates())
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ state.trackMap.get(id).historyData.forEach(DATA => {
|
|
|
+ try {
|
|
|
+ const feat: any = new format.WKT().readFeature(eval(config.track['historyTrackWktKey']))
|
|
|
+ arr.push(feat.getGeometry().getCoordinates())
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (arr.length > 0) {
|
|
|
+ that.$easyMap.getShapeView(props.map, arr)
|
|
|
+ } else {
|
|
|
+ ElMessage.warning('没有轨迹点可定位')
|
|
|
+ }
|
|
|
+ }
|
|
|
onMounted(() => {
|
|
|
initMap()
|
|
|
+ setInterval(() => state.currentTime++, 5000)
|
|
|
})
|
|
|
onUnmounted(() => {
|
|
|
- for (let key of state.wsMap.keys()) {
|
|
|
- state.wsMap.get(key).close()
|
|
|
- }
|
|
|
+ state.currentWS?.close()
|
|
|
for (let key of state.trackMap.keys()) {
|
|
|
state.trackMap.get(key).webSocket.close()
|
|
|
}
|
|
@@ -437,7 +610,13 @@ export default defineComponent({
|
|
|
return {
|
|
|
...toRefs(state),
|
|
|
ref_shipHover,
|
|
|
- handleShipFilter
|
|
|
+ handleShipFilter,
|
|
|
+ shipHoverInfoCpt,
|
|
|
+ handleTrackDel,
|
|
|
+ handleTrackShow,
|
|
|
+ handleTrackHide,
|
|
|
+ handleTrackColor,
|
|
|
+ handleTrackLocation
|
|
|
}
|
|
|
},
|
|
|
})
|
|
@@ -454,6 +633,64 @@ export default defineComponent({
|
|
|
position: fixed;
|
|
|
top: 0;
|
|
|
right: 0;
|
|
|
+ max-height: 600px;
|
|
|
+ background: linear-gradient(180deg, #3874C9 0%, #0043C4 100%);
|
|
|
+ padding: 10px 0;
|
|
|
+ color: #FFFFFF;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ overflow: hidden;
|
|
|
+ .track-item-head {
|
|
|
+ padding: 0 20px;
|
|
|
+ text-align: left;
|
|
|
+ }
|
|
|
+ .track-item-body {
|
|
|
+ padding: 0 20px;
|
|
|
+ flex: 1;
|
|
|
+ overflow-y: auto;
|
|
|
+ display: flex;
|
|
|
+ flex-direction: column;
|
|
|
+ }
|
|
|
+ .track-item {
|
|
|
+ display: flex;
|
|
|
+ font-size: 14px;
|
|
|
+ .key {
|
|
|
+ width: 200px;
|
|
|
+ }
|
|
|
+ .source {
|
|
|
+ width: 100px;
|
|
|
+ }
|
|
|
+ .time {
|
|
|
+ width: 100px;
|
|
|
+ }
|
|
|
+ .do {
|
|
|
+ display: flex;
|
|
|
+ >* {
|
|
|
+ width: 20px;
|
|
|
+ height: 20px;
|
|
|
+ }
|
|
|
+ .color {
|
|
|
+ position: relative;
|
|
|
+ width: 16px;
|
|
|
+ height: 16px;
|
|
|
+ display: flex;
|
|
|
+ >img {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ :deep(.el-color-picker) {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ position: absolute;
|
|
|
+ opacity: 0;
|
|
|
+ .el-color-picker__trigger {
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
.hover-info {
|
|
@@ -473,7 +710,7 @@ export default defineComponent({
|
|
|
border-right: $footH solid transparent;
|
|
|
}
|
|
|
.hover-info-head {
|
|
|
- min-width: 68px;
|
|
|
+ padding: 0 4px;
|
|
|
height: 18px;
|
|
|
position: absolute;
|
|
|
top: -18px;
|
|
@@ -485,22 +722,8 @@ export default defineComponent({
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
line-height: 8px;
|
|
|
- &:before {
|
|
|
- z-index: -1;
|
|
|
- content: '';
|
|
|
- position: absolute;
|
|
|
- width: 100%;
|
|
|
- height: 100%;
|
|
|
- background: linear-gradient(180deg, #3874C9 0%, #0043C4 100%);
|
|
|
- border-radius: 2px 2px 0 0;/* 设置圆角 */
|
|
|
- transform: perspective(20px)rotateX(4deg);
|
|
|
- /* 镜头距离元素表面的位置为8px,x轴为1.1倍y轴为1.3倍,绕x轴旋转5度 */
|
|
|
- transform-origin: bottom left;
|
|
|
- /* bottom left = left bottom = 0 100% 中心点偏移量*/
|
|
|
- }
|
|
|
- >span {
|
|
|
- margin-left: 10px;
|
|
|
- }
|
|
|
+ background: linear-gradient(180deg, #3874C9 0%, #0043C4 100%);
|
|
|
+ border-radius: 2px 2px 0 0;/* 设置圆角 */
|
|
|
>img {
|
|
|
margin: 0 4px 0 6px;
|
|
|
}
|
|
@@ -517,7 +740,7 @@ export default defineComponent({
|
|
|
.hover-item {
|
|
|
display: flex;
|
|
|
.hover-item-label {
|
|
|
- width: 42px;
|
|
|
+ min-width: 42px;
|
|
|
font-size: 14px;
|
|
|
font-family: PingFang SC;
|
|
|
font-weight: 600;
|