From 605a29f256db8501241966833d18d3812e782b9f Mon Sep 17 00:00:00 2001 From: yangsy Date: Thu, 6 Nov 2025 11:11:24 +0800 Subject: [PATCH] refactor(station-card): update UI --- .../dashboard-page/station-card.vue | 139 +++++++++--------- 1 file changed, 69 insertions(+), 70 deletions(-) diff --git a/src/components/dashboard-page/station-card.vue b/src/components/dashboard-page/station-card.vue index 07d65b4..67db155 100644 --- a/src/components/dashboard-page/station-card.vue +++ b/src/components/dashboard-page/station-card.vue @@ -5,7 +5,7 @@ import { type StationAlarmCounts, type StationDevices } from '@/composables/quer import { ControlOutlined } from '@vicons/antd'; import { Video as VideoIcon } from '@vicons/carbon'; import axios from 'axios'; -import { NCard, NStatistic, NTag, NGrid, NGi, NButton, NIcon, useThemeVars, NSpace, NTooltip } from 'naive-ui'; +import { NCard, NTag, NButton, NIcon, useThemeVars, NSpace, NFlex, NText } from 'naive-ui'; import { toRefs, computed } from 'vue'; const props = defineProps<{ @@ -22,7 +22,14 @@ const emit = defineEmits<{ const { station, stationDevices, stationAlarmCounts } = toRefs(props); -// 计算总离线设备数量 +const onlineDeviceCount = computed(() => { + let count = 0; + Object.values(DeviceType).forEach((deviceType) => { + const onlineDeviceList = stationDevices.value?.[deviceType].filter((device) => device.deviceStatus === '10') ?? []; + count += onlineDeviceList.length; + }); + return count; +}); const offlineDeviceCount = computed(() => { let count = 0; Object.values(DeviceType).forEach((deviceType) => { @@ -95,63 +102,47 @@ const theme = useThemeVars(); {{ station.online ? '在线' : '离线' }} + @@ -163,23 +154,31 @@ const theme = useThemeVars(); transition: color 0.2s ease; &:hover { - color: v-bind('theme.primaryColorHover'); + color: v-bind('theme.iconColorHover'); } } -.font-xx-small { - font-size: xx-small; -} - -.font-medium { - font-size: medium; -} - -.font-small { - font-size: small; -} - .font-smaller { font-size: smaller; } + +.btn-text { + margin-left: 6px; + font-size: xx-small; + color: v-bind('theme.textColor3'); +} + +.metric-label { + font-size: xx-small; +} + +.metric-value { + font-size: small; +} + +.unit, +.slash { + margin-left: 4px; + font-size: xx-small; +}