feat(仪表盘): 添加统计API并优化仪表盘组件

This commit is contained in:
zhang1106
2026-03-15 12:19:13 +08:00
parent 7aa09ac9e1
commit a7f051172a
10 changed files with 696 additions and 298 deletions
@@ -16,7 +16,11 @@ const quickStatItemStyle = {
boxShadow: designTokens.shadows.small,
};
const QuickStats = ({ onlineRate, powerUsage }) => {
const QuickStats = ({ onlineRate, powerUsage, totalMaxPower }) => {
const powerUsagePercent = totalMaxPower > 0
? ((powerUsage / totalMaxPower) * 100).toFixed(1)
: '0.0';
const quickStats = [
{
icon: LineChartOutlined,
@@ -33,7 +37,7 @@ const QuickStats = ({ onlineRate, powerUsage }) => {
{
icon: ThunderboltOutlined,
label: '功率使用',
value: `${powerUsage}W`,
value: `${powerUsagePercent}%`,
color: designTokens.colors.warning.main,
},
];