From daf7b79cf8dd5378093de073b7f2389b69a1eccf Mon Sep 17 00:00:00 2001 From: zjlnb666 <14659021+zhangjianlong666@user.noreply.gitee.com> Date: Mon, 15 Sep 2025 09:05:03 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=90=E6=82=A3=E6=8E=92=E6=9F=A5=E7=BB=93?= =?UTF-8?q?=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HiddenTrouble.js | 6 +- .../HiddenTrouble.less | 39 +++++ .../component/MyCard.js | 136 ++++++++++++++++++ .../hiddenDangerInspection.js | 19 ++- .../hiddenDangerInspection.less | 3 + 5 files changed, 197 insertions(+), 6 deletions(-) create mode 100644 src/pages/hrefficiency_hiddentrouble/HiddenTrouble.less create mode 100644 src/pages/hrefficiency_hiddentrouble/component/hiddenDangerInspection/hiddenDangerInspection.less diff --git a/src/pages/hrefficiency_hiddentrouble/HiddenTrouble.js b/src/pages/hrefficiency_hiddentrouble/HiddenTrouble.js index e5945e0..ca32994 100644 --- a/src/pages/hrefficiency_hiddentrouble/HiddenTrouble.js +++ b/src/pages/hrefficiency_hiddentrouble/HiddenTrouble.js @@ -1,7 +1,7 @@ import MyCard from "@/pages/hrefficiency_hiddentrouble/component/MyCard"; import {Col, Row, Tabs} from "antd"; -import HiddenDangerInspection - from "@/pages/hrefficiency_hiddentrouble/component/hiddenDangerInspection/hiddenDangerInspection"; +import HiddenDangerInspection from "@/pages/hrefficiency_hiddentrouble/component/hiddenDangerInspection/hiddenDangerInspection"; +import './HiddenTrouble.less' const items = [ { @@ -23,7 +23,7 @@ const items = [ const HiddenTrouble = () => { return ( <> - + ) } diff --git a/src/pages/hrefficiency_hiddentrouble/HiddenTrouble.less b/src/pages/hrefficiency_hiddentrouble/HiddenTrouble.less new file mode 100644 index 0000000..99ae521 --- /dev/null +++ b/src/pages/hrefficiency_hiddentrouble/HiddenTrouble.less @@ -0,0 +1,39 @@ +/* 移除下滑线 */ +.custom-tabs .ant-tabs-ink-bar { + display: none !important; +} + +/* 未选中状态 */ +.custom-tabs .ant-tabs-tab { + background: #f0f0f0 !important; + border: none !important; + border-radius: 6px !important; + margin-right: 8px !important; + padding: 8px 16px !important; + transition: all 0.3s ease !important; +} + +/* 选中状态 - 背景变为蓝色 */ +.custom-tabs .ant-tabs-tab-active { + background: #2E4CD4 !important; +} + +/* 选中状态 - 文字变为白色 */ +.custom-tabs .ant-tabs-tab-active .ant-tabs-tab-btn { + color: white !important; + font-weight: 500 !important; +} + +/* 移除底部边框 */ +.custom-tabs .ant-tabs-nav::before { + border-bottom: none !important; +} + +/* 悬停效果 */ +.custom-tabs .ant-tabs-tab:hover { + background: #e6e6e6 !important; +} + +.custom-tabs .ant-tabs-tab-active:hover { + background: #40a9ff !important; +} diff --git a/src/pages/hrefficiency_hiddentrouble/component/MyCard.js b/src/pages/hrefficiency_hiddentrouble/component/MyCard.js index c78c8f6..251682d 100644 --- a/src/pages/hrefficiency_hiddentrouble/component/MyCard.js +++ b/src/pages/hrefficiency_hiddentrouble/component/MyCard.js @@ -1,4 +1,8 @@ import Icon from "antd/es/icon"; +import {Col, Row} from "antd"; +import {Descriptions} from "antd"; +import * as echarts from 'echarts'; +import {useEffect, useRef} from "react"; const HourglassSvg=()=>{ return ( @@ -46,4 +50,136 @@ const MyCard = (props) => { ) } + +const items = [ + { + key: '1', + children: '设备安全', + color:'#868BF9', + }, + { + key: '2', + children: '电气安全', + color:'#F29629', + }, + { + key: '3', + children: '消防安全', + color:'#FFD85A', + }, + { + key: '4', + children: '工艺安全', + color:'#5ED6BE', + }, + { + key: '5', + children: '储罐专业', + color:'#00AAFF', + }, + { + key: '6', + children: '其他', + color:'#5FDCF7', + }, +]; + + +export const PieChart=()=>{ + const chartRef=useRef(null) + const data=[ + { value: 5, name: '设备安全' ,itemStyle:{color:'#868BF9'}}, + { value: 5, name: '电气安全',itemStyle:{color:'#F29629'} }, + { value: 10, name: '消防安全' ,itemStyle:{color:'#FFD85A'}}, + { value: 20, name: '工艺安全',itemStyle:{color:'#5ED6BE'} }, + { value: 30, name: '储罐专业',itemStyle:{color:'#00AAFF'} }, + { value: 30, name:'其他',itemStyle:{color:'#5FDCF7'}} + ] + useEffect(() => { + const chart=echarts.init(chartRef.current) + const option = { + legend: { + show:false, + orient: 'vertical', + x: 'left', + data: ['设备安全', '电气安全', '消防安全', '工艺安全', '储罐专业','其他'] + }, + series: [ + { + type: 'pie', + radius: ['50%', '70%'], + avoidLabelOverlap: false, + label: { + show: true, + formatter: '{d}%', + position: 'outsider', + }, + labelLine: { + show: true + }, + emphasis: { + label: { + show: true, + position:'center', + fontSize: '15', + fontWeight: 'bold', + formatter: function(params) { + return `${params.name}\n${params.percent}%`; + }, + + } + }, + data:data, + }, + ] + }; + chart.setOption(option) + // 响应式调整 + const handleResize = () => { + chart.resize(); + }; + + window.addEventListener('resize', handleResize); + + // 清理函数 + return () => { + window.removeEventListener('resize', handleResize); + chart.dispose(); + }; + }, []); + + return( +
+ + + 检查领域分布} + column={2} + > + {items.map((item)=>{ + return( + +
+ + {item.children} +
+
+ ) + })} + + +
+ + + +
+ +
+ +
+
+ ) +} export default MyCard; diff --git a/src/pages/hrefficiency_hiddentrouble/component/hiddenDangerInspection/hiddenDangerInspection.js b/src/pages/hrefficiency_hiddentrouble/component/hiddenDangerInspection/hiddenDangerInspection.js index ec742a0..6d38248 100644 --- a/src/pages/hrefficiency_hiddentrouble/component/hiddenDangerInspection/hiddenDangerInspection.js +++ b/src/pages/hrefficiency_hiddentrouble/component/hiddenDangerInspection/hiddenDangerInspection.js @@ -1,5 +1,6 @@ import {Col, Row} from "antd"; -import MyCard from "@/pages/hrefficiency_hiddentrouble/component/MyCard"; +import './hiddenDangerInspection.less' +import MyCard, {PieChart} from "@/pages/hrefficiency_hiddentrouble/component/MyCard"; const dataList=[ { title:'隐患总数', @@ -38,16 +39,28 @@ const dataList=[ color:'#FF3E48', } ] + + const HiddenDangerInspection=()=>{ return( - <> -
+ < > +
{dataList.map((item) => { return })}
+
+ + + + + + +
+ + ) } diff --git a/src/pages/hrefficiency_hiddentrouble/component/hiddenDangerInspection/hiddenDangerInspection.less b/src/pages/hrefficiency_hiddentrouble/component/hiddenDangerInspection/hiddenDangerInspection.less new file mode 100644 index 0000000..b28b04f --- /dev/null +++ b/src/pages/hrefficiency_hiddentrouble/component/hiddenDangerInspection/hiddenDangerInspection.less @@ -0,0 +1,3 @@ + + +