feat: get alarms from all stations

This commit is contained in:
yangsy
2025-08-20 01:18:01 +08:00
parent 91dee03829
commit c4e7baea95
9 changed files with 378 additions and 97 deletions

View File

@@ -1,10 +1,24 @@
import type { PageParams, PageResult } from '@/apis/models/base/page';
import type { NdmDeviceAlarmLogPageQuery, NdmDeviceAlarmLogResultVO } from '@/apis/models/device/alarm/ndm-device-alarm-log';
import { ndmClient } from '@/apis/client';
import { ndmClient, userClient } from '@/apis/client';
export const postNdmDeviceAlarmLogPage = async (stationCode: string, pageQuery: PageParams<NdmDeviceAlarmLogPageQuery>) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<PageResult<NdmDeviceAlarmLogResultVO>>(`${prefix}/api/ndm/ndmDeviceAlarmLog/page`, pageQuery);
return resp;
const endpoint = '/api/ndm/ndmDeviceAlarmLog/page';
// 如果车站编码为空则通过用户API客户端发送请求
if (!stationCode) {
const resp = await userClient.post<PageResult<NdmDeviceAlarmLogResultVO>>(endpoint, pageQuery);
const [err, alarmData] = resp;
if (err || !alarmData) {
throw err;
}
return alarmData;
}
// 如果车站编码不为空则通过网管API客户端发送请求
const resp = await ndmClient.post<PageResult<NdmDeviceAlarmLogResultVO>>(`/${stationCode}${endpoint}`, pageQuery);
const [err, alarmData] = resp;
if (err || !alarmData) {
throw err;
}
return alarmData;
};