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 => { try { const response = await axios.get(`/alert-handles`, { params }); return response.data; } catch (error) { throw error; } }, // 获取单个告警处理数据 getAlertHandle: async (id: number): Promise => { try { const response = await axios.get(`/alert-handles/${id}`); return response.data; } catch (error) { throw error; } }, // 创建告警处理数据 createAlertHandle: async (data: Partial) => { try { const response = await axios.post(`/alert-handles`, data); return response.data; } catch (error) { throw error; } }, // 更新告警处理数据 updateAlertHandle: async (id: number, data: Partial) => { 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; } } };