| | |
| | | <div> |
| | | <a-row> |
| | | <a-col :span="1"></a-col> |
| | | <a-col :span="11">My Username</a-col> |
| | | <a-col :span="11">我的项目呼号</a-col> |
| | | <a-col :span="11" align="right" style="font-weight: 700">{{ username }}</a-col> |
| | | <a-col :span="1"></a-col> |
| | | </a-row> |
| | | </div> |
| | | <div class="scrollbar" :style="{ height: scorllHeight + 'px'}"> |
| | | <a-collapse :bordered="false" expandIconPosition="right" accordion style="background: #232323;"> |
| | | <a-collapse-panel :key="EDeviceTypeName.Dock" header="Dock" style="border-bottom: 1px solid #4f4f4f;"> |
| | | <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 :image="noData" :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; width: 250px; margin-bottom: 10px;"> |
| | | <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"> |
| | | <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'}`"> |
| | | <span class="text-hidden" style="max-width: 200px;">{{ dock.gateway.callsign }} - {{ dock.callsign ?? 'No Drone' }}</span> |
| | | <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 /></span> |
| | | <span 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;'"> |
| | | 132 |
| | | <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] ? EDockModeCode[dockInfo[dock.gateway.sn].basic_osd?.mode_code] : EDockModeCode[EDockModeCode.Disconnected] }} |
| | | </span> |
| | | </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> |
| | | </div> |
| | | <div class="mt5 flex-align-center flex-row flex-justify-between" style="background: #595959;"> |
| | | <div> |
| | | <div class="flex-row"> |
| | | <span class="ml5 mr5"><RocketOutlined /></span> |
| | | <span class="font-bold" :style="deviceInfo[dock.sn] && deviceInfo[dock.sn].mode_code !== EModeCode.Disconnected ? 'color: #00ee8b' : 'color: red;'"> |
| | | <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] ? EModeCode[deviceInfo[dock.sn].mode_code] : EModeCode[EModeCode.Disconnected] }} |
| | | </span> |
| | | </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"> |
| | |
| | | </a-collapse-panel> |
| | | </a-collapse> |
| | | <a-collapse :bordered="false" expandIconPosition="right" accordion style="background: #232323;"> |
| | | <a-collapse-panel :key="EDeviceTypeName.Aircraft" header="Online Devices" style="border-bottom: 1px solid #4f4f4f;"> |
| | | <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="noData" :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; width: 250px; margin-bottom: 10px;"> |
| | | <div v-for="device in onlineDevices.data" :key="device.sn" 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> |
| | | </div> |
| | | <div class="flex-row flex-justify-center flex-align-center" style="height: 40px;"> |
| | | <div style="height: 20px; background: #595959; width: 94%;" > |
| | | <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> |
| | | <a-tooltip> |
| | | <template #title>{{ device.gateway.model }} - {{ device.gateway.callsign }} </template> |
| | | <span class="text-hidden" style="max-width: 200px;">{{ device.gateway.model }} - {{ device.gateway.callsign }}</span> |
| | | <div class="text-hidden" style="max-width: 200px;">{{ device.gateway.model }} - {{ device.gateway.callsign }}</div> |
| | | </a-tooltip> |
| | | </div> |
| | | </div> |
| | |
| | | </a-collapse-panel> |
| | | </a-collapse> |
| | | </div> |
| | | <Drawer title="项目设置" :styleDrawer="styleDrawer" v-model:show="showDrawer"> |
| | | <DockConfig /> |
| | | </Drawer> |
| | | </div> |
| | | </template> |
| | | |
| | | <script lang="ts" setup> |
| | | import { styleDrawer } from './common/common' |
| | | import { computed, onMounted, reactive, ref, watch, WritableComputedRef } from 'vue' |
| | | import { EDeviceTypeName, ELocalStorageKey } from '/@/types' |
| | | import Drawer from '/@/components/Drawer/Drawer.vue' |
| | | import noData from '/@/assets/icons/no-data.png' |
| | | import { Empty } from 'ant-design-vue' |
| | | import rc from '/@/assets/icons/rc.png' |
| | | import { DeviceStatus, EModeCode, OSDVisible, EDockModeCode, DeviceOsd } from '/@/types/device' |
| | | import { OnlineDevice, EModeCode, OSDVisible, EDockModeCode, DeviceOsd } from '/@/types/device' |
| | | import { useMyStore } from '/@/store' |
| | | import { getDeviceTopo, getUnreadDeviceHms, updateDeviceHms } from '/@/api/manage' |
| | | import { message } from 'ant-design-vue' |
| | | import { RocketOutlined, EyeInvisibleOutlined, EyeOutlined, RobotOutlined, DoubleRightOutlined } from '@ant-design/icons-vue' |
| | | import { EHmsLevel } from '/@/types/enums' |
| | | |
| | | import { UranusMqtt } from '/@/mqtt/index' |
| | | import DockConfig from './components/DockConfig.vue' |
| | | const { appContext } = getCurrentInstance() |
| | | const global = appContext.config.globalProperties |
| | | const simpleImage = Empty.PRESENTED_IMAGE_SIMPLE |
| | | const store = useMyStore() |
| | | const username = ref(localStorage.getItem(ELocalStorageKey.Username)) |
| | | const workspaceId = ref(localStorage.getItem(ELocalStorageKey.WorkspaceId)!) |
| | | const osdVisible = ref({} as OSDVisible) |
| | | const hmsVisible = new Map<string, boolean>() |
| | | const scorllHeight = ref() |
| | | |
| | | interface OnlineDevice { |
| | | model: string, |
| | | callsign: string, |
| | | sn: string, |
| | | mode: number, |
| | | gateway: { |
| | | model: string, |
| | | callsign: string, |
| | | sn: string, |
| | | domain: string, |
| | | }, |
| | | payload: { |
| | | model: string |
| | | }[] |
| | | } |
| | | |
| | | const showDrawer = ref(false) |
| | | const onlineDevices = reactive({ |
| | | data: [] as OnlineDevice[] |
| | | }) |
| | | |
| | | const onlineDocks = reactive({ |
| | | data: [] as OnlineDevice[] |
| | | data: [ |
| | | { |
| | | model: '我是model字段', |
| | | callsign: '我是callsign字段', |
| | | sn: '我是sn字段', |
| | | mode: '我是mode字段', |
| | | gateway: { |
| | | model: 'gateway.model', |
| | | callsign: 'gateway.callsign', |
| | | sn: '我是gateway.sn字段', |
| | | mode: '我是gateway.mode字段', |
| | | }, |
| | | payload: [ |
| | | { |
| | | index: 1, |
| | | model: '2', |
| | | control_source: 'A', |
| | | payload_sn: 'payload_sn', |
| | | payload_index: 'payload_index', |
| | | payload_name: 'payload_name', |
| | | }, |
| | | ] |
| | | }, |
| | | ] as unknown as OnlineDevice[] |
| | | }) |
| | | |
| | | const deviceInfo = computed(() => store.state.deviceState.deviceInfo) |
| | |
| | | }) |
| | | |
| | | onMounted(() => { |
| | | console.log(global, 'global') |
| | | // const mqtt = new UranusMqtt('ws://192.168.1.198:8083/mqtt', {}) |
| | | // mqtt.initMqtt() |
| | | getOnlineTopo() |
| | | setTimeout(() => { |
| | | watch(() => store.state.deviceStatusEvent, |
| | |
| | | } |
| | | child?.payloads_list.forEach((payload: any) => { |
| | | device.payload.push({ |
| | | model: payload.payload_name |
| | | index: payload.index, |
| | | model: payload.model, |
| | | payload_name: payload.payload_name, |
| | | payload_sn: payload.payload_sn, |
| | | control_source: payload.control_source, |
| | | payload_index: payload.payload_index |
| | | }) |
| | | }) |
| | | if (EDeviceTypeName.Dock === gateway.domain) { |
| | |
| | | } |
| | | |
| | | function switchVisible (e: any, device: OnlineDevice, isDock: boolean, isClick: boolean) { |
| | | 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 |
| | | } |
| | | store.commit('SET_OSD_VISIBLE_INFO', osdVisible) |
| | | 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) |
| | | } |
| | | |
| | | function getUnreadHms (sn: string) { |