|
@@ -81,8 +81,6 @@ import * as layer from "ol/layer";
|
|
|
import ShipStyle from "@/views/ship-test/business/shipStyle";
|
|
|
import * as format from "ol/format";
|
|
|
import * as ol from "ol";
|
|
|
-import {shipTestStaticList} from "@/api/modules/ship-test/static";
|
|
|
-import TrackStyle from "@/views/init-speed-track/track-style";
|
|
|
import * as turf from "@turf/turf";
|
|
|
|
|
|
export default defineComponent({
|
|
@@ -516,24 +514,35 @@ export default defineComponent({
|
|
|
watch(() => state.zoomWMS, () => {
|
|
|
refreshMap()
|
|
|
})
|
|
|
- const shipHoverInfoCpt = computed(() => {
|
|
|
- const STATIC = (id) => {
|
|
|
+ const STATIC = (id) => {
|
|
|
+ if (id) {
|
|
|
return state.staticList.filter(v => id == v.id)?.[0].wkt
|
|
|
}
|
|
|
- const DISTANCE = (p1, p2) => {
|
|
|
+ return null
|
|
|
+ }
|
|
|
+ const DISTANCE = (p1, p2) => {
|
|
|
+ if (p1 && p2) {
|
|
|
return turf.distance(that.$easyMap.formatPosition.wptTcpt(p1), that.$easyMap.formatPosition.wptTcpt(p2), {units: 'kilometers'}).toFixed(2) + 'km'
|
|
|
}
|
|
|
+ return null
|
|
|
+ }
|
|
|
+ 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
|
|
|
- }
|
|
|
- })
|
|
|
+ let value = '数据取值错误'
|
|
|
+ try {
|
|
|
+ value = eval(h.historyValue)
|
|
|
+ h.options?.forEach(v => {
|
|
|
+ if (String(value) == v.value) {
|
|
|
+ value = v.label
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } catch (e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
arr.push({
|
|
|
label: h.name,
|
|
|
value: value
|
|
@@ -542,12 +551,17 @@ export default defineComponent({
|
|
|
})
|
|
|
} else {
|
|
|
state.shipHoverInfo.config.hover.forEach(h => {
|
|
|
- let value = eval(h.value)
|
|
|
- h.options?.forEach(v => {
|
|
|
- if (String(value) == v.value) {
|
|
|
- value = v.label
|
|
|
- }
|
|
|
- })
|
|
|
+ let value = '数据取值错误'
|
|
|
+ try {
|
|
|
+ value = eval(h.value)
|
|
|
+ h.options?.forEach(v => {
|
|
|
+ if (String(value) == v.value) {
|
|
|
+ value = v.label
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } catch(e) {
|
|
|
+ console.log(e)
|
|
|
+ }
|
|
|
arr.push({
|
|
|
label: h.name,
|
|
|
value: value
|
|
@@ -628,6 +642,9 @@ export default defineComponent({
|
|
|
})
|
|
|
}
|
|
|
onMounted(() => {
|
|
|
+ // eval注册函数动态方法,不调用一下的话打包不包含
|
|
|
+ DISTANCE(null, null)
|
|
|
+ STATIC(null)
|
|
|
initMap()
|
|
|
initStatic()
|
|
|
setInterval(() => state.currentTime++, 5000)
|