Files
ndm-web-platform/src/components/device/device-card/ndm-switch/switch-current-diag.vue
yangsy fd7f1927ff feat: 设备关联与解除关联
- 支持配置交换机端口的下游关联设备
- 支持配置安防箱电路的下游关联设备
- 支持解除关联
- 删除设备时校验是否存在上/下游设备
2025-12-26 18:14:54 +08:00

37 lines
1.1 KiB
Vue

<script setup lang="ts">
import type { NdmSwitchDiagInfo, NdmSwitchResultVO, Station } from '@/apis';
import { DeviceHardwareCard, DeviceHeaderCard, SwitchPortCard } from '@/components';
import destr from 'destr';
import { NFlex } from 'naive-ui';
import { computed, toRefs } from 'vue';
const props = defineProps<{
ndmDevice: NdmSwitchResultVO;
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 NdmSwitchDiagInfo;
});
const cpuUsage = computed(() => lastDiagInfo.value?.cpuRatio);
const memUsage = computed(() => lastDiagInfo.value?.memoryRatio);
const ports = computed(() => lastDiagInfo.value?.info?.portInfoList);
</script>
<template>
<NFlex vertical>
<DeviceHeaderCard :ndm-device="ndmDevice" :station="station" />
<DeviceHardwareCard :cpu-usage="cpuUsage" :mem-usage="memUsage" />
<SwitchPortCard :ndm-device="ndmDevice" :station="station" :ports="ports" />
</NFlex>
</template>
<style scoped lang="scss"></style>