From e91e29a9a6dd4f7cb436da3c5c59fdd750e35129 Mon Sep 17 00:00:00 2001
From: husq <931347610@qq.com>
Date: Thu, 21 Sep 2023 16:37:05 +0800
Subject: [PATCH] 修改workSpaceId、地图逻辑修改
---
src/pages/page-web/projects/tsa.vue | 62 ++++++++++++++++++++++++++++---
1 files changed, 56 insertions(+), 6 deletions(-)
diff --git a/src/pages/page-web/projects/tsa.vue b/src/pages/page-web/projects/tsa.vue
index a9ec36e..e951e62 100644
--- a/src/pages/page-web/projects/tsa.vue
+++ b/src/pages/page-web/projects/tsa.vue
@@ -250,13 +250,14 @@
import { getDeviceTopo, getUnreadDeviceHms, updateDeviceHms } from '/@/api/manage'
import { RocketOutlined, EyeInvisibleOutlined, EyeOutlined, RobotOutlined, DoubleRightOutlined } from '@ant-design/icons-vue'
import { EHmsLevel } from '/@/types/enums'
+import { cesiumOperation } from '/@/hooks/use-cesium-tsa'
const { appContext } = getCurrentInstance()
const global = appContext.config.globalProperties
const route = useRoute()
// const simpleImage = Empty.PRESENTED_IMAGE_SIMPLE
const store = useMyStore()
const username = ref(localStorage.getItem(ELocalStorageKey.Username))
-const workspaceId = ref(localStorage.getItem(ELocalStorageKey.WorkspaceId)!)
+// const workSpaceId = ref(localStorage.getItem(ELocalStorageKey.workSpaceId)!)
const osdVisible = ref({} as OSDVisible)
const hmsVisible = new Map<string, boolean>()
const scorllHeight = ref()
@@ -270,11 +271,62 @@
const deviceInfo = computed(() => store.state.deviceState.deviceInfo)
const dockInfo = computed(() => store.state.deviceState.dockInfo)
+const workSpaceId = computed(() => store.state.common.projectId)
const hmsInfo = computed({
get: () => store.state.hmsInfo,
set: (val) => {
return val
}
+})
+const getResource = (name: string) => {
+ return new URL(`/src/assets/icons/${name}`, import.meta.url).href
+}
+const cesium = cesiumOperation(global.$viewer)
+const hasFlownToLocation = ref(false)
+// 添加机场标注
+watch(() => store.state.deviceState, data => {
+ cesium.removeAllPoint()
+ if (data.currentType === EDeviceTypeName.Gateway && data.gatewayInfo[data.currentSn]) {
+ // deviceTsaUpdateHook.moveTo(data.currentSn, data.gatewayInfo[data.currentSn].longitude, data.gatewayInfo[data.currentSn].latitude)
+ }
+ if (data.currentType === EDeviceTypeName.Aircraft && data.deviceInfo[data.currentSn]) {
+ // 无人机图标
+ const setting = {
+ longitude: data.deviceInfo[data.currentSn].longitude,
+ latitude: data.deviceInfo[data.currentSn].latitude,
+ billboard: {
+ image: getResource('drone.png'),
+ outlineWidth: 0,
+ width: 36,
+ height: 36,
+ scale: 1.0,
+ }
+ }
+ cesium.addPoint(setting)
+ // if (osdVisible.value.visible && osdVisible.value.sn !== '') {
+ // deviceInfo.value.device = data.deviceInfo[osdVisible.value.sn]
+ // }
+ }
+ if (data.currentType === EDeviceTypeName.Dock && data.dockInfo[data.currentSn]) {
+ // 机场图标位置
+ const setting = {
+ longitude: data.dockInfo[data.currentSn].basic_osd?.longitude || 115.85666327144976,
+ latitude: data.dockInfo[data.currentSn].basic_osd?.latitude || 28.62452712442823,
+ billboard: {
+ image: getResource('dock.png'),
+ outlineWidth: 0,
+ width: 36,
+ height: 36,
+ scale: 1.0,
+ }
+ }
+ cesium.addPoint(setting)
+ if (hasFlownToLocation.value) return
+ cesium.flyTo(setting)
+ hasFlownToLocation.value = true
+ }
+}, {
+ deep: true
})
onMounted(() => {
@@ -298,14 +350,13 @@
scorllHeight.value = parent?.clientHeight - parent?.firstElementChild?.clientHeight
})
const messageHandler = async (payload: any) => {
- console.log(payload, 'payload')
// if (payload.type === 'hms') {
// const { data
}
// 监听ws 消息
// useConnectWebSocket(messageHandler)
function getOnlineTopo () {
- getDeviceTopo(workspaceId.value).then((res) => {
+ getDeviceTopo(workSpaceId.value).then((res) => {
if (res.code !== 0) {
return
}
@@ -371,12 +422,11 @@
}
function getUnreadHms (sn: string) {
- getUnreadDeviceHms(workspaceId.value, sn).then(res => {
+ getUnreadDeviceHms(workSpaceId.value, sn).then(res => {
if (res.data.length !== 0) {
hmsInfo.value[sn] = res.data
}
})
- console.info(hmsInfo.value)
}
function getOnlineDeviceHms () {
@@ -398,7 +448,7 @@
function readHms (visiable: boolean, sn: string) {
if (!visiable) {
- updateDeviceHms(workspaceId.value, sn).then(res => {
+ updateDeviceHms(workSpaceId.value, sn).then(res => {
if (res.code === 0) {
delete hmsInfo.value[sn]
}
--
Gitblit v1.9.3