更新api和路由
This commit is contained in:
@@ -58,6 +58,22 @@ import { Response, SeverityLevel, AlarmSourceType, Operator, AlarmCode, Notifica
|
||||
* @property {number} thresholds
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} ListAreaThresholdAlarmResponse
|
||||
* @property {Array<AreaThresholdAlarmDTO>} list
|
||||
* @property {PaginationDTO} pagination
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} AreaThresholdAlarmsParams
|
||||
* @property {number} [area_controller_id] - 按区域主控ID过滤
|
||||
* @property {SeverityLevel} [level] - 按告警等级过滤
|
||||
* @property {string} [order_by] - 排序字段,例如 "id DESC"
|
||||
* @property {number} [page]
|
||||
* @property {number} [page_size]
|
||||
* @property {SensorType} [sensor_type] - 按传感器类型过滤
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} UpdateAreaThresholdAlarmDTO
|
||||
* @property {Operator} operator - 新的操作符
|
||||
@@ -84,6 +100,22 @@ import { Response, SeverityLevel, AlarmSourceType, Operator, AlarmCode, Notifica
|
||||
* @property {number} thresholds
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} ListDeviceThresholdAlarmResponse
|
||||
* @property {Array<DeviceThresholdAlarmDTO>} list
|
||||
* @property {PaginationDTO} pagination
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} DeviceThresholdAlarmsParams
|
||||
* @property {number} [device_id] - 按设备ID过滤
|
||||
* @property {SeverityLevel} [level] - 按告警等级过滤
|
||||
* @property {string} [order_by] - 排序字段,例如 "id DESC"
|
||||
* @property {number} [page]
|
||||
* @property {number} [page_size]
|
||||
* @property {SensorType} [sensor_type] - 按传感器类型过滤
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} UpdateDeviceThresholdAlarmDTO
|
||||
* @property {Operator} operator - 新的操作符
|
||||
@@ -147,6 +179,15 @@ export const getActiveAlarms = (params) => {
|
||||
return http.get('/api/v1/alarm/threshold/active-alarms', { params });
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据过滤条件和分页参数查询区域阈值告警列表
|
||||
* @param {AreaThresholdAlarmsParams} params - 查询参数
|
||||
* @returns {Promise<ListAreaThresholdAlarmResponse>}
|
||||
*/
|
||||
export const getAreaThresholdAlarms = (params) => {
|
||||
return http.get('/api/v1/alarm/threshold/area', { params });
|
||||
};
|
||||
|
||||
/**
|
||||
* 为指定的区域主控创建一个新的阈值告警规则
|
||||
* @param {CreateAreaThresholdAlarmDTO} requestBody - 创建区域阈值告警请求体
|
||||
@@ -184,6 +225,15 @@ export const deleteAreaThresholdAlarm = (task_id) => {
|
||||
return http.delete(`/api/v1/alarm/threshold/area/${task_id}`);
|
||||
};
|
||||
|
||||
/**
|
||||
* 根据过滤条件和分页参数查询设备阈值告警列表
|
||||
* @param {DeviceThresholdAlarmsParams} params - 查询参数
|
||||
* @returns {Promise<ListDeviceThresholdAlarmResponse>}
|
||||
*/
|
||||
export const getDeviceThresholdAlarms = (params) => {
|
||||
return http.get('/api/v1/alarm/threshold/device', { params });
|
||||
};
|
||||
|
||||
/**
|
||||
* 为单个设备创建一个新的阈值告警规则
|
||||
* @param {CreateDeviceThresholdAlarmDTO} requestBody - 创建设备阈值告警请求体
|
||||
@@ -252,10 +302,12 @@ export const snoozeAlarm = (id, requestBody) => {
|
||||
|
||||
export const AlarmApi = {
|
||||
getActiveAlarms,
|
||||
getAreaThresholdAlarms,
|
||||
createAreaThresholdAlarm,
|
||||
getAreaThresholdAlarmById,
|
||||
updateAreaThresholdAlarm,
|
||||
deleteAreaThresholdAlarm,
|
||||
getDeviceThresholdAlarms,
|
||||
createDeviceThresholdAlarm,
|
||||
getDeviceThresholdAlarmById,
|
||||
updateDeviceThresholdAlarm,
|
||||
|
||||
Reference in New Issue
Block a user