23 lines
1.2 KiB
TypeScript
23 lines
1.2 KiB
TypeScript
import { ndmClient, userClient, type NdmVimpLogPageQuery, type NdmVimpLogResultVO, type PageParams, type PageResult, type Station } from '@/apis';
|
|
import { unwrapResponse } from '@/utils';
|
|
|
|
export const pageVimpLogApi = async (pageQuery: PageParams<NdmVimpLogPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
|
const { stationCode, signal } = options ?? {};
|
|
const client = stationCode ? ndmClient : userClient;
|
|
const prefix = stationCode ? `/${stationCode}` : '';
|
|
const endpoint = `${prefix}/api/ndm/ndmVimpLog/page`;
|
|
const resp = await client.post<PageResult<NdmVimpLogResultVO>>(endpoint, pageQuery, { signal });
|
|
const data = unwrapResponse(resp);
|
|
return data;
|
|
};
|
|
|
|
export const exportVimpLogApi = async (pageQuery: PageParams<NdmVimpLogPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
|
const { stationCode, signal } = options ?? {};
|
|
const client = stationCode ? ndmClient : userClient;
|
|
const prefix = stationCode ? `/${stationCode}` : '';
|
|
const endpoint = `${prefix}/api/ndm/ndmVimpLog/defaultExportByTemplate`;
|
|
const resp = await client.post<Blob>(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal });
|
|
const data = unwrapResponse(resp);
|
|
return data;
|
|
};
|