From ec77b28cf2ba681df217897dd62bf20da18720e1 Mon Sep 17 00:00:00 2001 From: yangsy Date: Wed, 20 May 2026 13:35:41 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=A1=AC=E4=BB=B6=E5=8D=A1=E7=89=87=E8=BF=9B=E5=BA=A6=E6=9D=A1?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=80=BC=E5=B9=B6=E5=AE=8C=E5=96=84=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=88=A4=E6=96=AD=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 新增进度百分比限制函数,修正0值进度的状态判断,调整模板变量判断条件 --- .../current-diag/device-hardware-card.vue | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/components/device/device-card/components/current-diag/device-hardware-card.vue b/src/components/device/device-card/components/current-diag/device-hardware-card.vue index ff5b38c..06db032 100644 --- a/src/components/device/device-card/components/current-diag/device-hardware-card.vue +++ b/src/components/device/device-card/components/current-diag/device-hardware-card.vue @@ -51,8 +51,13 @@ const formattedRunningTime = computed(() => { return (runningTime?.value ?? '-').replace('days', '天'); }); -const getProgressStatus = (percent?: number): ProgressStatus | undefined => { - if (!percent) return undefined; +const getProgressPercentage = (percent: number) => { + if (percent < 0) return 0; + if (percent > 100) return 100; + return percent; +}; + +const getProgressStatus = (percent: number): ProgressStatus => { if (percent >= 90) return 'error'; if (percent >= 70) return 'warning'; return 'success'; @@ -66,20 +71,20 @@ const getProgressStatus = (percent?: number): ProgressStatus | undefined => {