37781216b2
- 优化 `车站-设备-告警` 轮询机制 - 改进设备卡片的布局 - 支持修改设备 - 告警轮询中获取完整告警数据 - 车站告警详情支持导出完整的 `今日告警列表` - 支持将状态持久化到 `IndexedDB` - 新增轮询控制 (调试模式) - 新增离线开发模式 (调试模式) - 新增 `IndexedDB` 数据控制 (调试模式)
48 lines
1.5 KiB
Vue
48 lines
1.5 KiB
Vue
<script setup lang="ts">
|
|
import type { NdmDecoderDiagInfo, NdmDecoderResultVO, Station } from '@/apis';
|
|
import { DeviceCommonCard, DeviceHardwareCard, DeviceHeaderCard } 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(() => {
|
|
const { stCommonInfo } = lastDiagInfo.value ?? {};
|
|
const { 设备ID, 软件版本, 设备厂商, 设备别名, 设备型号, 硬件版本 } = stCommonInfo ?? {};
|
|
return {
|
|
设备ID: 设备ID ?? '-',
|
|
软件版本: 软件版本 ?? '-',
|
|
设备厂商: 设备厂商 ?? '-',
|
|
设备别名: 设备别名 ?? '-',
|
|
设备型号: 设备型号 ?? '-',
|
|
硬件版本: 硬件版本 ?? '-',
|
|
};
|
|
});
|
|
|
|
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>
|