b8ef57e417
重构报警主机、解码器、录像机、安防箱的设备诊断页通用信息展示逻辑,适配组件新的props格式。完善摄像头诊断相关的接口类型定义,为摄像头诊断页新增硬件使用率展示卡片,补充完整的设备基础信息和网络信息内容
54 lines
1.8 KiB
Vue
54 lines
1.8 KiB
Vue
<script setup lang="ts">
|
|
import type { NdmDecoderDiagInfo, NdmDecoderResultVO, Station } from '@/apis';
|
|
import { DeviceCommonCard, DeviceHardwareCard, DeviceHeaderCard, type DeviceCommonCardProps } from '@/components';
|
|
import destr from 'destr';
|
|
import { NFlex } from 'naive-ui';
|
|
import { computed, toRefs } from 'vue';
|
|
|
|
const props = defineProps<{
|
|
ndmDevice: NdmDecoderResultVO;
|
|
station: Station;
|
|
}>();
|
|
|
|
const { ndmDevice, station } = toRefs(props);
|
|
|
|
const lastDiagInfo = computed(() => {
|
|
const result = destr<any>(ndmDevice.value.lastDiagInfo);
|
|
if (!result) return null;
|
|
if (typeof result !== 'object') return null;
|
|
return result as NdmDecoderDiagInfo;
|
|
});
|
|
|
|
const commonInfo = computed<DeviceCommonCardProps['commonInfo']>(() => {
|
|
const { stCommonInfo } = lastDiagInfo.value ?? {};
|
|
const { 设备ID, 软件版本, 设备厂商, 设备别名, 设备型号, 硬件版本 } = stCommonInfo ?? {};
|
|
|
|
return [
|
|
{
|
|
title: '设备型号信息',
|
|
items: [
|
|
{ label: '设备ID', value: 设备ID || '-' },
|
|
{ label: '软件版本', value: 软件版本 || '-' },
|
|
{ label: '设备厂商', value: 设备厂商 || '-' },
|
|
{ label: '设备别名', value: 设备别名 || '-' },
|
|
{ label: '设备型号', value: 设备型号 || '-' },
|
|
{ label: '硬件版本', value: 硬件版本 || '-' },
|
|
],
|
|
},
|
|
];
|
|
});
|
|
|
|
const cpuUsage = computed(() => lastDiagInfo.value?.stCommonInfo?.CPU使用率);
|
|
const memUsage = computed(() => lastDiagInfo.value?.stCommonInfo?.内存使用率);
|
|
</script>
|
|
|
|
<template>
|
|
<NFlex vertical>
|
|
<DeviceHeaderCard :ndm-device="ndmDevice" :station="station" />
|
|
<DeviceCommonCard :common-info="commonInfo" />
|
|
<DeviceHardwareCard :cpu-usage="cpuUsage" :mem-usage="memUsage" />
|
|
</NFlex>
|
|
</template>
|
|
|
|
<style scoped lang="scss"></style>
|