更新api和路由
This commit is contained in:
@@ -141,6 +141,126 @@
|
||||
}
|
||||
},
|
||||
"/api/v1/alarm/threshold/area": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据过滤条件和分页参数查询区域阈值告警列表",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"告警管理"
|
||||
],
|
||||
"summary": "批量查询区域阈值告警",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "按区域主控ID过滤",
|
||||
"name": "area_controller_id",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"Debug",
|
||||
"Info",
|
||||
"Warn",
|
||||
"Error",
|
||||
"DPanic",
|
||||
"Panic",
|
||||
"Fatal"
|
||||
],
|
||||
"type": "string",
|
||||
"x-enum-varnames": [
|
||||
"DebugLevel",
|
||||
"InfoLevel",
|
||||
"WarnLevel",
|
||||
"ErrorLevel",
|
||||
"DPanicLevel",
|
||||
"PanicLevel",
|
||||
"FatalLevel"
|
||||
],
|
||||
"description": "按告警等级过滤",
|
||||
"name": "level",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "排序字段,例如 \"id DESC\"",
|
||||
"name": "order_by",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "page_size",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"信号强度",
|
||||
"电池电量",
|
||||
"温度",
|
||||
"湿度",
|
||||
"重量"
|
||||
],
|
||||
"type": "string",
|
||||
"x-enum-comments": {
|
||||
"SensorTypeBatteryLevel": "电池电量",
|
||||
"SensorTypeHumidity": "湿度",
|
||||
"SensorTypeSignalMetrics": "信号强度",
|
||||
"SensorTypeTemperature": "温度",
|
||||
"SensorTypeWeight": "重量"
|
||||
},
|
||||
"x-enum-descriptions": [
|
||||
"信号强度",
|
||||
"电池电量",
|
||||
"温度",
|
||||
"湿度",
|
||||
"重量"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"SensorTypeSignalMetrics",
|
||||
"SensorTypeBatteryLevel",
|
||||
"SensorTypeTemperature",
|
||||
"SensorTypeHumidity",
|
||||
"SensorTypeWeight"
|
||||
],
|
||||
"description": "按传感器类型过滤",
|
||||
"name": "sensor_type",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功获取区域阈值告警列表",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/dto.ListAreaThresholdAlarmResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
@@ -302,6 +422,126 @@
|
||||
}
|
||||
},
|
||||
"/api/v1/alarm/threshold/device": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"BearerAuth": []
|
||||
}
|
||||
],
|
||||
"description": "根据过滤条件和分页参数查询设备阈值告警列表",
|
||||
"consumes": [
|
||||
"application/json"
|
||||
],
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"告警管理"
|
||||
],
|
||||
"summary": "批量查询设备阈值告警",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "按设备ID过滤",
|
||||
"name": "device_id",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"Debug",
|
||||
"Info",
|
||||
"Warn",
|
||||
"Error",
|
||||
"DPanic",
|
||||
"Panic",
|
||||
"Fatal"
|
||||
],
|
||||
"type": "string",
|
||||
"x-enum-varnames": [
|
||||
"DebugLevel",
|
||||
"InfoLevel",
|
||||
"WarnLevel",
|
||||
"ErrorLevel",
|
||||
"DPanicLevel",
|
||||
"PanicLevel",
|
||||
"FatalLevel"
|
||||
],
|
||||
"description": "按告警等级过滤",
|
||||
"name": "level",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "排序字段,例如 \"id DESC\"",
|
||||
"name": "order_by",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"name": "page_size",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"信号强度",
|
||||
"电池电量",
|
||||
"温度",
|
||||
"湿度",
|
||||
"重量"
|
||||
],
|
||||
"type": "string",
|
||||
"x-enum-comments": {
|
||||
"SensorTypeBatteryLevel": "电池电量",
|
||||
"SensorTypeHumidity": "湿度",
|
||||
"SensorTypeSignalMetrics": "信号强度",
|
||||
"SensorTypeTemperature": "温度",
|
||||
"SensorTypeWeight": "重量"
|
||||
},
|
||||
"x-enum-descriptions": [
|
||||
"信号强度",
|
||||
"电池电量",
|
||||
"温度",
|
||||
"湿度",
|
||||
"重量"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"SensorTypeSignalMetrics",
|
||||
"SensorTypeBatteryLevel",
|
||||
"SensorTypeTemperature",
|
||||
"SensorTypeHumidity",
|
||||
"SensorTypeWeight"
|
||||
],
|
||||
"description": "按传感器类型过滤",
|
||||
"name": "sensor_type",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "成功获取设备阈值告警列表",
|
||||
"schema": {
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/controller.Response"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/dto.ListDeviceThresholdAlarmResponse"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"security": [
|
||||
{
|
||||
@@ -5449,15 +5689,15 @@
|
||||
"alarm_code": {
|
||||
"$ref": "#/definitions/models.AlarmCode"
|
||||
},
|
||||
"alarm_details": {
|
||||
"type": "string"
|
||||
},
|
||||
"alarm_summary": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer"
|
||||
},
|
||||
"json_details": {
|
||||
"type": "string"
|
||||
},
|
||||
"level": {
|
||||
"$ref": "#/definitions/models.SeverityLevel"
|
||||
},
|
||||
@@ -5495,6 +5735,20 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.ListAreaThresholdAlarmResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"list": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/dto.AreaThresholdAlarmDTO"
|
||||
}
|
||||
},
|
||||
"pagination": {
|
||||
"$ref": "#/definitions/dto.PaginationDTO"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.ListDeviceCommandLogResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@@ -5509,6 +5763,20 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.ListDeviceThresholdAlarmResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"list": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/dto.DeviceThresholdAlarmDTO"
|
||||
}
|
||||
},
|
||||
"pagination": {
|
||||
"$ref": "#/definitions/dto.PaginationDTO"
|
||||
}
|
||||
}
|
||||
},
|
||||
"dto.ListFeedUsageRecordResponse": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
:collapse="isCollapse"
|
||||
:collapse-transition="false"
|
||||
router
|
||||
:default-openeds="['/device-management', '/monitor', '/pms']"
|
||||
:default-openeds="['/device-management', '/monitor', '/pms', '/alarm']"
|
||||
>
|
||||
<el-menu-item index="/">
|
||||
<el-icon>
|
||||
@@ -203,7 +203,18 @@
|
||||
</el-icon>
|
||||
<span>告警中心</span>
|
||||
</template>
|
||||
<!-- 占位, 后续可添加告警管理和告警配置 -->
|
||||
<el-menu-item index="/alarms">
|
||||
<el-icon>
|
||||
<Warning />
|
||||
</el-icon>
|
||||
<template #title>告警管理</template>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="/alarms/thresholds">
|
||||
<el-icon>
|
||||
<Setting />
|
||||
</el-icon>
|
||||
<template #title>阈值告警配置</template>
|
||||
</el-menu-item>
|
||||
</el-sub-menu>
|
||||
|
||||
</el-menu>
|
||||
@@ -344,7 +355,7 @@ export default {
|
||||
|
||||
const activeMenu = computed(() => {
|
||||
const path = route.path;
|
||||
if (path.startsWith('/monitor') || path.startsWith('/pms') || path.startsWith('/devices') || path.startsWith('/device-templates')) {
|
||||
if (path.startsWith('/monitor') || path.startsWith('/pms') || path.startsWith('/devices') || path.startsWith('/device-templates') || path.startsWith('/alarms')) {
|
||||
return path;
|
||||
}
|
||||
return route.path;
|
||||
|
||||
@@ -24,12 +24,16 @@ import TaskExecutionLogsView from '../views/monitor/TaskExecutionLogsView.vue';
|
||||
import UserActionLogsView from '../views/monitor/UserActionLogsView.vue';
|
||||
import WeighingBatchesView from '../views/monitor/WeighingBatchesView.vue';
|
||||
import WeighingRecordsView from '../views/monitor/WeighingRecordsView.vue';
|
||||
import AlarmList from '../views/alarm/AlarmList.vue';
|
||||
import ThresholdAlarmList from '../views/alarm/ThresholdAlarmList.vue';
|
||||
|
||||
const routes = [
|
||||
{path: '/', component: Home, meta: {requiresAuth: true, title: '系统首页'}},
|
||||
{path: '/devices', component: DeviceList, meta: {requiresAuth: true, title: '设备管理'}},
|
||||
{path: '/device-templates', component: DeviceTemplateList, meta: {requiresAuth: true, title: '设备模板管理'}},
|
||||
{path: '/plans', component: PlanList, meta: {requiresAuth: true, title: '计划管理'}},
|
||||
{path: '/alarms', component: AlarmList, meta: {requiresAuth: true, title: '告警管理'}},
|
||||
{path: '/alarms/thresholds', component: ThresholdAlarmList, meta: {requiresAuth: true, title: '阈值告警配置'}},
|
||||
{path: '/login', component: LoginForm},
|
||||
{path: '/pms/farm-management', name: 'PigFarmManagement', component: PigFarmManagementView, meta: { requiresAuth: true, title: '栏舍管理' }},
|
||||
{path: '/pms/batch-management', name: 'PigBatchManagement', component: PigBatchManagementView, meta: { requiresAuth: true, title: '猪群管理' }},
|
||||
|
||||
Reference in New Issue
Block a user