diff --git a/src/components/device-page/device-card/current-diag-card/switch-port-card.vue b/src/components/device-page/device-card/current-diag-card/switch-port-card.vue
index d584963..d53b50f 100644
--- a/src/components/device-page/device-card/current-diag-card/switch-port-card.vue
+++ b/src/components/device-page/device-card/current-diag-card/switch-port-card.vue
@@ -15,7 +15,7 @@
* - 响应式数据处理和布局
*/
-import { transformPortSpeed } from '../../helper';
+import { getPortStatusVal, transformPortSpeed } from '../../helper';
import type { NdmSwitchPortInfo } from '@/apis/domains';
import { NCard, NGrid, NGridItem, NPopover } from 'naive-ui';
import { computed, toRefs } from 'vue';
@@ -240,9 +240,7 @@ const getPortStatusClass = (port: NdmSwitchPortInfo) => {
状态:
-
- {{ port.upDown === 1 ? '启用' : port.upDown === 2 ? '禁用' : '未知' }}
-
+ {{ getPortStatusVal(port) }}
上行速率:
diff --git a/src/components/device-page/helper.ts b/src/components/device-page/helper.ts
index 439bdcc..0b2e4a8 100644
--- a/src/components/device-page/helper.ts
+++ b/src/components/device-page/helper.ts
@@ -1,6 +1,11 @@
import type { NdmSwitchPortInfo } from '@/apis/domains';
import { JAVA_UNSIGNED_INTEGER_MAX_VALUE, NDM_SWITCH_PROBE_INTERVAL } from '@/constants';
+export const getPortStatusVal = (portInfo: NdmSwitchPortInfo): string => {
+ const { upDown } = portInfo;
+ return upDown === 1 ? '启用' : upDown === 2 ? '禁用' : '未知';
+};
+
export const transformPortSpeed = (portInfo: NdmSwitchPortInfo, type: 'in' | 'out' | 'total'): string => {
const units = ['B/s', 'KB/s', 'MB/s', 'GB/s', 'TB/s'];
const { inBytes, lastInBytes, outBytes, lastOutBytes, inFlow, outFlow, flow } = portInfo;