侧边栏添加收起展开按钮,修复修复增长趋势显示NaN的问题

This commit is contained in:
zhang1106
2025-12-19 20:01:15 +08:00
parent cc76fd270b
commit a5f8b3cc97
2 changed files with 53 additions and 13 deletions
+11 -8
View File
@@ -17,13 +17,13 @@ import axios from 'axios';
function Dashboard() {
const [stats, setStats] = useState({
totalDevices: 0,
totalRacks: 0,
totalRooms: 0,
faultDevices: 0,
deviceGrowth: 2.5, // 示例增长数据
faultTrend: -12.3 // 示例趋势数据
});
totalDevices: 0,
totalRacks: 0,
totalRooms: 0,
faultDevices: 0,
deviceGrowth: 2.5, // 示例增长数据
faultTrend: -12.3 // 示例趋势数据
});
const [loading, setLoading] = useState(true);
useEffect(() => {
@@ -55,7 +55,10 @@ function Dashboard() {
totalDevices,
totalRacks,
totalRooms,
faultDevices
faultDevices,
// 保留或更新趋势数据
deviceGrowth: stats.deviceGrowth || 0,
faultTrend: stats.faultTrend || 0
});
} catch (error) {
message.error('获取统计数据失败');