From f6d0cff0a1f5ec82175853848e7c5a7f6c2365d3 Mon Sep 17 00:00:00 2001
From: fangjiakai <450850793@qq.com>
Date: Mon, 5 Jan 2026 10:14:37 +0800
Subject: [PATCH] =?UTF-8?q?feat(bi):=20=E6=B7=BB=E5=8A=A0BI=E5=A4=A7?=
=?UTF-8?q?=E5=B1=8F=E5=B7=A6=E4=BE=A7=E9=9D=A2=E6=9D=BF=E7=BB=84=E4=BB=B6?=
=?UTF-8?q?=E5=92=8C=E4=BC=98=E5=8C=96=E7=95=8C=E9=9D=A2=E6=A0=B7=E5=BC=8F?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增NS_BI命名空间定义
- 创建左侧面板组件,包含天气预报、防汛状态、重大危险源等模块
- 实现天气预报卡片组件,集成百度天气API获取实时数据
- 添加防汛状态滚动展示功能
- 实现重大危险源监控和报警处置情况展示
- 集成ECharts图表展示领域整改情况统计
- 优化BI大屏整体布局和样式设计
- 修复气泡组件的描述字段显示问题
- 调整页面组件结构和样式间距
---
jjb.config.js | 3 +-
src/enumerate/namespace/index.js | 1 +
src/pages/Container/Bi/bubble/index.js | 10 +-
.../Container/Bi/components/leftPanel.js | 632 ++++++++++++++++
src/pages/Container/Bi/index.js | 92 +--
src/pages/Container/Bi/index.less | 684 ++++++------------
6 files changed, 910 insertions(+), 512 deletions(-)
create mode 100644 src/pages/Container/Bi/components/leftPanel.js
diff --git a/jjb.config.js b/jjb.config.js
index 3a6169e..5c1b5e2 100644
--- a/jjb.config.js
+++ b/jjb.config.js
@@ -25,7 +25,8 @@ module.exports = {
contextInject: {
// 应用Key
appKey: "",
- fileUrl: "https://jpfz.qhdsafety.com/gbsFileTest/",
+ // fileUrl: "https://jpfz.qhdsafety.com/gbsFileTest/",
+ fileUrl: "http://192.168.20.240:9787/mnt/",
},
// public/index.html注入全局变量
windowInject: {
diff --git a/src/enumerate/namespace/index.js b/src/enumerate/namespace/index.js
index 9ef763c..e5d3676 100644
--- a/src/enumerate/namespace/index.js
+++ b/src/enumerate/namespace/index.js
@@ -6,3 +6,4 @@ import { defineNamespace } from "@cqsjjb/jjb-dva-runtime";
export const NS_GLOBAL = defineNamespace("global");
+export const NS_BI = defineNamespace("bi");
\ No newline at end of file
diff --git a/src/pages/Container/Bi/bubble/index.js b/src/pages/Container/Bi/bubble/index.js
index 065cc2c..62519d2 100644
--- a/src/pages/Container/Bi/bubble/index.js
+++ b/src/pages/Container/Bi/bubble/index.js
@@ -1,12 +1,8 @@
-import React from 'react';
-import { RightOutlined } from '@ant-design/icons';
-
-import closeIcon from '../../../../assets/images/public/bigScreen/close.png';
-
+import { RightOutlined } from "@ant-design/icons";
+import closeIcon from "../../../../assets/images/public/bigScreen/close.png";
const Bubble = ({ id, title, description, onClose }) => {
-
const close = () => {
onClose && onClose();
};
@@ -40,4 +36,4 @@ const Bubble = ({ id, title, description, onClose }) => {
);
};
-export default Bubble;
\ No newline at end of file
+export default Bubble;
diff --git a/src/pages/Container/Bi/components/leftPanel.js b/src/pages/Container/Bi/components/leftPanel.js
new file mode 100644
index 0000000..7b6dfe0
--- /dev/null
+++ b/src/pages/Container/Bi/components/leftPanel.js
@@ -0,0 +1,632 @@
+import React, { useState, useEffect, useRef } from 'react';
+import * as echarts from 'echarts';
+import { Connect } from "@cqsjjb/jjb-dva-runtime";
+import { NS_BI } from "~/enumerate/namespace";
+
+import smallTitleImg from '../../../../assets/images/public/bigScreen/smalltitle.png'
+import temperature from '../../../../assets/images/public/bigScreen/img10.png'
+import windSpeed from '../../../../assets/images/public/bigScreen/img11.png'
+import hazardIcon from '../../../../assets/images/public/bigScreen/ico3.png'
+
+import SunIcon from '../../../../assets/images/public/weather/1.png'
+import CloudIcon from '../../../../assets/images/public/weather/2.png'
+import CloudSunIcon from '../../../../assets/images/public/weather/3.png'
+import ThunderstormIcon from '../../../../assets/images/public/weather/4.png'
+import MildRainIcon from '../../../../assets/images/public/weather/5.png'
+// 中雨 6.png
+import ModerateRainIcon from '../../../../assets/images/public/weather/6.png'
+// 大雨 7.png
+import HeavyRainIcon from '../../../../assets/images/public/weather/7.png'
+// 暴雨 8.png
+import StormRainIcon from '../../../../assets/images/public/weather/8.png'
+// 小雪 9.png
+import SnowIcon from '../../../../assets/images/public/weather/9.png'
+// 中雪 10.png
+import ModerateSnowIcon from '../../../../assets/images/public/weather/10.png'
+// 大雪 11.png
+import HeavySnowIcon from '../../../../assets/images/public/weather/11.png'
+// 雨夹雪 12.png
+import SnowRainIcon from '../../../../assets/images/public/weather/12.png'
+// 雾 13.png
+import FogIcon from '../../../../assets/images/public/weather/13.png'
+// 霾 14.png
+import HazeIcon from '../../../../assets/images/public/weather/14.png'
+// 浮尘 15.png
+import DustIcon from '../../../../assets/images/public/weather/15.png'
+// 沙尘暴 16.png
+import DuststormIcon from '../../../../assets/images/public/weather/16.png'
+
+
+
+// 天气类型与图标映射表
+const weatherIconMap = {
+ // 晴天
+ '晴天': ,
+ '晴':
,
+ // 多云
+ '多云':
,
+ '阴':
,
+ // 雷阵雨
+ '雷阵雨':
,
+ // 小雨
+ '小雨':
,
+ // 中雨
+ '中雨':
,
+ // 大雨
+ '大雨':
,
+ // 暴雨
+ '暴雨':
,
+ // 小雪
+ '小雪':
,
+ // 中雪
+ '中雪':
,
+ // 大雪
+ '大雪':
,
+ // 雨夹雪
+ '雨夹雪':
,
+ // 雾
+ '雾':
,
+ // 霾
+ '霾':
,
+ // 浮尘
+ '浮尘':
,
+ // 沙尘暴
+ '沙尘暴':
,
+ // 默认图标
+ '默认':
+};
+
+// 根据天气中文名称获取对应图标
+const getWeatherIcon = (weatherName) => {
+ // 遍历天气映射表,找到匹配的图标
+ for (const [key, icon] of Object.entries(weatherIconMap)) {
+ if (weatherName.includes(key)) {
+ return icon;
+ }
+ }
+ // 如果没有匹配的,返回默认图标
+ return weatherIconMap['默认'];
+};
+
+// 根据预警级别获取颜色
+const getAlertColor = (level) => {
+ switch (level) {
+ case '蓝色预警':
+ return '#1E90FF';
+ case '黄色预警':
+ return '#FFA500';
+ case '橙色预警':
+ return '#FF4500';
+ case '红色预警':
+ return '#FF0000';
+ default:
+ return '#fff';
+ }
+};
+
+// 天气预报卡片组件
+const WeatherCard = (props) => {
+ const [weatherData, setWeatherData] = useState({
+ text: '晴天',
+ temp: '36.5',
+ wind_class: '8级',
+ })
+ const [weatherIcon, setWeatherIcon] = useState()
+ const [alert, setAlert] = useState([])
+ const [currentAlertIndex, setCurrentAlertIndex] = useState(0)
+ useEffect(() => {
+ const fetchWeatherData = async () => {
+ try {
+ const response = await fetch('https://api.map.baidu.com/weather/v1/?district_id=130300&data_type=all&ak=dIqOi34IlTg5FkNck1vqoBpLhPAj36S1');
+ const data = await response.json();
+ setWeatherData(data.result.now);
+ setWeatherIcon(getWeatherIcon(data.result.now.text));
+ setAlert(Array.isArray(data.result.alerts) ? data.result.alerts : []);
+ } catch (error) {
+ console.error('获取天气数据失败:', error);
+ }
+ };
+
+ fetchWeatherData();
+ }, []);
+
+ // 添加定时器实现预警信息自动切换
+ useEffect(() => {
+ if (!alert?.length || alert.length <= 1) return;
+
+ const alertInterval = setInterval(() => {
+ setCurrentAlertIndex((prevIndex) =>
+ prevIndex === (alert?.length || 0) - 1 ? 0 : prevIndex + 1
+ );
+ }, 3000);
+
+ return () => clearInterval(alertInterval);
+ }, [alert?.length]);
+
+
+ return (
+
温度:
+{weatherData.temp}℃
+风速:
+{weatherData.wind_class}
+{alert[0].title}
+ ) : alert?.length > 1 ? ( ++ {item.title} +
+ ))} +