guoshilong
2023-10-18 53bcb7e5dffa071d2c6593f5db7f0b6e4e2f8dfe
src/pages/page-web/projects/tsa.vue
@@ -96,6 +96,7 @@
                      <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">
@@ -103,10 +104,10 @@
                        <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>
@@ -265,7 +266,6 @@
<script lang="ts" setup>
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'
@@ -279,6 +279,7 @@
} from '@ant-design/icons-vue'
import { EHmsLevel } from '/@/types/enums'
import { cesiumOperation } from '/@/hooks/use-cesium-tsa'
let droneEntity
const { appContext } = getCurrentInstance()
const global = appContext.config.globalProperties
@@ -325,28 +326,42 @@
const cesium = cesiumOperation()
// 添加机场标注
watch(() => store.state.deviceState, data => {
  if (snCode.value.includes(data.currentSn)) return
  snCode.value.push(data.currentSn)
  // 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 (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)
    }
    // if (osdVisible.value.visible && osdVisible.value.sn !== '') {
    //   deviceInfo.value.device = data.deviceInfo[osdVisible.value.sn]
    // }
  }
  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,
@@ -413,7 +428,10 @@
          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: []
      }
@@ -459,8 +477,10 @@
    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
  }
  console.log(osdVisible.value, 'value')
  store.commit('SET_OSD_VISIBLE_INFO', osdVisible.value)
  store.commit('SET_HMSInfo_DetailSn', sn)
}