性能:看板改为单次请求加载,从5个并发请求优化为1个
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -23,11 +23,8 @@ import {
|
||||
} from 'ant-design-vue';
|
||||
|
||||
import {
|
||||
getAlertDeviceTop,
|
||||
getAlertHourDistribution,
|
||||
getAlertStatistics,
|
||||
getAlertDashboard,
|
||||
getAlertTrend,
|
||||
getRecentAlerts,
|
||||
} from '#/api/aiot/alarm';
|
||||
|
||||
import {
|
||||
@@ -94,23 +91,16 @@ const STATUS_NAMES: Record<string, string> = {
|
||||
ignored: '已忽略',
|
||||
};
|
||||
|
||||
/** 加载全部数据 */
|
||||
/** 加载全部数据(单次请求) */
|
||||
async function loadAll() {
|
||||
loading.value = true;
|
||||
try {
|
||||
const [statsRes, trendRes, deviceRes, hourRes, alertsRes] =
|
||||
await Promise.all([
|
||||
getAlertStatistics(),
|
||||
getAlertTrend(trendDays.value),
|
||||
getAlertDeviceTop(10, 7),
|
||||
getAlertHourDistribution(7),
|
||||
getRecentAlerts(10),
|
||||
]);
|
||||
stats.value = statsRes;
|
||||
trendData.value = trendRes;
|
||||
deviceTopData.value = deviceRes;
|
||||
hourDistData.value = hourRes;
|
||||
recentAlerts.value = alertsRes?.list || [];
|
||||
const data = await getAlertDashboard(trendDays.value);
|
||||
stats.value = data.statistics;
|
||||
trendData.value = data.trend;
|
||||
deviceTopData.value = data.deviceTop;
|
||||
hourDistData.value = data.hourDistribution;
|
||||
recentAlerts.value = data.recentAlerts || [];
|
||||
} finally {
|
||||
loading.value = false;
|
||||
await nextTick();
|
||||
|
||||
Reference in New Issue
Block a user