From 65a48d4e3a01c2fffeae4edbb69856a999b31bf3 Mon Sep 17 00:00:00 2001 From: Wangxin Date: Mon, 6 Oct 2025 13:22:33 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E3=80=90web=E3=80=91=20=E9=A2=84=E8=AD=A6?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20=E6=8E=A5=E5=8F=A3=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../alops-ui/src/api/inMonitoring/message.js | 58 ++ .../alops-ui/src/api/inMonitoring/rules.js | 58 ++ .../alops-ui/src/views/device/files/index.vue | 48 +- .../views/inMonitoring/earlyWarning/index.vue | 505 ------------------ .../inMonitoring/inMonitor/message/index.vue | 324 +++++++++++ .../inMonitoring/inMonitor/rules/index.vue | 445 +++++++++++++++ 6 files changed, 923 insertions(+), 515 deletions(-) create mode 100644 ALOps_sys_fe/alops-ui/src/api/inMonitoring/message.js create mode 100644 ALOps_sys_fe/alops-ui/src/api/inMonitoring/rules.js delete mode 100644 ALOps_sys_fe/alops-ui/src/views/inMonitoring/earlyWarning/index.vue create mode 100644 ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/message/index.vue create mode 100644 ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/rules/index.vue diff --git a/ALOps_sys_fe/alops-ui/src/api/inMonitoring/message.js b/ALOps_sys_fe/alops-ui/src/api/inMonitoring/message.js new file mode 100644 index 00000000..2ec5a5b0 --- /dev/null +++ b/ALOps_sys_fe/alops-ui/src/api/inMonitoring/message.js @@ -0,0 +1,58 @@ +import request from '@/utils/request' +import { parseStrEmpty } from "@/utils/ruoyi"; +const api = '/inMonitoring/alertMessage/' + +// 查询详细 +export function getDict() { + return request({ + url: '/sys_dict', + method: 'get' + }) +} + +// 查询列表 +export function list(query) { + return request({ + url: api + 'list', + method: 'get', + params: query + }) +} + +// 查询详细 +export function getInfo(id) { + return request({ + url: api + '/queryById/' + parseStrEmpty(id), + method: 'get' + }) +} + +// 新增 +export function add(data) { + return request({ + url: api + 'add', + method: 'post', + data: data + }) +} + +// 修改 +export function update(data) { + return request({ + url: api + 'editAlertMessage', + method: 'put', + data: data + }) +} + +// 删除 +export function del(id) { + return request({ + url: api + id, + method: 'delete' + }) +} + + + + diff --git a/ALOps_sys_fe/alops-ui/src/api/inMonitoring/rules.js b/ALOps_sys_fe/alops-ui/src/api/inMonitoring/rules.js new file mode 100644 index 00000000..1eec0a70 --- /dev/null +++ b/ALOps_sys_fe/alops-ui/src/api/inMonitoring/rules.js @@ -0,0 +1,58 @@ +import request from '@/utils/request' +import { parseStrEmpty } from "@/utils/ruoyi"; +const api = '/inMonitoring/alertRule/' + +// 查询详细 +export function byTable() { + return request({ + url: api + 'byTable', + method: 'get' + }) +} + +// 查询列表 +export function list(query) { + return request({ + url: api + 'list', + method: 'get', + params: query + }) +} + +// 查询详细 +export function getInfo(id) { + return request({ + url: api + '/queryById/' + parseStrEmpty(id), + method: 'get' + }) +} + +// 新增 +export function add(data) { + return request({ + url: api + 'addRule', + method: 'post', + data: data + }) +} + +// 修改 +export function update(data) { + return request({ + url: api + 'editRule', + method: 'put', + data: data + }) +} + +// 删除 +export function del(id) { + return request({ + url: api + id, + method: 'delete' + }) +} + + + + diff --git a/ALOps_sys_fe/alops-ui/src/views/device/files/index.vue b/ALOps_sys_fe/alops-ui/src/views/device/files/index.vue index 18e5e9aa..4185cba1 100644 --- a/ALOps_sys_fe/alops-ui/src/views/device/files/index.vue +++ b/ALOps_sys_fe/alops-ui/src/views/device/files/index.vue @@ -52,7 +52,7 @@ @@ -271,12 +271,45 @@ export default { }, // 表单校验 rules: { + equNumber: [ + { required: true, message: "设备编号不能为空", trigger: "blur" }, + ], name: [ - { required: true, message: "设备名称不能为空", trigger: "blur" }, + { required: true, message: "设备名称不能为空", trigger: "blur" } + ], + version: [ + { required: true, message: "设备版本不能为空", trigger: "blur" }, + ], + equType: [ + { required: true, message: "设备类型不能为空", trigger: "blur" } + ], + deviceLevel: [ + { required: true, message: "设备级别不能为空", trigger: "blur" }, + ], + ip: [ + { required: true, message: "带外管理IP不能为空", trigger: "blur" } + ], + manufacture: [ + { required: true, message: "设备厂商不能为空", trigger: "blur" }, + ], + location: [ + { required: true, message: "安装位置不能为空", trigger: "blur" } + ], + inCharge: [ + { required: true, message: "设备管理员不能为空", trigger: "blur" }, + ], + lifeCycle: [ + { required: true, message: "预计年限不能为空", trigger: "blur" } + ], + serviceTime: [ + { required: true, message: "服役年限不能为空", trigger: "blur" }, + ], + warranty: [ + { required: true, message: "质保年限不能为空", trigger: "blur" } + ], + image: [ + { required: true, message: "设备图片不能为空", trigger: "blur" } ], - nickName: [ - { required: true, message: "设备昵称不能为空", trigger: "blur" } - ] } } }, @@ -361,11 +394,6 @@ export default { submitForm: function() { this.$refs["form"].validate(valid => { if (valid) { - add(this.form).then(response => { - this.$modal.msgSuccess("新增成功") - this.open = false - this.getList() - }) if (this.form.id != undefined) { update(this.form).then(response => { this.$modal.msgSuccess("修改成功") diff --git a/ALOps_sys_fe/alops-ui/src/views/inMonitoring/earlyWarning/index.vue b/ALOps_sys_fe/alops-ui/src/views/inMonitoring/earlyWarning/index.vue deleted file mode 100644 index fa9a3d99..00000000 --- a/ALOps_sys_fe/alops-ui/src/views/inMonitoring/earlyWarning/index.vue +++ /dev/null @@ -1,505 +0,0 @@ - - - \ No newline at end of file diff --git a/ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/message/index.vue b/ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/message/index.vue new file mode 100644 index 00000000..3f7ad5e9 --- /dev/null +++ b/ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/message/index.vue @@ -0,0 +1,324 @@ + + + \ No newline at end of file diff --git a/ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/rules/index.vue b/ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/rules/index.vue new file mode 100644 index 00000000..5800c083 --- /dev/null +++ b/ALOps_sys_fe/alops-ui/src/views/inMonitoring/inMonitor/rules/index.vue @@ -0,0 +1,445 @@ + + + \ No newline at end of file From b3c5172929bcf312e1f3c3f5ac49f4ab59e7140e Mon Sep 17 00:00:00 2001 From: Wangxin Date: Mon, 6 Oct 2025 14:23:07 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E3=80=90web=E3=80=91=20=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ALOps_sys_fe/alops-ui/public/index.html | 1 + .../alops-ui/src/api/QandA/knowledge.js | 2 +- .../views/device/deviceManufacturer/index.vue | 5 +- .../alops-ui/src/views/index copy.vue | 308 +++++++ ALOps_sys_fe/alops-ui/src/views/index.vue | 759 ++++++++++++------ 5 files changed, 807 insertions(+), 268 deletions(-) create mode 100644 ALOps_sys_fe/alops-ui/src/views/index copy.vue diff --git a/ALOps_sys_fe/alops-ui/public/index.html b/ALOps_sys_fe/alops-ui/public/index.html index 925455ca..ec69afcf 100644 --- a/ALOps_sys_fe/alops-ui/public/index.html +++ b/ALOps_sys_fe/alops-ui/public/index.html @@ -6,6 +6,7 @@ + <%= webpackConfig.name %> diff --git a/ALOps_sys_fe/alops-ui/src/views/index.vue b/ALOps_sys_fe/alops-ui/src/views/index.vue index 64031b5a..d35b56a4 100644 --- a/ALOps_sys_fe/alops-ui/src/views/index.vue +++ b/ALOps_sys_fe/alops-ui/src/views/index.vue @@ -1,94 +1,127 @@ @@ -100,25 +133,6 @@ import PieChart from './dashboard/PieChart' import BarChart from './dashboard/BarChart' import digital from './dashboard/digital' -const lineChartData = { - newVisitis: { - expectedData: [100, 120, 161, 134, 105, 160, 165], - actualData: [120, 82, 91, 154, 162, 140, 145] - }, - messages: { - expectedData: [200, 192, 120, 144, 160, 130, 140], - actualData: [180, 160, 151, 106, 145, 150, 130] - }, - purchases: { - expectedData: [80, 100, 121, 104, 105, 90, 100], - actualData: [120, 90, 100, 138, 142, 130, 130] - }, - shoppings: { - expectedData: [130, 140, 141, 142, 145, 150, 160], - actualData: [120, 82, 91, 154, 162, 140, 130] - } -} - export default { name: 'Index', components: { @@ -131,178 +145,395 @@ export default { }, data() { return { - lineChartData: lineChartData.newVisitis, - scrollConfig:{ - header: ['设备名称', '设备位置', 'CPU使用率','内存使用率','温度', '健康度', '设备运行时长','采集时间'], - data: [ - ['行1列1', '行1列2', '行1列3', '行1列4', '行1列5', '行1列6','行1列7', '行1列8'], - ['行2列1', '行2列2', '行2列3', '行2列4', '行2列5', '行2列6','行2列7', '行2列8'], - ['行3列1', '行3列2', '行3列3', '行3列4', '行3列5', '行3列6','行3列7', '行3列8'], - ['行4列1', '行4列2', '行4列3', '行4列4', '行4列5', '行4列6','行4列7', '行4列8'], - ['行5列1', '行5列2', '行5列3', '行5列4', '行5列5', '行5列6','行5列7', '行5列8'], - ['行6列1', '行6列2', '行6列3', '行6列4', '行6列5', '行6列6','行6列7', '行6列8'], - ['行7列1', '行7列2', '行7列3', '行7列4', '行7列5', '行7列6','行7列7', '行7列8'], - ['行8列1', '行8列2', '行8列3', '行8列4', '行8列5', '行8列6','行8列7', '行8列8'], - ['行9列1', '行9列2', '行9列3', '行9列4', '行9列5', '行9列6','行9列7', '行9列8'], - ['行10列1', '行10列2', '行10列3', '行10列4', '行10列5', '行10列6','行10列7', '行10列8'] - ], - headerBGC:'#f8f8f9', - headerHeight:60, - oddRowBGC:'#f5f7fa', - evenRowBGC:'#fff', - }, + totalAlerts: 111, + activeAlerts: 42, + resolvedAlerts: 69, + lastUpdate: new Date().toLocaleString(), + devices: [ + { id: 1, name: 'Forecasts', description: '预测分析系统', status: 'normal', icon: 'fas fa-chart-line' }, + { id: 2, name: 'Gold', description: '核心处理单元', status: 'warning', icon: 'fas fa-server' }, + { id: 3, name: 'Industries', description: '工业控制系统', status: 'normal', icon: 'fas fa-industry' } + ], alerts: [ - { - time: '2021-10-16 14:54:11', - deviceName: 'PLC远程监控系统', - deviceLocation: '污水处理监控系统', - level: 1, - message: '2#电机运行状态等于1', - status: '触发值: 1' - }, - { - time: '2021-10-16 14:54:04', - deviceName: 'PLC远程监控系统', - deviceLocation: '污水处理监控系统', - level: 0, - message: '2#电机运行状态报警恢复', - status: '触发值: 0' - }, - { - time: '2021-10-16 14:54:11', - deviceName: 'PLC远程监控系统', - deviceLocation: '污水处理监控系统', - level: 1, - message: '2#电机运行状态等于1', - status: '触发值: 1' - }, - { - time: '2021-10-16 14:54:04', - deviceName: 'PLC远程监控系统', - deviceLocation: '污水处理监控系统', - level: 0, - message: '2#电机运行状态报警恢复', - status: '触发值: 0' - }, - // 可以继续添加更多预警信息 + { + id: 1, + deviceName: 'PLC远程监控系统', + time: '2021-10-16 14:54:11', + location: '污水处理监控系统', + message: '2#电机运行状态等于1', + level: 1, + status: 'warning', + icon: 'fas fa-exclamation-circle' + }, + { + id: 2, + deviceName: 'PLC远程监控系统', + time: '2021-10-16 14:54:04', + location: '污水处理监控系统', + message: '2#电机运行状态报警恢复', + level: 0, + status: 'normal', + icon: 'fas fa-check-circle' + } + ], + tableHeaders: ['设备名称', '设备位置', 'CPU使用率', '内存使用率', '温度', '健康度', '设备运行时长', '采集时间'], + deviceStatus: [ + { + id: 1, + name: 'PLC控制系统', + location: '主控室A区', + cpuUsage: 45, + memoryUsage: 62, + temperature: 42, + health: 85, + uptime: '125天8小时', + collectionTime: '2021-10-16 15:20:00' + }, + { + id: 2, + name: '数据采集器', + location: '污水处理区', + cpuUsage: 78, + memoryUsage: 85, + temperature: 58, + health: 65, + uptime: '89天12小时', + collectionTime: '2021-10-16 15:22:00' + }, + { + id: 3, + name: '监控服务器', + location: '数据中心', + cpuUsage: 32, + memoryUsage: 45, + temperature: 38, + health: 92, + uptime: '210天3小时', + collectionTime: '2021-10-16 15:25:00' + }, + { + id: 4, + name: '网络交换机', + location: '通信机房', + cpuUsage: 15, + memoryUsage: 28, + temperature: 35, + health: 95, + uptime: '156天7小时', + collectionTime: '2021-10-16 15:18:00' + } ] } }, methods: { - handleSetLineChartData(type) { - this.lineChartData = lineChartData[type] + getCpuStatus(usage) { + if (usage < 50) return 'status-indicator status-good'; + if (usage < 80) return 'status-indicator status-warning'; + return 'status-indicator status-critical'; }, - getLevelColor(level) { - const levelColors = { - 0: 'green', - 1: 'orange', - 2: 'red' - }; - return levelColors[level] || 'black'; // 默认颜色 + getMemoryStatus(usage) { + if (usage < 60) return 'status-indicator status-good'; + if (usage < 85) return 'status-indicator status-warning'; + return 'status-indicator status-critical'; + }, + getHealthStatus(health) { + if (health >= 80) return 'health-good'; + if (health >= 60) return 'health-warning'; + return 'health-critical'; } } } From 676768eb780debade859b7fb4e6d77533be7e41d Mon Sep 17 00:00:00 2001 From: YYD-YY <2962062657@qq.com> Date: Mon, 6 Oct 2025 15:50:46 +0800 Subject: [PATCH 3/5] =?UTF-8?q?10.6=E4=BF=AE=E6=94=B9=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equManagement/EquBaseController.java | 13 +++++++- .../domain/dto/MonitorStatisticDto.java | 5 +++ .../service/impl/EquBaseServiceImpl.java | 31 ++++++++++++++++++- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/EquBaseController.java b/ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/EquBaseController.java index aced313e..5f3d6fbd 100644 --- a/ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/EquBaseController.java +++ b/ALOps_sys_backend/alops-admin/src/main/java/com/alops/web/controller/equManagement/EquBaseController.java @@ -1,7 +1,9 @@ package com.alops.web.controller.equManagement; import java.io.IOException; +import java.util.HashMap; import java.util.List; +import java.util.Map; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletResponse; @@ -105,9 +107,18 @@ public class EquBaseController extends BaseController @ApiOperation("按设备类型分类统计设备信息") public AjaxResult listMonitorInfoByType() { List list = equBaseService.selectEquStatisticByType(); - return AjaxResult.success("查询成功", list); + // 获取总设备数 + int totalCount = 0; + if (list != null) { + totalCount = list.stream().mapToInt(MonitorStatisticDto::getCount).sum(); + } + Map result = new HashMap<>(); + result.put("totalCount", totalCount); + result.put("list", list); + return AjaxResult.success("查询成功", result); } + /** * 获取设备基本信息详细信息 */ diff --git a/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/dto/MonitorStatisticDto.java b/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/dto/MonitorStatisticDto.java index cc27f6f1..6f9fb488 100644 --- a/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/dto/MonitorStatisticDto.java +++ b/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/dto/MonitorStatisticDto.java @@ -11,6 +11,11 @@ public class MonitorStatisticDto { private String equTypeName; // 设备类型名称 private List devices; // 属于该类型的设备列表 + // 新增统计数量字段 + private Integer count; + // 每类型占总设备数量的百分比 + private Double percentage; + @Data public static class DeviceSimpleInfo { private String id; diff --git a/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/EquBaseServiceImpl.java b/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/EquBaseServiceImpl.java index 0bf77d1b..8a046847 100644 --- a/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/EquBaseServiceImpl.java +++ b/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/service/impl/EquBaseServiceImpl.java @@ -141,11 +141,40 @@ public class EquBaseServiceImpl implements IEquBaseService /** * 设备类型分类统计信息 **/ + @Override public List selectEquStatisticByType() { - return equBaseMapper.selectEquStatisticByType(); + List list = equBaseMapper.selectEquStatisticByType(); + if (list == null || list.isEmpty()) { + return list; + } + + // 计算每种类型的数量 + int totalCount = 0; + for (MonitorStatisticDto dto : list) { + int count = (dto.getDevices() != null) ? dto.getDevices().size() : 0; + dto.setCount(count); + totalCount += count; + } + + // 计算百分比 + for (MonitorStatisticDto dto : list) { + if (totalCount > 0) { + double percent = (dto.getCount() * 100.0) / totalCount; + dto.setPercentage(Math.round(percent * 100.0) / 100.0); // 保留两位小数 + } else { + dto.setPercentage(0.0); + } + } + this.totalDeviceCount = totalCount; // 注意:你可以在 service 中定义字段存储 + return list; } + // 在类中增加: + private int totalDeviceCount; + public int getTotalDeviceCount() { + return totalDeviceCount; + } /** From d38d142a3699c87a8d6e5bf08fba58fa768e22f7 Mon Sep 17 00:00:00 2001 From: YYD-YY <2962062657@qq.com> Date: Mon, 6 Oct 2025 16:11:27 +0800 Subject: [PATCH 4/5] =?UTF-8?q?10.6=E4=BF=AE=E6=AD=A3=E9=A2=84=E8=AD=A6?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/alops/system/domain/AlertMessage.java | 3 ++- .../src/main/resources/mapper/system/AlertMessageMapper.xml | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/AlertMessage.java b/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/AlertMessage.java index c80ad07f..a6bf00be 100644 --- a/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/AlertMessage.java +++ b/ALOps_sys_backend/alops-system/src/main/java/com/alops/system/domain/AlertMessage.java @@ -70,7 +70,8 @@ public class AlertMessage @Excel(name = "信息批次") private Integer batch; - + @Excel(name ="预警信息") + private String message; diff --git a/ALOps_sys_backend/alops-system/src/main/resources/mapper/system/AlertMessageMapper.xml b/ALOps_sys_backend/alops-system/src/main/resources/mapper/system/AlertMessageMapper.xml index d748818f..4c95da90 100644 --- a/ALOps_sys_backend/alops-system/src/main/resources/mapper/system/AlertMessageMapper.xml +++ b/ALOps_sys_backend/alops-system/src/main/resources/mapper/system/AlertMessageMapper.xml @@ -19,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + From 5cd5dfb78fba3c7517087212b3916f67c9d0ee30 Mon Sep 17 00:00:00 2001 From: YYD-YY <2962062657@qq.com> Date: Mon, 6 Oct 2025 16:13:41 +0800 Subject: [PATCH 5/5] =?UTF-8?q?10.6=E4=BF=AE=E6=AD=A3=E9=A2=84=E8=AD=A6?= =?UTF-8?q?=E4=BF=A1=E6=81=AF2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/system/AlertMessageMapper.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ALOps_sys_backend/alops-system/src/main/resources/mapper/system/AlertMessageMapper.xml b/ALOps_sys_backend/alops-system/src/main/resources/mapper/system/AlertMessageMapper.xml index 4c95da90..4e77ec62 100644 --- a/ALOps_sys_backend/alops-system/src/main/resources/mapper/system/AlertMessageMapper.xml +++ b/ALOps_sys_backend/alops-system/src/main/resources/mapper/system/AlertMessageMapper.xml @@ -52,7 +52,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" am.handler, am.handle_time, am.status, - am.batch + am.batch, + am.message FROM alert_message am LEFT JOIN equ_base eb ON am.equ_id = eb.id