From 53d866e1abbedb7476f5095129d1cfb8a4ae5d02 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Sat, 23 Sep 2023 17:34:51 +0800
Subject: [PATCH] close关闭弹窗

---
 src/components/GMap.vue             |    9 ++
 src/pages/page-web/projects/tsa.vue |  171 +++++++++++++++++++++++++++++++++++----------------------
 2 files changed, 113 insertions(+), 67 deletions(-)

diff --git a/src/components/GMap.vue b/src/components/GMap.vue
index 4477911..d494607 100644
--- a/src/components/GMap.vue
+++ b/src/components/GMap.vue
@@ -173,7 +173,7 @@
       <div class="fz16 pl5 pr5 flex-align-center flex-row flex-justify-between"
         style="border-bottom: 1px solid #515151; height: 10%;">
         <span>{{ osdVisible.gateway_callsign }}</span>
-        <span><a style="color: white;" @click="() => osdVisible.visible = false">
+        <span><a style="color: white;" @click="closeOsdWindow">
             <CloseOutlined />
           </a></span>
       </div>
@@ -787,6 +787,12 @@
         return val
       }
     })
+
+    // 关闭窗口
+    const closeOsdWindow = () => {
+      store.commit('SET_OSD_VISIBLE_INFO', false)
+    }
+
     // 打开监控权限
     const openMonitor = () => {
       showMonitor.value = !showMonitor.value
@@ -1288,6 +1294,7 @@
       aircraSelected,
       selectChange,
       closeOperate,
+      closeOsdWindow
     }
   }
 })
diff --git a/src/pages/page-web/projects/tsa.vue b/src/pages/page-web/projects/tsa.vue
index 15740ef..0a654a0 100644
--- a/src/pages/page-web/projects/tsa.vue
+++ b/src/pages/page-web/projects/tsa.vue
@@ -13,67 +13,74 @@
       <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;">
+                 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">
+                   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' }}</div>
+                      <div class="text-hidden" style="max-width: 200px;">{{ dock.gateway.callsign }} - {{
+                          dock.callsign ??
+                          'No Drone'
+                        }}
+                      </div>
                     </a-tooltip>
                   </div>
                   <!-- // 机场设备状态 -->
                   <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;'">
-                        {{ dockInfo[dock.gateway.sn] ? EDockModeText[dockInfo[dock.gateway.sn].basic_osd?.mode_code] :
-                          EDockModeText[EDockModeCode.Disconnected] }}
+                           :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]
+                        }}
                       </div>
                     </div>
                     <div class="mr5 flex-align-center flex-row" style="width: 85px; margin-right: 0; height: 18px;">
                       <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: 62px; height: 16px;">
+                               style="margin-left: 3px; width: 62px; 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>
@@ -93,46 +100,50 @@
                   <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;'">
-                        {{ deviceInfo[dock.sn] ? EModeText[deviceInfo[dock.sn].mode_code] :
-                          EModeText[EModeCode.Disconnected] }}
+                           :style="deviceInfo[dock.sn] && deviceInfo[dock.sn].mode_code !== EModeCode.Disconnected ? 'color: #00ee8b' : 'color: red;'">
+                        {{
+                          deviceInfo[dock.sn] ? EModeText[deviceInfo[dock.sn].mode_code] :
+                              EModeText[EModeCode.Disconnected]
+                        }}
                       </div>
                     </div>
                     <div class="mr5 flex-align-center flex-row" style="width: 85px; margin-right: 0; height: 18px;">
                       <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: 62px; height: 16px;">
+                               style="margin-left: 3px; width: 62px; 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>
@@ -150,14 +161,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>
@@ -171,49 +182,58 @@
       <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' }}</template>
-                      <span class="text-hidden" style="max-width: 200px; display: block; height: 20px;">{{ device.model ?
-                        `${device.model} - ${device.callsign}` : 'No Drone' }}</span>
+                      <template #title>{{
+                          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>
                     </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;'">
-                      {{ deviceInfo[device.sn] ? EModeCode[deviceInfo[device.sn].mode_code] :
-                        EModeCode[EModeCode.Disconnected] }}
+                          :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]
+                      }}
                     </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>
@@ -221,11 +241,13 @@
               <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>
+                    <template #title>{{ device.gateway.model }} - {{ device.gateway.callsign }}</template>
                     <div class="text-hidden" style="max-width: 200px;">{{ device.gateway.model }} - {{
-                      device.gateway.callsign }}</div>
+                        device.gateway.callsign
+                      }}
+                    </div>
                   </a-tooltip>
                 </div>
               </div>
@@ -234,8 +256,8 @@
         </a-collapse-panel>
       </a-collapse>
 
-       <!-- 测试视频播放组件 -->
-    <!-- <JessibucaVideo videoUrl="https://www.ainfo.top:700/rtp/34020000001110000101_34020000001310000001.flv" /> -->
+      <!-- 测试视频播放组件 -->
+      <!-- <JessibucaVideo videoUrl="https://www.ainfo.top:700/rtp/34020000001110000101_34020000001310000001.flv" /> -->
     </div>
   </div>
 </template>
@@ -248,9 +270,16 @@
 import { OnlineDevice, EModeCode, OSDVisible, EDockModeCode, DeviceOsd, EDockModeText, EModeText } from '/@/types/device'
 import { useMyStore } from '/@/store'
 import { getDeviceTopo, getUnreadDeviceHms, updateDeviceHms, testBind } from '/@/api/manage'
-import { RocketOutlined, EyeInvisibleOutlined, EyeOutlined, RobotOutlined, DoubleRightOutlined } from '@ant-design/icons-vue'
+import {
+  RocketOutlined,
+  EyeInvisibleOutlined,
+  EyeOutlined,
+  RobotOutlined,
+  DoubleRightOutlined
+} from '@ant-design/icons-vue'
 import { EHmsLevel } from '/@/types/enums'
 import { cesiumOperation } from '/@/hooks/use-cesium-tsa'
+
 const { appContext } = getCurrentInstance()
 const global = appContext.config.globalProperties
 const route = useRoute()
@@ -278,6 +307,16 @@
     return val
   }
 })
+
+watch(
+  () => store.state.osdVisible.visible,
+  (newVal, oldVal) => {
+    osdVisible.value.visible = newVal
+  },
+  {
+    deep: true,
+  })
+
 const getResource = (name: string) => {
   return new URL(`/src/assets/icons/${name}`, import.meta.url).href
 }
@@ -463,7 +502,7 @@
 </script>
 
 <style lang="scss">
-.project-tsa-wrapper> :first-child {
+.project-tsa-wrapper > :first-child {
   height: 50px;
   line-height: 50px;
   align-items: center;
@@ -482,7 +521,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;
@@ -523,7 +562,7 @@
   }
 }
 
-.battery-slide>div {
+.battery-slide > div {
   position: relative;
   margin-top: -2px;
   min-height: 2px;

--
Gitblit v1.9.3