From 54849757852f6ab40eb17afbd03d1d839b60a38d Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Mon, 13 Nov 2023 17:09:15 +0800
Subject: [PATCH] 重复定时和连续执行

---
 src/pages/page-web/projects/tsa.vue |  293 +++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 195 insertions(+), 98 deletions(-)

diff --git a/src/pages/page-web/projects/tsa.vue b/src/pages/page-web/projects/tsa.vue
index c5e1dfb..8417112 100644
--- a/src/pages/page-web/projects/tsa.vue
+++ b/src/pages/page-web/projects/tsa.vue
@@ -13,22 +13,37 @@
       <a-collapse :bordered="false" expandIconPosition="right" accordion style="background: #232323;">
         <a-collapse-panel :key="EDeviceTypeName.Dock" header="机场" style="border-bottom: 1px solid #4f4f4f;">
           <div v-if="onlineDocks.data.length === 0" style="height: 150px; color: white;">
-            <a-empty style="color: #fff;" :image="simpleImage" description="暂无数据"
-                     :image-style="{ height: '60px' }"/>
+            <a-empty style="color: #fff;" :image="simpleImage" description="暂无数据" :image-style="{ height: '60px' }" />
           </div>
           <div v-else class="fz12" style="color: white;">
             <div v-for="dock in onlineDocks.data" :key="dock.sn"
-                 style="background: #3c3c3c; height: 90px; margin-bottom: 10px;">
-              <div style="border-radius: 2px; height: 100%; width: 100%;"
-                   class="flex-row flex-justify-between flex-align-center">
+              style="background: #3c3c3c; margin-bottom: 10px;">
+              <div class="task_wrapper" v-if="dock.latest_wayline_job">
+                <div class="task_content task_content_way" v-if="deviceInfo[dock.sn] && deviceInfo[dock.sn].mode_code === 5">
+                  <div class="task_status">
+                    <ContainerOutlined />
+                    <span>执行任务中</span>
+                  </div>
+                </div>
+                <div class="task_content" v-else>
+                  <div class="task_status">
+                    <ContainerOutlined />
+                    <span>待执行</span>
+                  </div>
+                  <div class="task_info">{{dock.latest_wayline_job.is_later ? '今天': '明天'}}{{convertTimestampToDate(dock.latest_wayline_job.begin_time, 'hh:mm')}}</div>
+                </div>
+                <div class="task_title">{{dock.latest_wayline_job.name}}</div>
+              </div>
+              <div style="border-radius: 2px; height: 90px; width: 100%;"
+                class="flex-row flex-justify-between flex-align-center">
                 <div style="float: left; padding: 0px 5px 8px 8px; width: 88%">
                   <!-- // 机场设备标题 -->
                   <div style="width: 80%; height: 30px; line-height: 30px; font-size: 16px;">
                     <a-tooltip :title="`${dock.gateway.callsign} - ${dock.callsign ?? 'No Drone'}`">
                       <div class="text-hidden" style="max-width: 200px;">{{ dock.gateway.callsign }} - {{
-                          dock.callsign ??
-                          'No Drone'
-                        }}
+                        dock.callsign ??
+                        'No Drone'
+                      }}
                       </div>
                     </a-tooltip>
                   </div>
@@ -36,13 +51,13 @@
                   <div class="mt5 flex-align-center flex-row flex-justify-between" style="background: #595959;">
                     <div class="flex-align-center flex-row">
                       <span class="ml5 mr5">
-                        <RobotOutlined/>
+                        <RobotOutlined />
                       </span>
                       <div class="font-bold text-hidden" style="max-width: 80px;"
-                           :style="dockInfo[dock.gateway.sn] && dockInfo[dock.gateway.sn].basic_osd?.mode_code !== EDockModeCode.Disconnected ? 'color: #00ee8b' : 'color: red;'">
+                        :style="dockInfo[dock.gateway.sn] && dockInfo[dock.gateway.sn].basic_osd?.mode_code !== EDockModeCode.Disconnected ? 'color: #00ee8b' : 'color: red;'">
                         {{
                           dockInfo[dock.gateway.sn] ? EDockModeText[dockInfo[dock.gateway.sn].basic_osd?.mode_code] :
-                              EDockModeText[EDockModeCode.Disconnected]
+                          EDockModeText[EDockModeCode.Disconnected]
                         }}
                       </div>
                     </div>
@@ -50,37 +65,37 @@
                       <div v-if="hmsInfo[dock.gateway.sn]" class="flex-align-center flex-row">
                         <div :class="hmsInfo[dock.gateway.sn][0].level === EHmsLevel.CAUTION ? 'caution-blink' :
                           hmsInfo[dock.gateway.sn][0].level === EHmsLevel.WARN ? 'warn-blink' : 'notice-blink'"
-                             style="width: 18px; height: 16px; text-align: center;">
+                          style="width: 18px; height: 16px; text-align: center;">
                           <span :style="hmsInfo[dock.gateway.sn].length > 99 ? 'font-size: 11px' : 'font-size: 12px'">{{
-                              hmsInfo[dock.gateway.sn].length
-                            }}</span>
+                            hmsInfo[dock.gateway.sn].length
+                          }}</span>
                           <span class="fz10">{{ hmsInfo[dock.gateway.sn].length > 99 ? '+' : '' }}</span>
                         </div>
                         <a-popover trigger="click" placement="bottom" color="black"
-                                   v-model:visible="hmsVisible[dock.gateway.sn]"
-                                   @visibleChange="readHms(hmsVisible[dock.gateway.sn], dock.gateway.sn)"
-                                   :overlayStyle="{ width: '200px', height: '300px' }">
+                          v-model:visible="hmsVisible[dock.gateway.sn]"
+                          @visibleChange="readHms(hmsVisible[dock.gateway.sn], dock.gateway.sn)"
+                          :overlayStyle="{ width: '200px', height: '300px' }">
                           <div :class="hmsInfo[dock.gateway.sn][0].level === EHmsLevel.CAUTION ? 'caution' :
                             hmsInfo[dock.gateway.sn][0].level === EHmsLevel.WARN ? 'warn' : 'notice'"
-                               style="margin-left: 3px; width: 107px; height: 16px;">
+                            style="margin-left: 3px; width: 107px; height: 16px;">
                             <span class="word-loop">{{ hmsInfo[dock.gateway.sn][0].message_zh }}</span>
                           </div>
                           <template #content>
                             <a-collapse style="background: black; height: 300px; overflow-y: auto;" :bordered="false"
-                                        expand-icon-position="right" :accordion="true">
+                              expand-icon-position="right" :accordion="true">
                               <a-collapse-panel v-for="hms in hmsInfo[dock.gateway.sn]" :key="hms.hms_id"
-                                                :showArrow="false"
-                                                style=" margin: 0 auto 3px auto; border: 0; width: 140px; border-radius: 3px"
-                                                :class="hms.level === EHmsLevel.CAUTION ? 'caution' : hms.level === EHmsLevel.WARN ? 'warn' : 'notice'">
+                                :showArrow="false"
+                                style=" margin: 0 auto 3px auto; border: 0; width: 140px; border-radius: 3px"
+                                :class="hms.level === EHmsLevel.CAUTION ? 'caution' : hms.level === EHmsLevel.WARN ? 'warn' : 'notice'">
                                 <template #header="{ isActive }">
                                   <div class="flex-row flex-align-center" style="width: 130px;">
                                     <div style="width: 110px;">
                                       <span class="word-loop">{{ hms.message_zh }}</span>
                                     </div>
                                     <div style="width: 20px; height: 15px; font-size: 10px; z-index: 2 "
-                                         class="flex-row flex-align-center flex-justify-center"
-                                         :class="hms.level === EHmsLevel.CAUTION ? 'caution' : hms.level === EHmsLevel.WARN ? 'warn' : 'notice'">
-                                      <DoubleRightOutlined :rotate="isActive ? 90 : 0"/>
+                                      class="flex-row flex-align-center flex-justify-center"
+                                      :class="hms.level === EHmsLevel.CAUTION ? 'caution' : hms.level === EHmsLevel.WARN ? 'warn' : 'notice'">
+                                      <DoubleRightOutlined :rotate="isActive ? 90 : 0" />
                                     </div>
                                   </div>
                                 </template>
@@ -96,17 +111,19 @@
                       <div v-else class="width-100" style="height: 90%; background: rgba(0, 0, 0, 0.35)">N/A</div>
                     </div>
                   </div>
+
                   <!-- // 机场是否启动 -->
                   <div class="mt5 flex-align-center flex-row flex-justify-between" style="background: #595959;">
                     <div class="flex-row">
                       <span class="ml5 mr5">
-                        <RocketOutlined/>
+                        <RocketOutlined />
                       </span>
                       <div class="font-bold text-hidden" style="max-width: 80px"
-                           :style="deviceInfo[dock.sn] && deviceInfo[dock.sn].mode_code !== EModeCode.Disconnected ? 'color: #00ee8b' : 'color: red;'">
+                        :style="deviceInfo[dock.sn] && deviceInfo[dock.sn].mode_code !== EModeCode.Disconnected || dockInfo[dock.gateway.sn].basic_osd?.drone_in_dock === 1 ? 'color: #00ee8b' : 'color: red;'">
                         {{
                           deviceInfo[dock.sn] ? EModeText[deviceInfo[dock.sn].mode_code] :
-                              EModeText[EModeCode.Disconnected]
+                          dockInfo[dock.gateway.sn].basic_osd?.drone_in_dock === 1 ? '舱内关机' :
+                            EModeText[EModeCode.Disconnected]
                         }}
                       </div>
                     </div>
@@ -114,36 +131,35 @@
                       <div v-if="hmsInfo[dock.sn]" class="flex-align-center flex-row">
                         <div :class="hmsInfo[dock.sn][0].level === EHmsLevel.CAUTION ? 'caution-blink' :
                           hmsInfo[dock.sn][0].level === EHmsLevel.WARN ? 'warn-blink' : 'notice-blink'"
-                             style="width: 18px; height: 16px; text-align: center;">
+                          style="width: 18px; height: 16px; text-align: center;">
                           <span :style="hmsInfo[dock.sn].length > 99 ? 'font-size: 11px' : 'font-size: 12px'">{{
-                              hmsInfo[dock.sn].length
-                            }}</span>
+                            hmsInfo[dock.sn].length
+                          }}</span>
                           <span class="fz10">{{ hmsInfo[dock.sn].length > 99 ? '+' : '' }}</span>
                         </div>
-                        <a-popover trigger="click" placement="bottom" color="black"
-                                   v-model:visible="hmsVisible[dock.sn]"
-                                   @visibleChange="readHms(hmsVisible[dock.sn], dock.sn)"
-                                   :overlayStyle="{ width: '200px', height: '300px' }">
+                        <a-popover trigger="click" placement="bottom" color="black" v-model:visible="hmsVisible[dock.sn]"
+                          @visibleChange="readHms(hmsVisible[dock.sn], dock.sn)"
+                          :overlayStyle="{ width: '200px', height: '300px' }">
                           <div :class="hmsInfo[dock.sn][0].level === EHmsLevel.CAUTION ? 'caution' :
                             hmsInfo[dock.sn][0].level === EHmsLevel.WARN ? 'warn' : 'notice'"
-                               style="margin-left: 3px; width: 107px; height: 16px;">
+                            style="margin-left: 3px; width: 107px; height: 16px;">
                             <span class="word-loop">{{ hmsInfo[dock.sn][0].message_zh }}</span>
                           </div>
                           <template #content>
                             <a-collapse style="background: black; height: 300px; overflow-y: auto;" :bordered="false"
-                                        expand-icon-position="right" :accordion="true">
+                              expand-icon-position="right" :accordion="true">
                               <a-collapse-panel v-for="hms in hmsInfo[dock.sn]" :key="hms.hms_id" :showArrow="false"
-                                                style=" margin: 0 auto 3px auto; border: 0; width: 140px; border-radius: 3px"
-                                                :class="hms.level === EHmsLevel.CAUTION ? 'caution' : hms.level === EHmsLevel.WARN ? 'warn' : 'notice'">
+                                style=" margin: 0 auto 3px auto; border: 0; width: 140px; border-radius: 3px"
+                                :class="hms.level === EHmsLevel.CAUTION ? 'caution' : hms.level === EHmsLevel.WARN ? 'warn' : 'notice'">
                                 <template #header="{ isActive }">
                                   <div class="flex-row flex-align-center" style="width: 130px;">
                                     <div style="width: 110px;">
                                       <span class="word-loop">{{ hms.message_zh }}</span>
                                     </div>
                                     <div style="width: 20px; height: 15px; font-size: 10px; z-index: 2 "
-                                         class="flex-row flex-align-center flex-justify-center"
-                                         :class="hms.level === EHmsLevel.CAUTION ? 'caution' : hms.level === EHmsLevel.WARN ? 'warn' : 'notice'">
-                                      <DoubleRightOutlined :rotate="isActive ? 90 : 0"/>
+                                      class="flex-row flex-align-center flex-justify-center"
+                                      :class="hms.level === EHmsLevel.CAUTION ? 'caution' : hms.level === EHmsLevel.WARN ? 'warn' : 'notice'">
+                                      <DoubleRightOutlined :rotate="isActive ? 90 : 0" />
                                     </div>
                                   </div>
                                 </template>
@@ -161,14 +177,14 @@
                   </div>
                 </div>
                 <div style="float: right; background: #595959; height: 100%; width: 40px;"
-                     class="flex-row flex-justify-center flex-align-center">
+                  class="flex-row flex-justify-center flex-align-center">
                   <div class="fz16"
-                       @click="switchVisible($event, dock, true, dockInfo[dock.gateway.sn] && dockInfo[dock.gateway.sn].basic_osd?.mode_code !== EDockModeCode.Disconnected, dock.gateway.sn)">
+                    @click="switchVisible($event, dock, true, dockInfo[dock.gateway.sn] && dockInfo[dock.gateway.sn].basic_osd?.mode_code !== EDockModeCode.Disconnected, dock.gateway.sn)">
                     <a v-if="osdVisible.gateway_sn === dock.gateway.sn && osdVisible.visible">
-                      <EyeOutlined/>
+                      <EyeOutlined />
                     </a>
                     <a v-else>
-                      <EyeInvisibleOutlined/>
+                      <EyeInvisibleOutlined />
                     </a>
                   </div>
                 </div>
@@ -182,58 +198,56 @@
       <a-collapse :bordered="false" expandIconPosition="right" accordion style="background: #232323;">
         <a-collapse-panel :key="EDeviceTypeName.Aircraft" header="在线设备" style="border-bottom: 1px solid #4f4f4f;">
           <div v-if="onlineDevices.data.length === 0" style="height: 150px; color: white;">
-            <a-empty :image="simpleImage" style="color: #fff;" description="暂无数据"
-                     :image-style="{ height: '60px' }"/>
+            <a-empty :image="simpleImage" style="color: #fff;" description="暂无数据" :image-style="{ height: '60px' }" />
           </div>
           <div v-else class="fz12" style="color: white;">
             <div v-for="device in onlineDevices.data" :key="device.sn"
-                 style="background: #3c3c3c; height: 90px; margin-bottom: 10px;">
+              style="background: #3c3c3c; height: 90px; margin-bottom: 10px;">
               <div class="battery-slide" v-if="deviceInfo[device.sn]">
                 <div style="background: #535759; width: 100%;"></div>
                 <div class="capacity-percent" :style="{ width: deviceInfo[device.sn].battery.capacity_percent + '%' }">
                 </div>
-                <div class="return-home"
-                     :style="{ width: deviceInfo[device.sn].battery.return_home_power + '%' }"></div>
+                <div class="return-home" :style="{ width: deviceInfo[device.sn].battery.return_home_power + '%' }"></div>
                 <div class="landing" :style="{ width: deviceInfo[device.sn].battery.landing_power + '%' }"></div>
                 <div class="battery" :style="{ left: deviceInfo[device.sn].battery.capacity_percent + '%' }"></div>
               </div>
               <div style="border-bottom: 1px solid #515151; border-radius: 2px; height: 50px; width: 100%;"
-                   class="flex-row flex-justify-between flex-align-center">
+                class="flex-row flex-justify-between flex-align-center">
                 <div style="float: left; padding: 5px 5px 8px 8px; width: 88%">
                   <div style="width: 100%; height: 100%;">
                     <a-tooltip>
                       <template #title>{{
-                          device.model ? `${device.model} - ${device.callsign}` : 'No Drone'
-                        }}
+                        device.model ? `${device.model} - ${device.callsign}` : 'No Drone'
+                      }}
                       </template>
                       <span class="text-hidden" style="max-width: 200px; display: block; height: 20px;">{{
-                          device.model ?
-                              `${device.model} - ${device.callsign}` : 'No Drone'
-                        }}</span>
+                        device.model ?
+                        `${device.model} - ${device.callsign}` : 'No Drone'
+                      }}</span>
                     </a-tooltip>
                   </div>
                   <div class="mt5" style="background: #595959;">
                     <span class="ml5 mr5">
-                      <RocketOutlined/>
+                      <RocketOutlined />
                     </span>
                     <span class="font-bold"
-                          :style="deviceInfo[device.sn] && deviceInfo[device.sn].mode_code !== EModeCode.Disconnected ? 'color: #00ee8b' : 'color: red;'">
+                      :style="deviceInfo[device.sn] && deviceInfo[device.sn].mode_code !== EModeCode.Disconnected ? 'color: #00ee8b' : 'color: red;'">
                       {{
                         deviceInfo[device.sn] ? EModeCode[deviceInfo[device.sn].mode_code] :
-                            EModeCode[EModeCode.Disconnected]
+                        EModeCode[EModeCode.Disconnected]
                       }}
                     </span>
                   </div>
                 </div>
                 <div style="float: right; background: #595959; height: 50px; width: 40px;"
-                     class="flex-row flex-justify-center flex-align-center">
+                  class="flex-row flex-justify-center flex-align-center">
                   <div class="fz16"
-                       @click="switchVisible($event, device, false, deviceInfo[device.sn] && deviceInfo[device.sn].mode_code !== EModeCode.Disconnected)">
+                    @click="switchVisible($event, device, false, deviceInfo[device.sn] && deviceInfo[device.sn].mode_code !== EModeCode.Disconnected)">
                     <a v-if="osdVisible.sn === device.sn && osdVisible.visible">
-                      <EyeOutlined/>
+                      <EyeOutlined />
                     </a>
                     <a v-else>
-                      <EyeInvisibleOutlined/>
+                      <EyeInvisibleOutlined />
                     </a>
                   </div>
                 </div>
@@ -241,12 +255,12 @@
               <div class="flex-row flex-justify-center flex-align-center" style="height: 40px;">
                 <div class="flex-row" style="height: 20px; background: #595959; width: 94%;">
                   <span class="mr5"><a-image style="margin-left: 2px; margin-top: -2px; height: 20px; width: 20px;"
-                                             :src="rc"/></span>
+                      :src="rc" /></span>
                   <a-tooltip>
                     <template #title>{{ device.gateway.model }} - {{ device.gateway.callsign }}</template>
                     <div class="text-hidden" style="max-width: 200px;">{{ device.gateway.model }} - {{
-                        device.gateway.callsign
-                      }}
+                      device.gateway.callsign
+                    }}
                     </div>
                   </a-tooltip>
                 </div>
@@ -255,17 +269,14 @@
           </div>
         </a-collapse-panel>
       </a-collapse>
-
-      <!-- 测试视频播放组件 -->
-      <!-- <JessibucaVideo videoUrl="https://www.ainfo.top:700/rtp/34020000001110000101_34020000001310000001.flv" /> -->
     </div>
   </div>
 </template>
 
 <script lang="ts" setup>
+import * as Cesium from 'cesium'
 import { computed, onMounted, reactive, ref, watch, WritableComputedRef } from 'vue'
 import { EDeviceTypeName, ELocalStorageKey } from '/@/types'
-import noData from '/@/assets/icons/no-data.png'
 import rc from '/@/assets/icons/rc.png'
 import { OnlineDevice, EModeCode, OSDVisible, EDockModeCode, DeviceOsd, EDockModeText, EModeText } from '/@/types/device'
 import { useMyStore } from '/@/store'
@@ -275,10 +286,13 @@
   EyeInvisibleOutlined,
   EyeOutlined,
   RobotOutlined,
-  DoubleRightOutlined
+  DoubleRightOutlined,
+  ContainerOutlined,
 } from '@ant-design/icons-vue'
 import { EHmsLevel } from '/@/types/enums'
 import { cesiumOperation } from '/@/hooks/use-cesium-tsa'
+import { convertTimestampToDate, getDateFromTimestamp, isToday, setTodayTime } from '/@/utils/time'
+let droneEntity: any
 
 const { appContext } = getCurrentInstance()
 const global = appContext.config.globalProperties
@@ -292,11 +306,14 @@
 const onlineDevices = reactive({
   data: [] as OnlineDevice[]
 })
-
+// 机场序列号
+const dock = ref('')
+// 无人机序列号
+const device_dock = ref('')
 const onlineDocks = reactive({
   data: [] as OnlineDevice[]
 })
-
+const previousPositions = ref([])
 const deviceInfo = computed(() => store.state.deviceState.deviceInfo)
 const dockInfo = computed(() => store.state.deviceState.dockInfo)
 const projectName = computed(() => store.state.common.projectName)
@@ -320,33 +337,73 @@
 const getResource = (name: string) => {
   return new URL(`/src/assets/icons/${name}`, import.meta.url).href
 }
+
 // 获取ws连接过来的sn设备号
 const snCode = ref<string[]>([])
 const cesium = cesiumOperation()
 // 添加机场标注
-watch(() => store.state.deviceState, data => {
-  if (snCode.value.includes(data.currentSn)) return
-  snCode.value.push(data.currentSn)
+watch(() => store.state.deviceState, (data, oldData) => {
   // cesium.removeAllPoint()
   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.removeById('drone_fly')
+    if (!droneEntity) {
+      droneEntity = cesium.getEntityById('drone_fly')
     }
-    cesium.addPoint(setting)
-    // if (osdVisible.value.visible && osdVisible.value.sn !== '') {
-    //   deviceInfo.value.device = data.deviceInfo[osdVisible.value.sn]
-    // }
+    if (droneEntity) {
+      const orientation = {
+        heading: data.deviceInfo[data.currentSn].attitude_head,
+      }
+      cesium.updateEntityPosition(data.deviceInfo[data.currentSn].longitude, data.deviceInfo[data.currentSn].latitude, 'drone_fly', orientation)
+    } else {
+      // 无人机图标
+      const setting = {
+        longitude: data.deviceInfo[data.currentSn].longitude,
+        latitude: data.deviceInfo[data.currentSn].latitude,
+        id: 'drone_fly',
+        billboard: {
+          image: getResource('drone.png'),
+          outlineWidth: 0,
+          width: 36,
+          height: 36,
+          scale: 1.0,
+          rotation: 0.0
+        },
+        heading: data.deviceInfo[data.currentSn].attitude_head,
+      }
+      cesium.addPoint(setting)
+      // 无人机路线轨迹
+      const routeTrajectory = {
+        longitude: 115.85666327144976,
+        latitude: 28.62452712442823,
+        id: 'drone_route',
+        polyline: {
+          width: 5,
+          positions: previousPositions.value,
+          material: Cesium.Color.BLUE
+        },
+      }
+      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 || data.deviceInfo[data.currentSn].mode_code == 9)) {
+      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
+    snCode.value.push(data.currentSn)
     // 机场图标位置
     const setting = {
       longitude: data.dockInfo[data.currentSn].basic_osd?.longitude,
@@ -373,6 +430,12 @@
     Promise.resolve(false)
   }
 }
+// 判断给定日期是否晚于当前时间
+const isDateLaterThanNow = (dateObj:any) => {
+  const todayTimestamp = setTodayTime(dateObj)
+  return todayTimestamp > Date.now()
+}
+
 onMounted(() => {
   getOnlineTopo()
   setTimeout(() => {
@@ -392,6 +455,7 @@
   const element = document.getElementsByClassName('scrollbar').item(0) as HTMLDivElement
   const parent = element?.parentNode as HTMLDivElement
   scorllHeight.value = parent?.clientHeight - parent?.firstElementChild?.clientHeight
+  previousPositions.value = []
 })
 
 function getOnlineTopo () {
@@ -404,16 +468,26 @@
     onlineDocks.data = []
     res.data.forEach((gateway: any) => {
       const child = gateway.children
+      if (gateway.latest_wayline_job) {
+        const isLater = isToday(gateway.latest_wayline_job.begin_time)
+        // false 代表任务开始时间大于今天  true为任务开始时间为今天
+        gateway.latest_wayline_job.is_later = isLater
+      }
+
       const device: OnlineDevice = {
         model: child?.device_name,
         callsign: child?.nickname,
         sn: child?.device_sn,
         mode: EModeCode.Disconnected,
+        latest_wayline_job: gateway.latest_wayline_job,
         gateway: {
           model: gateway?.device_name,
           callsign: gateway?.nickname,
           sn: gateway?.device_sn,
-          domain: gateway?.domain
+          domain: gateway?.domain,
+          device_domain: child.domain,
+          device_type: child.type,
+          device_sub_type: child.sub_type
         },
         payload: []
       }
@@ -443,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
@@ -459,8 +535,11 @@
     osdVisible.value.is_dock = isDock
     osdVisible.value.gateway_callsign = device.gateway.callsign
     osdVisible.value.payloads = device.payload
+    osdVisible.value.device_domain = device.gateway.device_domain
+    osdVisible.value.device_sub_type = device.gateway.device_sub_type
+    osdVisible.value.device_type = device.gateway.device_type
+    osdVisible.value.latest_wayline_job = device.latest_wayline_job
   }
-  console.log(osdVisible.value, 'value')
   store.commit('SET_OSD_VISIBLE_INFO', osdVisible.value)
   store.commit('SET_HMSInfo_DetailSn', sn)
 }
@@ -502,7 +581,7 @@
 </script>
 
 <style lang="scss">
-.project-tsa-wrapper > :first-child {
+.project-tsa-wrapper> :first-child {
   height: 50px;
   line-height: 50px;
   align-items: center;
@@ -521,7 +600,7 @@
   }
 }
 
-.ant-collapse > .ant-collapse-item > .ant-collapse-header {
+.ant-collapse>.ant-collapse-item>.ant-collapse-header {
   color: white !important;
   border: 0;
   padding-left: 14px;
@@ -562,7 +641,7 @@
   }
 }
 
-.battery-slide > div {
+.battery-slide>div {
   position: relative;
   margin-top: -2px;
   min-height: 2px;
@@ -639,3 +718,21 @@
   }
 }
 </style>
+
+<style lang="scss" scoped>
+.task_wrapper {
+  display: flex;
+  align-items: center;
+  .task_content {
+    background-color: #41bbfa;
+    padding: 2px 4px;
+  }
+  .task_content_way {
+    background-color: #19be6b;
+  }
+  .task_title {
+    margin-left: 5px;
+    font-size: 14px;
+  }
+}
+</style>

--
Gitblit v1.9.3