From bb4640a61a79dfece7e3ffeef579685267881852 Mon Sep 17 00:00:00 2001
From: husq <931347610@qq.com>
Date: Thu, 02 Nov 2023 12:59:31 +0800
Subject: [PATCH] 实时轨迹提交

---
 src/pages/page-web/projects/tsa.vue        |   41 +++++++++++++++++++++++------------------
 src/components/g-map/DroneControlPanel.vue |   16 ++++++++--------
 2 files changed, 31 insertions(+), 26 deletions(-)

diff --git a/src/components/g-map/DroneControlPanel.vue b/src/components/g-map/DroneControlPanel.vue
index a143ba3..bf5c592 100644
--- a/src/components/g-map/DroneControlPanel.vue
+++ b/src/components/g-map/DroneControlPanel.vue
@@ -347,14 +347,14 @@
   //   message.warn('请先进入控制!')
   // }
   // cmdItem.loading = false
-    if (result) {
-        message.success('返航成功')
-    }
-    // 退出飞行控制
-    if (result && flightController.value) {
-        exitFlightCOntrol()
-    }
-    cmdItem.loading = false
+  if (result) {
+    message.success('返航成功')
+  }
+  // 退出飞行控制
+  if (result && flightController.value) {
+    exitFlightCOntrol()
+  }
+  cmdItem.loading = false
 }
 
 const emits = defineEmits(['update:modelValue'])
diff --git a/src/pages/page-web/projects/tsa.vue b/src/pages/page-web/projects/tsa.vue
index e69b7af..cfa3e6f 100644
--- a/src/pages/page-web/projects/tsa.vue
+++ b/src/pages/page-web/projects/tsa.vue
@@ -306,7 +306,10 @@
 const onlineDevices = reactive({
   data: [] as OnlineDevice[]
 })
-
+// 机场序列号
+const dock = ref('')
+// 无人机序列号
+const device_dock = ref('')
 const onlineDocks = reactive({
   data: [] as OnlineDevice[]
 })
@@ -351,7 +354,6 @@
         heading: data.deviceInfo[data.currentSn].attitude_head,
       }
       cesium.updateEntityPosition(data.deviceInfo[data.currentSn].longitude, data.deviceInfo[data.currentSn].latitude, 'drone_fly', orientation)
-      console.log(data, '======', data.dockInfo[data.currentSn], '==========')
     } else {
       // 无人机图标
       const setting = {
@@ -382,6 +384,22 @@
       }
       cesium.addPolyline(routeTrajectory)
     }
+    // eslint-disable-next-line eqeqeq
+    // 3、4、5的时候代表飞行过程 绘制路线
+    console.log(data.deviceInfo[data.currentSn], 'Aircraft')
+    // eslint-disable-next-line eqeqeq
+    if (data.deviceInfo[data.currentSn].mode_code && (data.deviceInfo[data.currentSn].mode_code == 3 || data.deviceInfo[data.currentSn].mode_code == 4 || data.deviceInfo[data.currentSn].mode_code == 5)) {
+      const newPositions = Cesium.Cartesian3.fromDegreesArray([data.deviceInfo[data.currentSn].longitude, data.deviceInfo[data.currentSn].latitude])
+      previousPositions.value = previousPositions.value.concat(newPositions)
+      //  更新线段的位置
+      const drone_route = cesium.getEntityById('drone_route')
+      drone_route.polyline.positions = previousPositions.value
+    // eslint-disable-next-line eqeqeq
+    } else if (data.deviceInfo[data.currentSn].mode_code == 0 || data.deviceInfo[data.currentSn].mode_code == 14) {
+      const drone_route = cesium.getEntityById('drone_route')
+      previousPositions.value = []
+      drone_route.polyline.positions = previousPositions.value
+    }
   }
   if (data.currentType === EDeviceTypeName.Dock && data.dockInfo[data.currentSn]) {
     if (snCode.value.includes(data.currentSn)) return
@@ -400,21 +418,6 @@
     }
     cesium.addPoint(setting)
     // cesium.flyTo(setting)
-  }
-  // 如果机场属性为3、4、5 则说明一定有无人机的信息数据
-  // 根据机场状态码判断是否实时更新轨迹航线
-  if (data.dockInfo[data.currentSn] && (data.dockInfo[data.currentSn].basic_osd.mode_code === 3 || data.dockInfo[data.currentSn].basic_osd.mode_code === 4 || data.dockInfo[data.currentSn].basic_osd.mode_code === 5)) {
-    // 生成新的位置数组
-    // oldData.deviceInfo[data.currentSn].longitude, oldData.deviceInfo[data.currentSn].latitude,
-    const newPositions = Cesium.Cartesian3.fromDegreesArray([data.deviceInfo[data.currentSn].longitude, data.deviceInfo[data.currentSn].latitude])
-    previousPositions.value = previousPositions.value.concat(newPositions)
-    //  更新线段的位置
-    const drone_route = cesium.getEntityById('drone_route')
-    drone_route.polyline.positions = previousPositions.value
-  } else {
-    // 清除实时轨迹
-    previousPositions.value = []
-    cesium.removeById('drone_route')
   }
 }, {
   deep: true,
@@ -514,7 +517,9 @@
 }
 
 function switchVisible (e: any, device: OnlineDevice, isDock: boolean, isClick: boolean, sn?: any) {
-  // showDrawer.value = !showDrawer.value
+  dock.value = device.gateway.sn
+  device_dock.value = device.sn
+  // showDrawer.value = !showDr++awer.value
   if (!isClick) {
     e.target.style.cursor = 'not-allowed'
     return

--
Gitblit v1.9.3