chore: reorder import
This commit is contained in:
40
src/apis/requests/device/log/ndm-device-alarm-log.ts
Normal file
40
src/apis/requests/device/log/ndm-device-alarm-log.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { userClient, ndmClient } from '@/apis/client';
|
||||
import type { PageParams, NdmDeviceAlarmLogPageQuery, PageResult, NdmDeviceAlarmLogResultVO } from '@/apis/models';
|
||||
|
||||
export const postNdmDeviceAlarmLogPage = async (stationCode: string, pageQuery: PageParams<NdmDeviceAlarmLogPageQuery>) => {
|
||||
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;
|
||||
};
|
||||
|
||||
export const defaultExportByTemplate = async (stationCode: string, pageQuery: PageParams<NdmDeviceAlarmLogPageQuery>) => {
|
||||
const endpoint = '/api/ndm/ndmDeviceAlarmLog/defaultExportByTemplate';
|
||||
if (!stationCode) {
|
||||
const resp = await userClient.post<BlobPart>(`${endpoint}`, pageQuery, { responseType: 'blob', retRaw: true });
|
||||
const [err, data] = resp;
|
||||
if (err || !data) {
|
||||
throw err;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
const resp = await ndmClient.post<BlobPart>(`${endpoint}`, pageQuery, { responseType: 'blob', retRaw: true });
|
||||
const [err, data] = resp;
|
||||
if (err || !data) {
|
||||
throw err;
|
||||
}
|
||||
return data;
|
||||
};
|
||||
Reference in New Issue
Block a user