From bda33a4e7f08fd133ae8bff8d968143f858c2e6a Mon Sep 17 00:00:00 2001
From: 张含笑 <zhx18749296735@163.com>
Date: Mon, 21 Apr 2025 14:52:13 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev
---
src/views/SignMachineNest/SignMachineNest.vue | 77 ++++++++++++++++++++++++++++++++++++--
1 files changed, 72 insertions(+), 5 deletions(-)
diff --git a/src/views/SignMachineNest/SignMachineNest.vue b/src/views/SignMachineNest/SignMachineNest.vue
index 2ff56b8..2155498 100644
--- a/src/views/SignMachineNest/SignMachineNest.vue
+++ b/src/views/SignMachineNest/SignMachineNest.vue
@@ -1,9 +1,76 @@
<template>
- <MachineLeft></MachineLeft>
- <MachineRight></MachineRight>
+ <MachineLeft></MachineLeft>
+ <MachineRight></MachineRight>
</template>
<script setup>
-import MachineLeft from './components/MachineLeft/MachineLeft.vue'
-import MachineRight from './components/MachineRight/MachineRight.vue';
-</script>
\ No newline at end of file
+import MachineLeft from '@/views/SignMachineNest/MachineLeft/MachineLeft.vue'
+import MachineRight from '@/views/SignMachineNest/MachineRight/MachineRight.vue'
+import { useStore } from 'vuex'
+import { getDeviceDetail, getFlightStatistics, getEventList } from '@/api/home/machineNest'
+
+import { useSingleDroneMap } from '@/hooks/useSingleDroneMap/useSingleDroneMap'
+import { useDroneWS } from '@/hooks/useDroneWS'
+
+const store = useStore()
+let connectWs = ref(null)
+// 单个机巢信息
+const singleUavHome = computed(() => store.state.home.singleUavHome)
+
+let osdVisible = ref({})
+
+let workspaceId = ref('')
+
+// 单机巢初始化及事件撒点
+const { init, initEventLayer, initDroneEntity } = useSingleDroneMap({
+ eventApi: getEventList,
+ eventApiParams: {
+ device_sn: singleUavHome.value.device_sn,
+ },
+})
+
+let workspace_id = ref('')
+let { wsInfo } = useDroneWS(workspace_id) //ws信息,是一个ref对象
+
+const dockSn = computed(() => singleUavHome.value.device_sn) //机巢sn
+const droneSn = computed(() => wsInfo.value?.device_osd?.data?.sn) //无人机sn
+provide('dockSn', dockSn)
+provide('droneSn', droneSn)
+provide('wsInfo',wsInfo)
+// 获取单个机巢信息
+const dockDetails= ref('')
+provide('dockDetails', dockDetails)
+const getSingleDetails = () => {
+ getDeviceDetail(singleUavHome.value.device_sn).then(res => {
+ const result = res.data.data
+ dockDetails.value = result
+ workspace_id.value = result.workspace_id
+ initDroneEntity({
+ lng: result.longitude,
+ lat: result.latitude,
+ status: result.status,
+ })
+ workspaceId.value = result.workspace_id
+ })
+}
+const singleTotal = ref({})
+provide('singleTotal', singleTotal)
+// 获取机巢统计数据 提供给左右侧组件使用
+const getMachineData = () => {
+ getFlightStatistics(singleUavHome.value.device_sn).then(res => {
+ if (res.data.code !== 0) return
+ const result = res.data.data
+ singleTotal.value = result
+ })
+}
+
+onMounted(() => {
+ initEventLayer()
+ getSingleDetails()
+ getMachineData()
+})
+
+onUnmounted(() => {
+ connectWs?.value?.close()
+})
+</script>
--
Gitblit v1.9.3