fix 告警级别

This commit is contained in:
zxr
2026-03-23 15:24:23 +08:00
parent 51dda0e95a
commit dba76fa338
2 changed files with 8 additions and 4 deletions

View File

@@ -7,7 +7,7 @@ export const fetchAlertLevelList = (data?: {
keyword?: string;
enabled?: string;
}) => {
return request.get("/Alert/v1/severity/list", data || {});
return request.get("/Alert/v1/severity/list", { params: data || {} });
};
/** 获取告警级别详情 */

View File

@@ -144,9 +144,13 @@ const fetchLevels = async () => {
}
const res = await fetchAlertLevelList(params)
tableData.value = res.details?.data || []
pagination.total = res.details?.total || 0
// 优先适配分页层字段total/page/page_size/data并兼容历史返回结构
const pageData = res?.data?.data ?? res?.details?.data ?? res?.data ?? []
const pageTotal = res?.data?.total ?? res?.details?.total ?? res?.total ?? 0
tableData.value = Array.isArray(pageData) ? pageData : []
pagination.total = Number(pageTotal) || 0
} catch (error) {
console.error('获取告警级别列表失败:', error)
Message.error('获取告警级别列表失败')