From 2800fa4f32f3900509cb4d6eefaf2bfaf54efdd7 Mon Sep 17 00:00:00 2001
From: 罗广辉 <guanghui.luo@foxmail.com>
Date: Mon, 21 Apr 2025 18:29:09 +0800
Subject: [PATCH] fix: 天气显示
---
src/views/SignMachineNest/SignMachineNest.vue | 39 +++++++++++++++++----------------------
1 files changed, 17 insertions(+), 22 deletions(-)
diff --git a/src/views/SignMachineNest/SignMachineNest.vue b/src/views/SignMachineNest/SignMachineNest.vue
index 2155498..2bcff88 100644
--- a/src/views/SignMachineNest/SignMachineNest.vue
+++ b/src/views/SignMachineNest/SignMachineNest.vue
@@ -7,19 +7,26 @@
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 { getDeviceDetail, getEventList, getFlightStatistics } from '@/api/home/machineNest'
import { useSingleDroneMap } from '@/hooks/useSingleDroneMap/useSingleDroneMap'
import { useDroneWS } from '@/hooks/useDroneWS'
-
+import _ from 'lodash'
+import { getAreaCodeApi } from '@/api/home'
const store = useStore()
let connectWs = ref(null)
// 单个机巢信息
const singleUavHome = computed(() => store.state.home.singleUavHome)
-
-let osdVisible = ref({})
-
let workspaceId = ref('')
+let { wsInfo } = useDroneWS(workspaceId) //ws信息,是一个ref对象
+const dockSn = computed(() => singleUavHome.value.device_sn) //机巢sn
+const droneSn = computed(() => wsInfo.value?.device_osd?.data?.sn) //无人机sn
+const singleTotal = ref({})
+const dockDetails = ref('')
+provide('dockSn', dockSn)
+provide('droneSn', droneSn)
+provide('wsInfo', wsInfo)
+provide('dockDetails', dockDetails)
+provide('singleTotal', singleTotal)
// 单机巢初始化及事件撒点
const { init, initEventLayer, initDroneEntity } = useSingleDroneMap({
@@ -29,22 +36,12 @@
},
})
-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
+ const storageObj = _.pick(result, ['latitude', 'longitude']) || {}
+ store.commit('setSingleUavHome',{...singleUavHome.value, ...storageObj})
initDroneEntity({
lng: result.longitude,
lat: result.latitude,
@@ -53,14 +50,12 @@
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
+ singleTotal.value = res.data.data
})
}
--
Gitblit v1.9.3