refactor: 重构项目结构
- 优化 `车站-设备-告警` 轮询机制 - 改进设备卡片的布局 - 支持修改设备 - 告警轮询中获取完整告警数据 - 车站告警详情支持导出完整的 `今日告警列表` - 支持将状态持久化到 `IndexedDB` - 新增轮询控制 (调试模式) - 新增离线开发模式 (调试模式) - 新增 `IndexedDB` 数据控制 (调试模式)
This commit is contained in:
55
src/apis/request/biz/icmp/ndm-icmp-export.ts
Normal file
55
src/apis/request/biz/icmp/ndm-icmp-export.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import { ndmClient, userClient, type IcmpEntity, type Station } from '@/apis';
|
||||
|
||||
export const exportIcmpApi = async (status?: string, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const endpoint = `${prefix}/api/ndm/ndmIcmpExport/exportByTemplate`;
|
||||
const body = new URLSearchParams();
|
||||
body.append('status', status ?? '');
|
||||
const resp = await client.post<Blob>(endpoint, body, {
|
||||
responseType: 'blob',
|
||||
retRaw: true,
|
||||
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
|
||||
signal,
|
||||
});
|
||||
const [err, data] = resp;
|
||||
if (err) throw err;
|
||||
if (!data) throw new Error(`${data}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const exportIcmpByStationApi = async (stationCodes: Station['code'][], status: string, options?: { signal?: AbortSignal }) => {
|
||||
const { signal } = options ?? {};
|
||||
const client = ndmClient;
|
||||
const prefix = '';
|
||||
const endpoint = `${prefix}/api/ndm/ndmIcmpExport/exportByTemplateByStation`;
|
||||
const resp = await client.post<Blob>(
|
||||
endpoint,
|
||||
{
|
||||
stationCode: stationCodes,
|
||||
status,
|
||||
},
|
||||
{
|
||||
responseType: 'blob',
|
||||
retRaw: true,
|
||||
signal,
|
||||
},
|
||||
);
|
||||
const [err, data] = resp;
|
||||
if (err) throw err;
|
||||
if (!data) throw new Error(`${data}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const icmpEntityByDeviceId = async (deviceId: string, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const endpoint = `${prefix}/api/ndm/ndmIcmpExport/icmpEntityByDeviceId`;
|
||||
const resp = await client.get<IcmpEntity[]>(endpoint, { params: { deviceId }, signal, retRaw: true });
|
||||
const [err, data] = resp;
|
||||
if (err) throw err;
|
||||
if (!data) throw new Error(`${data}`);
|
||||
return data;
|
||||
};
|
||||
Reference in New Issue
Block a user