| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- import axios from 'axios';
- import { AlertHandleLog } from "../../share/monitorTypes.ts";
- // 告警处理相关响应类型
- interface AlertHandleDataResponse {
- data: AlertHandleLog[];
- total: number;
- page: number;
- pageSize: number;
- }
-
- interface AlertHandleResponse {
- data: AlertHandleLog;
- message?: string;
- }
- // 告警处理API接口定义
- export const AlertHandleAPI = {
- // 获取告警处理数据
- getAlertHandleData: async (params?: {
- page?: number,
- limit?: number,
- alert_id?: number,
- handle_type?: string,
- start_time?: string,
- end_time?: string
- }): Promise<AlertHandleDataResponse> => {
- try {
- const response = await axios.get(`/alert-handles`, { params });
- return response.data;
- } catch (error) {
- throw error;
- }
- },
-
- // 获取单个告警处理数据
- getAlertHandle: async (id: number): Promise<AlertHandleResponse> => {
- try {
- const response = await axios.get(`/alert-handles/${id}`);
- return response.data;
- } catch (error) {
- throw error;
- }
- },
-
- // 创建告警处理数据
- createAlertHandle: async (data: Partial<AlertHandleLog>) => {
- try {
- const response = await axios.post(`/alert-handles`, data);
- return response.data;
- } catch (error) {
- throw error;
- }
- },
-
- // 更新告警处理数据
- updateAlertHandle: async (id: number, data: Partial<AlertHandleLog>) => {
- try {
- const response = await axios.put(`/alert-handles/${id}`, data);
- return response.data;
- } catch (error) {
- throw error;
- }
- },
-
- // 删除告警处理数据
- deleteAlertHandle: async (id: number) => {
- try {
- const response = await axios.delete(`/alert-handles/${id}`);
- return response.data;
- } catch (error) {
- throw error;
- }
- }
- };
|