From 2a45e8331f65e4fc6dee2fba898bfbeaa01b0f5c Mon Sep 17 00:00:00 2001
From: chenyao <1219716595@qq.com>
Date: Mon, 21 Apr 2025 16:34:15 +0800
Subject: [PATCH] Merge branch 'test' of http://139.196.74.78:10010/r/drone/command-center-dashboard into test

---
 src/components/DeviceJobDetails/DeviceJobDetails.vue                                             |   10 
 src/router/views/index.js                                                                        |   12 -
 src/views/Home/EventOverviewDetail/EventOverviewDetailRight.vue                                  |    3 
 src/views/SignMachineNest/MachineRight/MachineMonitor.vue                                        |   19 +-
 public/favicon.png                                                                               |    0 
 src/views/SignMachineNest/MachineRight/MachineStatus/MachineStatus.vue                           |  131 ++++------------
 src/views/SignMachineNest/SignMachineNest.vue                                                    |   97 ++++-------
 src/api/home/index.js                                                                            |    8 +
 src/styles/element-ui.scss                                                                       |   57 +++++-
 src/views/Home/AINowFly.vue                                                                      |   15 +
 src/views/Home/SearchBox.vue                                                                     |    1 
 src/components/DeviceJobDetails/JobRelatedEvents.vue                                             |    4 
 src/views/SignMachineNest/MachineLeft/MachineData.vue                                            |    4 
 src/views/SignMachineNest/MachineRight/MachineStatus/MachineTableDetails/MachineTableDetails.vue |    2 
 src/store/modules/home.js                                                                        |   76 ---------
 src/views/SignMachineNest/MachineRight/InspectionRaskList.vue                                    |    5 
 src/views/Home/Home.vue                                                                          |    1 
 17 files changed, 160 insertions(+), 285 deletions(-)

diff --git a/public/favicon.png b/public/favicon.png
index 278df66..43577c7 100644
--- a/public/favicon.png
+++ b/public/favicon.png
Binary files differ
diff --git a/src/api/home/index.js b/src/api/home/index.js
index b4b3556..e5c8ed3 100644
--- a/src/api/home/index.js
+++ b/src/api/home/index.js
@@ -122,3 +122,11 @@
 	})
 }
 
+// 根据经纬度获取区域code
+export const getAreaCodeApi = (params) => {
+	return axios({
+		url: `https://restapi.amap.com/v3/geocode/regeo`,
+		method: 'post',
+		params
+	})
+}
diff --git a/src/components/DeviceJobDetails/DeviceJobDetails.vue b/src/components/DeviceJobDetails/DeviceJobDetails.vue
index 0b219d6..4f432ca 100644
--- a/src/components/DeviceJobDetails/DeviceJobDetails.vue
+++ b/src/components/DeviceJobDetails/DeviceJobDetails.vue
@@ -24,7 +24,7 @@
 					</div>
 					<div class="itemBoxRight">
 						<div class="itemTitle">关联算法:</div>
-						<div class="itemValue">{{ flystatus ? flystatus :'' }}</div>
+						<div class="itemValue">{{ flystatus ? flystatus : '' }}</div>
 					</div>
 				</div>
 				<JobRelatedEvents v-if="props.wayLineJodInfoId" />
@@ -103,9 +103,8 @@
 const achievementList = ref([])
 
 const props = defineProps(['wayLineJodInfoId'])
-const wayLineJodInfoId = computed(()=> props.wayLineJodInfoId)
-provide('wayLineJodInfoId',wayLineJodInfoId)
-
+const wayLineJodInfoId = computed(() => props.wayLineJodInfoId)
+provide('wayLineJodInfoId', wayLineJodInfoId)
 
 const getAchievement = () => {
 	getJobInfoFiles({ jobInfoId: wayLineJodInfoId.value }).then(res => {
@@ -229,6 +228,9 @@
 					margin-bottom: 24px;
 				}
 			}
+			.itemBoxLeft > :last-child:nth-child(odd) {
+				grid-column: 1 / -1;
+			}
 			.itemTitle {
 				color: #fff;
 			}
diff --git a/src/components/DeviceJobDetails/JobRelatedEvents.vue b/src/components/DeviceJobDetails/JobRelatedEvents.vue
index 8c53a87..97e8f6e 100644
--- a/src/components/DeviceJobDetails/JobRelatedEvents.vue
+++ b/src/components/DeviceJobDetails/JobRelatedEvents.vue
@@ -8,9 +8,9 @@
 			:row-style="{ height: '38px', fontSize: '14px', 'text-align': 'center' }"
 			:header-cell-style="{ 'text-align': 'center', height: '36px', fontSize: '14px' }"
 		>
-			<el-table-column prop="id" label="事件编号" />
+			<el-table-column prop="event_num" label="事件编号" />
 			<el-table-column show-overflow-tooltip prop="event_name" label="事件名称" />
-			<el-table-column show-overflow-tooltip prop="create_user" label="所属单位" />
+			<el-table-column show-overflow-tooltip prop="dept_name" label="所属单位" />
 			<el-table-column show-overflow-tooltip prop="remark" label="事件内容" />
 			<el-table-column show-overflow-tooltip prop="ai_types" label="关联算法" />
 			<el-table-column prop="status" label="工单状态">
diff --git a/src/router/views/index.js b/src/router/views/index.js
index b75a3e2..a2ee661 100644
--- a/src/router/views/index.js
+++ b/src/router/views/index.js
@@ -17,18 +17,6 @@
 				component: () => import(/* webpackChunkName: "home" */ '@/views/Home/Home.vue'),
 			},
 			{
-				path: 'signMachineNest',
-				name: '单个机巢详情',
-				meta: {
-					i18n: 'dashboard',
-					menu: false,
-				},
-				component: () =>
-					import(
-						/* webpackChunkName: "TaskManage" */ '@/views/SignMachineNest/SignMachineNest.vue'
-					),
-			},
-			{
 				path: 'taskManage',
 				name: '任务管理',
 				meta: {
diff --git a/src/store/modules/home.js b/src/store/modules/home.js
index f4b0ca8..73aa14f 100644
--- a/src/store/modules/home.js
+++ b/src/store/modules/home.js
@@ -11,38 +11,10 @@
 		currentAreaPosition:getStore({ name: 'currentAreaPosition' }) || {},
     singleUavHome: {},
 		footActiveIndex: 0,
-    singleTotal: {}, // 统计单个机巢数据
-    // 项目id
-    selectedWorkSpaceId: window.localStorage.getItem('bs_workspace_id'),
     // 事件 日 周 月 年
     eventTimeType: 'day',
     eventTimeParams: 'CURRENT_WEEK',
     eventTimeRang: '',
-    wsMessage: {},
-    deviceState: {
-      gatewayInfo: {},
-      deviceInfo: {},
-      timestamp: '',
-      dockInfo: {},
-      currentSn: '',
-      currentType: -1,
-      drone_charge_state_new: {},
-      psdk_widget_values: {},
-      speakerAudioPlayStartProgress: {},
-    },
-    osdVisible: {
-      // osd 显示设备相关信息
-      sn: '',
-      callsign: '',
-      model: '',
-      visible: false,
-      gateway_sn: '',
-      is_dock: false,
-      payloads: null,
-      device_domain: '',
-      device_sub_type: '',
-      device_type: '',
-    },
   },
   actions: {},
   mutations: {
@@ -69,54 +41,6 @@
     setSingleUavHome: (state, data) => {
       state.singleUavHome = data;
     },
-    setSingleTotal: (state, data) => {
-      state.singleTotal = data;
-    },
-    setSelectedWorkSpaceId: (state, id) => {
-      state.selectedWorkSpaceId = id
-      window.localStorage.setItem('bs_workspace_id', id)
-    },
-    setOsdVisibleInfo: (state, info) => {
-      state.osdVisible = Object.assign({}, info)
-      window.localStorage.setItem('bs_osd', JSON.stringify(info))
-    },
-    setWsMessage: (state, data) => {
-      state.wsMessage = data.data.host;
-    },
-    setDeviceInfo: (state, data) => {
-      const info = data.data
-      state.deviceState.timestamp = data.timestamp
-      state.deviceState.deviceInfo[info.sn] = info.host
-      state.deviceState.currentSn = info.sn
-      state.deviceState.currentType = EDeviceTypeName.Aircraft
-    },
-    setGatewayInfo: (state, info) => {
-      state.deviceState.gatewayInfo[info.sn] = info.host
-      state.deviceState.currentSn = info.sn
-      state.deviceState.currentType = EDeviceTypeName.Gateway
-    },
-    setDockOnfo: (state, info) => {
-      if (Object.keys(info.host).length === 0) return
-
-			if (!state.deviceState.dockInfo[info.sn]) {
-				state.deviceState.dockInfo[info.sn] = {}
-			}
-			state.deviceState.currentSn = info.sn
-			state.deviceState.currentType = EDeviceTypeName.Dock
-			const dock = state.deviceState.dockInfo[info.sn]
-			if (info.host.mode_code !== undefined) {
-				dock.basic_osd = info.host
-				state.deviceState.drone_charge_state_new = dock.basic_osd.drone_charge_state
-				return
-			}
-			if (info.host.sdr) {
-				dock.link_osd = info.host
-				return
-			}
-			if (info.host.job_number !== undefined) {
-				dock.work_osd = info.host
-			}
-		},
     setEventTimeType: (state, [timeType, timeParams]) => {
       state.eventTimeType = timeType
       state.eventTimeParams = timeParams
diff --git a/src/styles/element-ui.scss b/src/styles/element-ui.scss
index 5f68843..88eaafd 100644
--- a/src/styles/element-ui.scss
+++ b/src/styles/element-ui.scss
@@ -296,7 +296,7 @@
   }
 }
 //下拉
-// :teleported="false"
+// :teleported="false"(修改下拉框样式,在el-select添加)别删
 .ztzf-select {
   .el-select__wrapper {
     background: #012A50;
@@ -407,7 +407,6 @@
 }
 // 弹框-dialog
 .ztzf-dialog {
- 
 	background: #0f1929;
 	box-shadow: inset 0px -50px 50px 0px rgba(27, 148, 255, 0.13);
 	border-radius: 20px 0px 0px 0px;
@@ -422,7 +421,6 @@
 			rgba(27, 148, 255, 1)
 		)
 		2 2;
-  // 头部
   .el-dialog__header {
 		width: 100%;
 		height: 47px;
@@ -460,30 +458,21 @@
 }
 /* 时间选择器下拉面板 */
 .custom-time-picker {
-  /* 整体背景和边框 */
 background: linear-gradient( 180deg, rgba(13,53,86,0.85) 0%, rgba(1,35,80,0.85) 100%) !important;
 border-radius: 0px 0px 8px 8px;
 border: 1px solid !important;
 border-image: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(115, 192, 255, 1)) 1 1 !important;
-
-  /* 修改箭头样式 */
   .el-popper__arrow::before {
     background: #0D3556 !important;
     border: 1px solid #479DFF !important;
   }
-
-  /* 时间面板头部 */
   .el-time-panel__header {
     background: #012350 !important;
     color: #FFFFFF !important;
     border-bottom: 1px solid rgba(71, 157, 255, 0.3) !important;
   }
-
-  /* 时间选择区域 */
   .el-time-panel__content {
     background: #012350 !important;
-    
-    /* 时间数字项 */
     .el-time-spinner__item {
       color: #E6E6E6 !important;
       
@@ -518,3 +507,47 @@
     }
   }
 }
+// 树形选择
+.custom-tree-select {
+	background: linear-gradient(180deg, rgba(13, 53, 86, 0.85) 0%, rgba(1, 35, 80, 0.85) 100%) !important;
+	border-radius: 0px 0px 8px 8px;
+	border: 1px solid;
+	border-image: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(115, 192, 255, 1)) 1 1 !important;
+	.el-popper__arrow::before {
+		background: #0d3556 !important;
+		border: 1px solid #012350 !important;
+	}
+	.el-tree {
+		background: transparent !important;
+		color: #fff !important;
+		.el-tree-node__content:hover {
+			background: none !important;
+		}
+		.el-tree-node__content:hover {
+			background: none !important;
+		}
+	
+		.el-tree-node.is-current > .el-tree-node__content {
+			background: #479dff !important;
+			color: #479dff !important;
+		}
+	}
+
+	.el-select-dropdown__item {
+		background: none !important;
+		color: #fff !important;
+		input {
+			color: #fff !important;
+			&::placeholder {
+				color: #fff !important;
+			}
+		}
+	}
+	.el-tree {
+		--el-tree-node-hover-bg-color: none !important;
+		color: #fff !important;
+	}
+	.el-select-dropdown__item.is-selected {
+		color: var(--el-color-primary) !important;
+	}
+}
diff --git a/src/views/Home/AINowFly.vue b/src/views/Home/AINowFly.vue
index f56f39e..427a365 100644
--- a/src/views/Home/AINowFly.vue
+++ b/src/views/Home/AINowFly.vue
@@ -3,15 +3,15 @@
 		<div class="title">智引即飞<img @click="closeClick" src="@/assets/images/aiNowFly/close.png"/></div>
 		<el-form ref="ruleFormRef" :model="params" :rules="rules" label-width="auto" size="small" status-icon>
 			<el-form-item label="任务名称" prop="name">
-				<el-input v-model="params.name" />
+				<el-input class="ztzf-input" v-model="params.name" />
 			</el-form-item>
 			<el-form-item label="关联算法" prop="ai_types">
-				<el-select v-model="params.ai_types" placeholder="请选择" multiple collapse-tags collapse-tags-tooltip>
+				<el-select :teleported="false" class="ztzf-select" v-model="params.ai_types" placeholder="请选择" multiple collapse-tags collapse-tags-tooltip>
 					<el-option v-for="item in taskAlgorithm" :key="item.id" :label="item.dictValue" :value="item.dictKey" />
 				</el-select>
 			</el-form-item>
 			<el-form-item label="地址">
-				<el-input disabled type="text" v-model="di" placeholder="地名&经纬度"/>
+				<el-input class="ztzf-input" disabled type="text" v-model="di" placeholder="地名&经纬度"/>
 			</el-form-item>
 			<!--			todo-->
 			<el-form-item label="飞行事件">
@@ -353,13 +353,16 @@
     :deep(.el-select),
     :deep(.el-select__wrapper) {
       background-color: #021740;
-      box-shadow: 0 0 0 1px #026AD6;
-
       &.is-focus {
         box-shadow: 0 0 0 1px #026AD6;
       }
     }
-
+:deep(.el-tag, .el-tag.el-tag--primary),
+:deep(.el-tag.el-tag--info) {
+    --el-tag-bg-color: none !important; 
+     --el-tag-border-color: none !important; 
+    --el-tag-hover-color: none !important; 
+}
     :deep(.el-input__wrapper.is-disabled) {
       background-color: #021740;
       box-shadow: 0 0 0 1px #026AD6;
diff --git a/src/views/Home/EventOverviewDetail/EventOverviewDetailRight.vue b/src/views/Home/EventOverviewDetail/EventOverviewDetailRight.vue
index 67bc799..07a823c 100644
--- a/src/views/Home/EventOverviewDetail/EventOverviewDetailRight.vue
+++ b/src/views/Home/EventOverviewDetail/EventOverviewDetailRight.vue
@@ -13,6 +13,7 @@
 			/>
 
 			<el-date-picker
+			popper-class="custom-date-picker"
 				class="ztzf-date-picker"
 				v-model="timeArr"
 				type="daterange"
@@ -24,6 +25,7 @@
 			/>
 
 			<el-select
+			:teleported="false"
 				class="ztzf-select"
 				:style="{ width: pxToRem(174) }"
 				v-model="params.device_sn"
@@ -36,6 +38,7 @@
 			</el-select>
 
 			<el-select
+			:teleported="false"
 				class="ztzf-select"
 				:style="{ width: pxToRem(174) }"
 				v-model="params.word_order_type"
diff --git a/src/views/Home/Home.vue b/src/views/Home/Home.vue
index a2aa0b8..0c697e8 100644
--- a/src/views/Home/Home.vue
+++ b/src/views/Home/Home.vue
@@ -48,6 +48,7 @@
 	store.commit('setSingleUavHome', null)
 	store.commit('setIsEventOverviewDetail', false)
 	store.commit('setFootActiveIndex', 0)
+	store.commit('setSelectedAreaCode', null)
 	viewerDestory()
 })
 
diff --git a/src/views/Home/SearchBox.vue b/src/views/Home/SearchBox.vue
index fb3b28c..1ef74b7 100644
--- a/src/views/Home/SearchBox.vue
+++ b/src/views/Home/SearchBox.vue
@@ -15,6 +15,7 @@
 		<div class="searchBtn" @click="searchClick"></div>
 		<div class="region">
 			<el-tree-select
+				popper-class="custom-tree-select"
 				v-model="treeValue"
 				check-strictly
 				lazy
diff --git a/src/views/SignMachineNest/MachineLeft/MachineData.vue b/src/views/SignMachineNest/MachineLeft/MachineData.vue
index 8892a6d..01ccb7d 100644
--- a/src/views/SignMachineNest/MachineLeft/MachineData.vue
+++ b/src/views/SignMachineNest/MachineLeft/MachineData.vue
@@ -27,9 +27,9 @@
 
 const statisticsList = ref([]);
 
+const singleTotal = inject('singleTotal')
 // 添加监听
-watch(
-  () => store.state.home.singleTotal,
+watch(singleTotal,
   (newValue) => {
     if (!newValue) return;
     statisticsList.value = [
diff --git a/src/views/SignMachineNest/MachineRight/InspectionRaskList.vue b/src/views/SignMachineNest/MachineRight/InspectionRaskList.vue
index 2253d3b..8e3384d 100644
--- a/src/views/SignMachineNest/MachineRight/InspectionRaskList.vue
+++ b/src/views/SignMachineNest/MachineRight/InspectionRaskList.vue
@@ -81,8 +81,7 @@
 let viewer = null
 
 let { taskDetails, workspace_id, getTaskDetails } = useTaskDetails()
-let { wsInfo, removeWS } = useDroneWS(workspace_id) //ws信息,是一个ref对象
-
+const wsInfo = inject('wsInfo')
 const store = useStore()
 // 设备任务详情
 let currentInfoId = ref('')
@@ -201,7 +200,7 @@
 const taskClick = item => {
 	if (tabIndex.value === 1) {
 		// 展示当前任务详情
-		if (!item?.device_sns.length) return ElMessage.warning('没有device_sns');
+		if (!item?.device_sns?.length) return ElMessage.warning('没有device_sns');
 		if (item?.device_sns?.length !== 1) {
 			// todo 后续开发
 			ElMessage.success('即将跳转到集群调度');
diff --git a/src/views/SignMachineNest/MachineRight/MachineMonitor.vue b/src/views/SignMachineNest/MachineRight/MachineMonitor.vue
index 27fdf5e..835382e 100644
--- a/src/views/SignMachineNest/MachineRight/MachineMonitor.vue
+++ b/src/views/SignMachineNest/MachineRight/MachineMonitor.vue
@@ -15,13 +15,17 @@
 import CommonTitle from '@/components/CommonTitle.vue'
 import LiveVideo from '@/components/LiveVideo.vue'
 import { liveStart } from '@/api/home/machineNest'
-// import { CURRENT_CONFIG as config } from '@/utils/http/config'
 import { useStore } from 'vuex'
 
 const store = useStore()
 // 单个机巢信息
 const singleUavHome = computed(() => store.state.home.singleUavHome);
-const osdVisible = computed(() => store.state.home.osdVisible);
+const wsInfo = inject('wsInfo')
+let device_osd_info = computed(() => wsInfo.value?.device_osd || {});
+let device_osd_host = computed(() => device_osd_info?.value?.data?.host || {});
+
+const dockSn = inject('dockSn')
+const droneSn = inject('droneSn')
 // 直播地址
 let airPortUrl = ref('')
 // 获取机巢直播地址
@@ -43,14 +47,13 @@
 
 const isTakeOff = ref(false)
 // 监听ws消息
-watch(() => store.state.home.deviceState, async (newValue) => {
-		const deviceInfo = newValue?.deviceInfo[osdVisible.value.sn]
-		if (!deviceInfo) return
-		const currentIsTakeOff = ![14, 0].includes(deviceInfo?.mode_code)
+watch(device_osd_host, async () => {
+		if (device_osd_host?.value?.mode_code === undefined) return
+	  const currentIsTakeOff = ![14, 0].includes(device_osd_host.value?.mode_code)
 		// 如果还是之前的状态,不切换
 		if (isTakeOff.value === currentIsTakeOff) return
 		isTakeOff.value = currentIsTakeOff
-		isTakeOff.value ? await getDroneLiveUrl(osdVisible.value.sn, 2) : await getVideoUrl(singleUavHome.value.device_sn, 1)
+		isTakeOff.value ? await getDroneLiveUrl(droneSn.value, 2) : await getVideoUrl(dockSn.value, 1)
 	},
 	{
 		immediate: true,
@@ -59,7 +62,7 @@
 )
 
 onMounted(() => {
-	getVideoUrl(singleUavHome.value.device_sn, 1)
+	getVideoUrl(dockSn.value, 2)
 })
 onUnmounted(() => {
 	airPortUrl.value = ''
diff --git a/src/views/SignMachineNest/MachineRight/MachineStatus/MachineStatus.vue b/src/views/SignMachineNest/MachineRight/MachineStatus/MachineStatus.vue
index ad8534a..c735d0b 100644
--- a/src/views/SignMachineNest/MachineRight/MachineStatus/MachineStatus.vue
+++ b/src/views/SignMachineNest/MachineRight/MachineStatus/MachineStatus.vue
@@ -7,7 +7,7 @@
 				<img src="../../../../assets/images/signMachineNest/machineRight/wrj.png" alt="" />
 				<div class="info-right">
 					<!-- <div class="name">{{ osdVisible?.callsign || '--' }}</div> -->
-					<div class="name">{{ osdVisible?.nickname || '--' }}</div>
+					<div class="name">{{ dockDetails?.nickname || '--' }}</div>
 					<div class="wz">
 						<span class="left">当前位置:</span>
 						<span class="right">{{ detailInfo.longitude }},{{ detailInfo.latitude }}</span>
@@ -96,16 +96,18 @@
 import { useStore } from 'vuex'
 import MachineTableDetails from '@/views/SignMachineNest/MachineRight/MachineStatus/MachineTableDetails/MachineTableDetails.vue'
 
-const store = useStore()
 // 获取机巢信息
-let osdVisible = ref({}) //computed(() => store.state.home.osdVisible);
-const singleUavHome = computed(() => store.state.home.singleUavHome)
+const wsInfo = inject('wsInfo')
+const dockDetails = inject('dockDetails')
+let device_osd_info = computed(() => wsInfo.value?.device_osd || {})
+let device_osd_host = computed(() => device_osd_info?.value?.data?.host || {})
+let dock_osd_info = computed(() => wsInfo.value?.dock_osd || {})
+let dock_osd_host = computed(() => dock_osd_info.value?.data?.host || {})
 // 单个机巢统计数据
-const singleTotal = computed(() => store.state.home.singleTotal)
+const singleTotal = inject('singleTotal')
 // 是否展示机机巢状态详情
 let isShowDetails = ref(false)
 
-let str = '--'
 let drone_charge_state = ref({
 	capacity_percent: '--',
 	state: 0,
@@ -122,55 +124,16 @@
 	capacity_percent: '--',
 })
 let quality = ref(['弱', '较弱', '中等', '较强', '强'])
-let deviceInfo = ref({
-	gateway: {
-		capacity_percent: str,
-		transmission_signal_quality: str,
-	},
-	dock: {},
-	device: {
-		gear: -1,
-		mode_code: EModeCode.Disconnected,
-		height: str,
-		home_distance: str,
-		horizontal_speed: str,
-		vertical_speed: str,
-		wind_speed: str,
-		wind_direction: str,
-		elevation: str,
-		position_state: {
-			gps_number: str,
-			is_fixed: 0,
-			rtk_number: str,
-		},
-		battery: {
-			capacity_percent: str,
-			landing_power: str,
-			remain_flight_time: 0,
-			return_home_power: str,
-		},
-		latitude: 0,
-		longitude: 0,
-	},
-})
-let mode_code = ref('已断开连接')
-
-watch(
-	() => store.state.home.osdVisible,
-	newValue => {
-		osdVisible.value = newValue
-	}
-)
 
 // 监听实时信息
 watch(
-	() => store.state.home.wsMessage,
+	device_osd_host,
 	newValue => {
-		if (newValue.mode_code === 14) return
+		if (!newValue) return
+		if (newValue?.mode_code === 14) return
 		if (Object.keys(newValue).length === 0) return
 		detailInfo.value.longitude = newValue?.longitude.toFixed(6) || '--'
 		detailInfo.value.latitude = newValue?.latitude.toFixed(6) || '--'
-		// console.log(window.$viewer)
 		getLnglatAltitude(Number(detailInfo.value.longitude), Number(detailInfo.value.latitude), window.$viewer).then(
 			res => {
 				const height = newValue?.height - res?.height
@@ -191,57 +154,32 @@
 	},
 	{ immediate: true, deep: true }
 )
+
+// EDeviceTypeName.Dock
 // 获取最新机场状态
 watch(
-	store.state.home.deviceState,
-	newValue => {
-		// console.log('newValue', newValue);
-		if (newValue.currentType === EDeviceTypeName.Dock && newValue?.dockInfo[newValue.currentSn]) {
-			// 机场状态
-			mode_code.value = EDockModeText[newValue?.dockInfo[newValue.currentSn]?.basic_osd?.mode_code]
-			// this.$emit('updateModeCode', mode_code.value);
-			// 舱内状态
-			AircraftStatus.value =
-				EModeText[
-					newValue.deviceInfo[deviceInfo.value.dock.basic_osd?.sub_device?.device_sn ?? osdVisible.sn]?.mode_code
-				]
-			// 舱内关机时显示的电量
-			let child_sn = newValue?.dockInfo[newValue.currentSn].basic_osd?.sub_device?.device_sn
-			// 飞机在线时取飞机中的电量
-			if (newValue.deviceInfo[child_sn]) {
-				drone_charge_state.value = {
-					capacity_percent: newValue.deviceInfo[child_sn].battery.capacity_percent,
-					state: newValue.deviceInfo[child_sn].battery.landing_power,
-				}
-			} else {
-				// 遥控器这里拿不到值data.drone_charge_state_new == undefined 会一直报错
-				if (newValue.drone_charge_state_new) {
-					drone_charge_state.value = newValue.drone_charge_state_new
-				}
+	wsInfo,
+	() => {
+		if (device_osd_host.value?.mode_code !== undefined) {
+			AircraftStatus.value = EModeText?.[device_osd_host.value?.mode_code] || '--'
+		}
+		// 飞机在线时取飞机中的电量
+		if (device_osd_host.value?.battery) {
+			drone_charge_state.value = {
+				capacity_percent: device_osd_host.value.battery.capacity_percent,
+				state: device_osd_host.value.battery.landing_power,
 			}
-			if (osdVisible.value.visible && osdVisible.value.is_dock && osdVisible.value.gateway_sn !== '') {
-				deviceInfo.value.dock = newValue.dockInfo[osdVisible.value.gateway_sn]
-				deviceInfo.value.device =
-					newValue.deviceInfo[deviceInfo.value.dock.basic_osd?.sub_device?.device_sn ?? osdVisible.value.sn]
-				// 设备关机即不显示信息
-				// 兼容遥控器 关闭无人机 mode_code返回的是14 不是undefined
-				if (
-					newValue.deviceInfo[deviceInfo.value.dock.basic_osd?.sub_device?.device_sn ?? osdVisible.value.sn]
-						?.mode_code === undefined ||
-					newValue.deviceInfo[deviceInfo.value.dock.basic_osd?.sub_device?.device_sn ?? osdVisible.value.sn]
-						?.mode_code == 14
-				) {
-					detailInfo.value = {
-						longitude: '--',
-						latitude: '--',
-						home_distance: '--',
-						quality: '--',
-						horizontal_speed: '--',
-						remain_flight_time: '--',
-						height: '--',
-						capacity_percent: '--',
-					}
-				}
+		}
+		if (device_osd_host.value?.mode_code === undefined || device_osd_host.value?.mode_code === 14) {
+			detailInfo.value = {
+				longitude: '--',
+				latitude: '--',
+				home_distance: '--',
+				quality: '--',
+				horizontal_speed: '--',
+				remain_flight_time: '--',
+				height: '--',
+				capacity_percent: '--',
 			}
 		}
 	},
@@ -343,7 +281,6 @@
 				.close {
 					width: 60px;
 					height: 20px;
-					line-height: 20px;
 					background: rgba(255, 178, 106, 0.2);
 					border-radius: 4px 4px 4px 4px;
 					border: 1px solid #ffb26a;
diff --git a/src/views/SignMachineNest/MachineRight/MachineStatus/MachineTableDetails/MachineTableDetails.vue b/src/views/SignMachineNest/MachineRight/MachineStatus/MachineTableDetails/MachineTableDetails.vue
index e44d230..884c8bc 100644
--- a/src/views/SignMachineNest/MachineRight/MachineStatus/MachineTableDetails/MachineTableDetails.vue
+++ b/src/views/SignMachineNest/MachineRight/MachineStatus/MachineTableDetails/MachineTableDetails.vue
@@ -57,7 +57,7 @@
 	{ name: '机巢状态', value: '', field: 'status' },
 ])
 const store = useStore()
-const singleTotal = computed(() => store.state.home.singleTotal)
+const singleTotal = inject('singleTotal')
 watch(singleTotal, val => {
 	if (val?.device_info) {
 		infoList.value.forEach(item => {
diff --git a/src/views/SignMachineNest/SignMachineNest.vue b/src/views/SignMachineNest/SignMachineNest.vue
index 3e2828f..48913f7 100644
--- a/src/views/SignMachineNest/SignMachineNest.vue
+++ b/src/views/SignMachineNest/SignMachineNest.vue
@@ -6,51 +6,27 @@
 <script setup>
 import MachineLeft from '@/views/SignMachineNest/MachineLeft/MachineLeft.vue'
 import MachineRight from '@/views/SignMachineNest/MachineRight/MachineRight.vue'
-import { useConnectWebSocket } from '@/utils/websocket/connect-websocket'
-import { getWebsocketUrl } from '@/websocket/util/config'
-import { EBizCode } from '@/utils/staticData/enums.js'
-import { EModeCode } from '@/utils/staticData/device.js'
 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('')
-// 进入单个机巢开始连接ws
-const createWsConntect = () => {
-	let webSorketUrl = getWebsocketUrl() + '&workspace-id=' + workspaceId.value
-	// 监听ws 消息
-	connectWs.value = useConnectWebSocket(messageHandler, webSorketUrl)
-}
-
-const messageHandler = result => {
-	let payload = JSON.parse(result) // 为了兼容聊天消息
-	if (!payload) return
-	switch (payload.biz_code) {
-		case EBizCode.GatewayOsd: {
-			store.commit('setGatewayInfo', payload.data)
-			break
-		}
-		case EBizCode.DeviceOsd: {
-			store.commit('setDeviceInfo', payload)
-			store.commit('setWsMessage', payload)
-			break
-		}
-		case EBizCode.DockOsd: {
-			store.commit('setDockOnfo', payload.data)
-			break
-		}
-		default:
-			break
-	}
-}
+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({
@@ -60,46 +36,43 @@
 	},
 })
 
-// 获取单个机巢信息
 const getSingleDetails = () => {
 	getDeviceDetail(singleUavHome.value.device_sn).then(res => {
-		if (res.data.code !== 0) return
 		const result = res.data.data
-
+		dockDetails.value = result
+    const storageObj  = _.pick(result, ['latitude', 'longitude'])
+		setSingleUavAreaCode(storageObj)
 		initDroneEntity({
 			lng: result.longitude,
 			lat: result.latitude,
 			status: result.status,
 		})
-
-		const child = result.children
-		// 对应store 里面数据结构
-		osdVisible.value.nickname = result.nickname || '--'
-		osdVisible.value.sn = child?.device_sn || ''
-		osdVisible.value.callsign = child?.nickname || '--'
-		osdVisible.value.model = EModeCode.Disconnected || ''
-		osdVisible.value.visible = true
-		osdVisible.value.gateway_sn = result?.device_sn || ''
-		osdVisible.value.is_dock = true
-		osdVisible.value.gateway_callsign = result?.callsign || '--'
-		osdVisible.value.payloads = child?.payloads_list || []
-		osdVisible.value.device_domain = child.domain || 0
-		osdVisible.value.device_sub_type = child.sub_type || 1
-		osdVisible.value.device_type = child.type || 0
-		// osdVisible.value.latest_wayline_job = result?.latest_wayline_job || {}
-		store.commit('setOsdVisibleInfo', osdVisible.value)
-		store.commit('setSelectedWorkSpaceId', result.workspace_id)
 		workspaceId.value = result.workspace_id
-		createWsConntect()
 	})
 }
+
+// 设置单机巢得位置信息
+const setSingleUavAreaCode = (position) =>{
+	store.commit('setSingleUavHome',{...singleUavHome.value, ...position})
+	const params = {
+		output:'json',
+		location: position.longitude+','+position.latitude,
+		key:'6c3ea75b215f0c0efcbcfdf13273991b',
+		radius:'0',
+		extensions:'base',
+	}
+	// todo 2025年4月23号 后端提供接口然后对接
+	// getAreaCodeApi(params).then(res => {
+	// 	console.log(res,66666666)
+	// })
+}
+
 
 // 获取机巢统计数据 提供给左右侧组件使用
 const getMachineData = () => {
 	getFlightStatistics(singleUavHome.value.device_sn).then(res => {
 		if (res.data.code !== 0) return
-		const result = res.data.data
-		store.commit('setSingleTotal', result)
+		singleTotal.value = res.data.data
 	})
 }
 

--
Gitblit v1.9.3