From 2b91701228bc62446690d437895337a3469dad04 Mon Sep 17 00:00:00 2001 From: wangyunfei <1224056307@qq,com> Date: Thu, 25 Sep 2025 15:45:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/OnlineMonitoring.js | 139 ++++++++++++++++-- .../module/OnlineMonitoring.less | 94 ++++++++++-- 2 files changed, 210 insertions(+), 23 deletions(-) diff --git a/src/pages/safe_majorHazard/module/OnlineMonitoring.js b/src/pages/safe_majorHazard/module/OnlineMonitoring.js index 73e9d43..e97c4f8 100644 --- a/src/pages/safe_majorHazard/module/OnlineMonitoring.js +++ b/src/pages/safe_majorHazard/module/OnlineMonitoring.js @@ -1,6 +1,7 @@ -import React from 'react'; -import { Card, Result } from 'antd'; +import React, { useEffect, useRef } from 'react'; +import { Card, Result, Select } from 'antd'; +import * as echarts from 'echarts'; import styles from './OnlineMonitoring.less'; import alarm0 from '@/assets/safe_majorHazard/online_monitoring/alarm0.png'; @@ -11,11 +12,109 @@ import alarm3 from '@/assets/safe_majorHazard/online_monitoring/alarm3.png'; const OnlineMonitoring = () => { + const chartRef = useRef(null); + + useEffect(() => { + if (chartRef.current) { + const chart = echarts.init(chartRef.current); + + const option = { + color: ['#04A7F3', '#E7C42C', '#EC6941'], + title: { + // text: '实时监测数据', + left: 'center', + // textStyle: { + // fontSize: 14, + // color: '#333' + // } + }, + tooltip: { + trigger: 'axis', + axisPointer: { + type: 'cross', + label: { + backgroundColor: '#6a7985' + } + } + }, + legend: { + data: ['液位', '温度', '压力'], + top: 0 + }, + grid: { + left: '3%', + right: '4%', + bottom: '3%', + top: '0%', + containLabel: true + }, + xAxis: { + type: 'category', + boundaryGap: false, + data: ['0:00', '2:00', '4:00', '6:00', '8:00', '10:00', '12:00', '14:00', '16:00', '18:00', '20:00', '22:00', '24:00'] + }, + yAxis: { + type: 'value', + min: 0, + max: 900, + axisLabel: { + formatter: '{value}' + } + }, + series: [ + { + name: '液位', + type: 'line', + smooth: true, + lineStyle: { + width: 1.5, + color: '#04A7F3' + }, + data: [120, 200, 150, 300, 250, 400, 350, 280, 320, 180, 220, 160, 140] + }, + { + name: '温度', + type: 'line', + smooth: true, + lineStyle: { + width: 1.5, + color: '#E7C42C' + }, + data: [80, 120, 100, 180, 160, 220, 200, 150, 170, 90, 110, 85, 75] + }, + { + name: '压力', + type: 'line', + smooth: true, + lineStyle: { + width: 1.5, + color: '#EC6941' + }, + data: [200, 300, 250, 450, 400, 600, 550, 420, 480, 280, 320, 260, 240] + } + ] + }; + + chart.setOption(option); + + // 响应式调整 + const handleResize = () => { + chart.resize(); + }; + window.addEventListener('resize', handleResize); + + return () => { + window.removeEventListener('resize', handleResize); + chart.dispose(); + }; + } + }, []); + return ( -
-
-
-
+
+
+
+
alarm0 @@ -85,11 +184,33 @@ const OnlineMonitoring = () => {
-
+
+
+
+
+
预警看板
+
+
+
检测对象
+