husq
2023-09-25 e06e048e3b6e61ca8d1a8f44b7728d3b4a9819d9
src/pages/page-web/projects/implement.vue
@@ -7,7 +7,6 @@
                <a-col :span="3"></a-col>
            </a-row>
        </div>
        <div>
            <div>
                <a-row style="padding: 15px 0">
@@ -16,17 +15,15 @@
                        当前设备
                    </a-col>
                </a-row>
                <a-row>
                    <a-col :span="1"></a-col>
                    <a-col :span="22">
                        <div v-if="onlineDocks.data.length === 0" style="height: 150px; color: white;">
                            <a-empty style="color: #fff;" :image="simpleImage" description="暂无数据"
                                :image-style="{ height: '60px' }" />
                        </div>
                        <div v-else class="fz12" style="color: white;">
                            <div @click="selectOnlineDock(dock)" v-for="dock in onlineDocks.data" :key="dock.sn"
                            <div v-for="dock in onlineDocks.data" :key="dock.sn"
                                :style="{ background: '#3c3c3c', 'margin-bottom': '10px' }">
                                <div style="border-radius: 2px; height: 60%; width: 100%;"
                                    class="flex-row flex-justify-between flex-align-center">
@@ -34,11 +31,7 @@
                                        <!-- // 机场设备标题 -->
                                        <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 class="text-hidden" style="max-width: 200px;">{{ dock.gateway.callsign}} - {{ dock.callsign ?? 'No Drone'}}
                                                </div>
                                            </a-tooltip>
                                        </div>
@@ -203,29 +196,20 @@
                    </a-col>
                </a-row>
            </div>
        </div>
    </div>
</template>
<script lang="ts" setup>
import {
  PlusOutlined,
  MinusOutlined,
  RocketOutlined,
  EyeInvisibleOutlined,
  EyeOutlined,
  RobotOutlined,
  DoubleRightOutlined,
  FileTextOutlined,
} from '@ant-design/icons-vue'
import { useRoute } from 'vue-router'
import { ERouterName, EHmsLevel } from '/@/types/enums'
import { computed, onMounted, reactive, ref, watch, WritableComputedRef } from 'vue'
import { EDeviceTypeName, ELocalStorageKey } from '/@/types'
import JessibucaVideo from '/@/components/Jessibuca/Jessibuca.vue'
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'
import { getDeviceTopo, getUnreadDeviceHms, updateDeviceHms } from '/@/api/manage'
@@ -254,19 +238,6 @@
const onlineDevices = reactive({
  data: [] as OnlineDevice[]
})
const historyCheckArr = reactive({
  data: [] as OnlineDevice[]
})
const historyDocks = reactive({
  data: [] as OnlineDevice[]
})
const osdVisible = ref({} as OSDVisible)
const onlineCheck = ref(false)
const historyCheck = ref(false)
watch(
  () => onlineCheckArr.data,
  (newVal) => {
@@ -298,58 +269,6 @@
  scorllHeight.value = parent?.clientHeight - parent?.firstElementChild?.clientHeight
})
// 在线设备全选
function onlineCheckBoxChange (item: any) {
  onlineDocks.data.forEach(e => {
    e.selected = !e.selected
  })
  if (item.target.checked) {
    onlineCheckArr.data = onlineDocks.data
  } else {
    onlineCheckArr.data = []
  }
}
function historyCheckBoxChange (item: any) {
  historyDocks.data.forEach(e => {
    e.selected = !e.selected
  })
  historyCheckArr.data = historyDocks.data
}
// 在线机场点击
function selectOnlineDock (item: OnlineDevice) {
  // 当前已被选中,排除
  if (item.selected) {
    onlineCheckArr.data = onlineCheckArr.data.filter(e => e.sn !== item.sn)
  } else {
    // 当前未被选中,push
    onlineCheckArr.data.push(item)
  }
  item.selected = !item.selected
  if (onlineCheckArr.data.length === onlineDocks.data.length) {
    onlineCheck.value = true
  } else {
    onlineCheck.value = false
  }
}
function selectHistoryDock (item: OnlineDevice) {
  // 当前已被选中,排除
  if (item.selected) {
    historyCheckArr.data = historyCheckArr.data.filter(e => e.sn !== item.sn)
  } else {
    // 当前未被选中,push
    historyCheckArr.data.push(item)
  }
  item.selected = !item.selected
  if (historyCheckArr.data.length === historyDocks.data.length) {
    historyCheck.value = true
  }
}
// 监听ws 消息
// useConnectWebSocket(messageHandler)
function getOnlineTopo () {
@@ -373,9 +292,6 @@
          domain: gateway?.domain
        },
        payload: [],
        // 是否选中
        selected: false
      }
      child?.payloads_list.forEach((payload: any) => {
        device.payload.push({
@@ -405,7 +321,6 @@
      hmsInfo.value[sn] = res.data
    }
  })
  console.info(hmsInfo.value)
}
function getOnlineDeviceHms () {
@@ -423,28 +338,6 @@
  deviceSnList.forEach(sn => {
    getUnreadHms(sn)
  })
}
function switchVisible (e: any, device: OnlineDevice, isDock: boolean, isClick: boolean, sn?: any) {
  // showDrawer.value = !showDrawer.value
  if (!isClick) {
    e.target.style.cursor = 'not-allowed'
    return
  }
  if (device.sn === osdVisible.value.sn) {
    osdVisible.value.visible = !osdVisible.value.visible
  } else {
    osdVisible.value.sn = device.sn
    osdVisible.value.callsign = device.callsign
    osdVisible.value.model = device.model
    osdVisible.value.visible = true
    osdVisible.value.gateway_sn = device.gateway.sn
    osdVisible.value.is_dock = isDock
    osdVisible.value.gateway_callsign = device.gateway.callsign
    osdVisible.value.payloads = device.payload
  }
  store.commit('SET_OSD_VISIBLE_INFO', osdVisible)
  store.commit('SET_HMSInfo_DetailSn', sn)
}
</script>