diff --git a/src/pages/Container/Map/components/Content/branchOffice/MenJin/echarts.js b/src/pages/Container/Map/components/Content/branchOffice/MenJin/echarts.js index 1bc1528..b0522dd 100644 --- a/src/pages/Container/Map/components/Content/branchOffice/MenJin/echarts.js +++ b/src/pages/Container/Map/components/Content/branchOffice/MenJin/echarts.js @@ -8,7 +8,6 @@ export const initEcharts1 = (mainRef, chartInstance, data) => { const names = data.map(item => item.NAME); const option = { - color: ["#1A64F8"], tooltip: { trigger: "axis", axisPointer: { diff --git a/src/pages/Container/Map/components/Content/branchOffice/RenYuan/echarts.js b/src/pages/Container/Map/components/Content/branchOffice/RenYuan/echarts.js index fbecd1d..ae0bcdf 100644 --- a/src/pages/Container/Map/components/Content/branchOffice/RenYuan/echarts.js +++ b/src/pages/Container/Map/components/Content/branchOffice/RenYuan/echarts.js @@ -39,7 +39,6 @@ export const initEcharts2 = (mainRef, chartInstance, data) => { const names = data.map(item => item.name); const option = { - color: ["#1A64F8"], tooltip: { trigger: "axis", axisPointer: { diff --git a/src/pages/Container/Map/components/Content/branchOffice/ZhongDian/echarts.js b/src/pages/Container/Map/components/Content/branchOffice/ZhongDian/echarts.js new file mode 100644 index 0000000..f3eaf9a --- /dev/null +++ b/src/pages/Container/Map/components/Content/branchOffice/ZhongDian/echarts.js @@ -0,0 +1,131 @@ +import * as echarts from "echarts"; + +export const initEcharts1 = (mainRef, chartInstance, data) => { + chartInstance.current = echarts.init(mainRef.current); + + const waitStartData = data.map(item => Number.parseInt(item.WAIT_START)); + const inProgressData = data.map(item => Number.parseInt(item.IN_PROGRESS)); + const names = data.map(item => item.NAME); + + const option = { + tooltip: { + trigger: "axis", + axisPointer: { + type: "none", + }, + }, + legend: { + data: ["待开工项目数", "进行中项目数"], + top: "0%", + right: "0%", + textStyle: { + color: "#fff", + fontSize: 14, + }, + itemWidth: 12, + itemHeight: 10, + }, + dataZoom: [ + { + type: "slider", + height: 6, + bottom: "7%", + show: true, + start: 0, + end: 50, + handleSize: 5, + handleStyle: { + color: "#DCE2E8", + }, + xAxisIndex: [0], + filterMode: "filter", + showDetail: false, + }, + ], + grid: { + left: "10%", + right: "5%", + top: "10%", + bottom: "20%", + }, + xAxis: [ + { + type: "category", + data: names, + axisTick: { + alignWithLabel: true, + }, + axisLabel: { + color: "#fff", + }, + }, + ], + yAxis: { + axisLine: { + show: false, + }, + axisTick: { + show: false, + }, + axisLabel: { + color: "#fff", + }, + splitLine: { + show: true, + lineStyle: { + type: "dashed", + }, + }, + }, + series: [ + { + name: "待开工项目数", + type: "bar", + backgroundStyle: { + color: "rgba(216, 229, 247, 0.55)", + borderRadius: [8, 8, 0, 0], + }, + itemStyle: { + borderRadius: [12, 12, 0, 0], + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { + offset: 1, + color: "rgba(0,168,255,0.7)", + }, + { + offset: 0, + color: "#00A8FF", + }, + ]), + }, + barWidth: "10", + data: waitStartData, + }, + { + name: "进行中项目数", + type: "bar", + backgroundStyle: { + color: "rgba(216, 229, 247, 0.55)", + borderRadius: [8, 8, 0, 0], + }, + itemStyle: { + borderRadius: [12, 12, 0, 0], + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { + offset: 1, + color: "rgba(255,198,124,0.7)", + }, + { + offset: 0, + color: "#FFC67C", + }, + ]), + }, + barWidth: "10", + data: inProgressData, + }, + ], + }; + + chartInstance.current.setOption(option); +}; diff --git a/src/pages/Container/Map/components/Content/branchOffice/ZhongDian/index.js b/src/pages/Container/Map/components/Content/branchOffice/ZhongDian/index.js new file mode 100644 index 0000000..c26e627 --- /dev/null +++ b/src/pages/Container/Map/components/Content/branchOffice/ZhongDian/index.js @@ -0,0 +1,122 @@ +import { useMount } from "ahooks"; +import { useRef, useState } from "react"; +import CountUp from "react-countup"; +import SeamlessScroll from "zy-react-library/components/SeamlessScroll"; +import AliPlayer from "zy-react-library/components/Video/AliPlayer"; +import icon1 from "~/assets/images/map_bi/content/ico19.png"; +import Title from "~/pages/Container/Map/components/Content/branchOffice/Title"; +import { initEcharts1 } from "./echarts"; +import "./index.less"; + +function ZhongDian() { + const [block1List, setBlock1List] = useState([ + { label: "项目总数", value: 34, icon: icon1 }, + { label: "待开工项目数", value: 34, icon: icon1 }, + { label: "进行中项目数", value: 34, icon: icon1 }, + ]); + const [block3List, setBlock3List] = useState([ + { projectName: "北京地铁17号线工程", contractor: "中建一局", inspections: 25, hazards: 3, penaltyAmount: 15000 }, + { projectName: "上海浦东国际机场扩建", contractor: "中铁建工", inspections: 32, hazards: 5, penaltyAmount: 25000 }, + { projectName: "广州南沙大桥建设", contractor: "中交一航", inspections: 18, hazards: 2, penaltyAmount: 12000 }, + { projectName: "深圳国际会展中心", contractor: "中建三局", inspections: 45, hazards: 8, penaltyAmount: 35000 }, + { projectName: "杭州亚运会场馆改造", contractor: "中国建筑", inspections: 28, hazards: 4, penaltyAmount: 18000 }, + { projectName: "成都天府国际机场", contractor: "中冶集团", inspections: 38, hazards: 6, penaltyAmount: 28000 }, + { projectName: "武汉长江隧道工程", contractor: "中电建", inspections: 22, hazards: 1, penaltyAmount: 8000 }, + { projectName: "西安高新区基础设施", contractor: "中石化建设", inspections: 41, hazards: 7, penaltyAmount: 32000 }, + { projectName: "南京长江大桥维修", contractor: "中国化学", inspections: 15, hazards: 2, penaltyAmount: 10000 }, + { projectName: "重庆轨道交通5号线", contractor: "中国铁建", inspections: 35, hazards: 4, penaltyAmount: 20000 }, + ]); + + const chartInstance = useRef(null); + const main1Ref = useRef(null); + + useMount(() => { + initEcharts1(main1Ref, chartInstance, [ + { NAME: "中建一局", WAIT_START: "12", IN_PROGRESS: "8" }, + { NAME: "中铁建工", WAIT_START: "15", IN_PROGRESS: "10" }, + { NAME: "中交一航", WAIT_START: "8", IN_PROGRESS: "12" }, + { NAME: "中建三局", WAIT_START: "20", IN_PROGRESS: "15" }, + { NAME: "中国建筑", WAIT_START: "5", IN_PROGRESS: "7" }, + { NAME: "中冶集团", WAIT_START: "18", IN_PROGRESS: "14" }, + { NAME: "中电建", WAIT_START: "10", IN_PROGRESS: "9" }, + { NAME: "中石化建设", WAIT_START: "22", IN_PROGRESS: "18" }, + { NAME: "中国化学", WAIT_START: "7", IN_PROGRESS: "5" }, + { NAME: "中国铁建", WAIT_START: "16", IN_PROGRESS: "13" }, + ]); + + return () => { + if (chartInstance.current) { + chartInstance.current.dispose(); + chartInstance.current = null; + } + }; + }); + + return ( +