+
)
}
\ No newline at end of file
diff --git a/src/military/qz2022/statistics/EchartPie/index.jsx b/src/military/qz2022/statistics/EchartPie/index.jsx
index 2a3df0ec..b6cd4ada 100644
--- a/src/military/qz2022/statistics/EchartPie/index.jsx
+++ b/src/military/qz2022/statistics/EchartPie/index.jsx
@@ -12,77 +12,42 @@ if (clientWidth < 1000) {
} else if (clientWidth > 3000) {
fontSizeText = 18 + (clientWidth - 3000) / 2000;
}
-let fontSizeTitle = 1.25 * fontSizeText;
-
-
-export default ({ id,className, title, xData, yData }) => {
+export default ({ id, className, title, dataList }) => {
useEffect(() => {
let newEchartBar = document.getElementById(id) && echarts.init(document.getElementById(id));
- let textColor = "#7988a5";
- let normalColor = "#e8e8ed";
let option = {
- color: ["#FC4567", "#2F8DF4", "#C25EC4"],
+ color: ["#fccb42", "#3b7afe", "#9b80f5"],
title: {
text: "",
- // left: "center",
- // top: "50%",
- // textStyle: {
- // fontSize: 22,
- // color: textColor,
- // fontWeight: "normal",
- // },
},
tooltip: {
trigger: "item",
},
legend: {
- orient: "vertical",
- right: 20,
- top: 20,
+ icon: 'circle',
+ data: dataList.map((item) => item.name),
+ bottom: 1.5 * fontSizeText,
+ fontSize: fontSizeText,
+ itemGap: 20,
+ itemWidth: 8,
},
series: [
{
type: "pie",
roseType: "radius",
radius: ["30%", "60%"],
- data: [
- {
- value: 220,
- name: "战略方向",
- },
- {
- value: 120,
- name: "前沿技术",
- },
- {
- value: 189,
- name: "作战领域",
- },
- ],
+ data: dataList,
label: {
- normal: {
- formatter: "{font|{c}}\n{hr|}\n{font|{d}%}",
- rich: {
- font: {
- fontSize: 20,
- padding: [5, 0],
- color: "#fff",
- },
- hr: {
- height: 0,
- borderWidth: 1,
- width: "100%",
- borderColor: "#fff",
- },
- },
+ formatter: function (params) {
+ return params.name + '\n\n' + `${params.value} ${params.percent}%`;
},
+ color:'#000'
},
labelLine: {
- lineStyle: {
- color: "#fff",
- },
+ length: 10,
+ length2: 60,
},
emphasis: {
itemStyle: {
@@ -95,10 +60,10 @@ export default ({ id,className, title, xData, yData }) => {
],
};
newEchartBar && newEchartBar.setOption(option);
- }, [id, title, xData, yData])
+ }, [id, title, dataList])
return (
-
+
)
}
\ No newline at end of file
diff --git a/src/military/qz2022/statistics/index.jsx b/src/military/qz2022/statistics/index.jsx
index 1f2c9649..43c593d9 100644
--- a/src/military/qz2022/statistics/index.jsx
+++ b/src/military/qz2022/statistics/index.jsx
@@ -1,33 +1,118 @@
-import React from "react";
+import React, { useEffect, useState } from "react";
+import { stattistics } from '../api';
import './index.scss';
import '../../index.scss';
-// import EchartBar from './EchartBar';
+import statisticsSum from '../image/statistics-sum.png';
+import statisticsWork from '../image/statistics-work.png';
import EchartPie from './EchartPie';
+import EchartBar from './EchartBar';
+
+const initPieArr = [
+ {
+ value: 220,
+ name: "战略方向",
+ },
+ {
+ value: 120,
+ name: "前沿技术",
+ },
+ {
+ value: 189,
+ name: "作战领域",
+ },
+];
+
+const initLegendArr = ["战略方向", "前沿技术", "作战领域"];
-function Statistics({ form, showNotification, match, history }) {
+function Statistics({ showNotification, match, history }) {
+
+ const [pieArr, setPieArr] = useState(initPieArr);
+
+ const [barXData, setBarXData] = useState(['LJLJLJ', 'HJHJHJ', 'KJKJKJ', 'HJJHJJHJJ', 'ZLZYBD', '联勤保障', 'WJWJWJ']);
+ const [legendArr, setLegendArr] = useState(initLegendArr);
+ const [barYData, setBarYData] = useState([[3, 2, 3, 4, 2, 4, 7, 5], [3, 2, 3, 4, 7, 2, 4, 5], [3, 2, 2, 3, 4, 2, 4, 5]]);
+
+ useEffect(() => {
+ stattistics().then(res => {
+ if (res && Array.isArray(res.data)) {
+
+ let pieArrList = [];
+ let xData = [];
+ let yData1 = [], yData2 = [], yData3 = [];
+ let barYDataArr = [];
+ res.data.forEach(i => {
+ i[0]&&xData.push(i[0].split('分赛区')[0]);
+ yData1.push(i[1]);
+ yData2.push(i[2]);
+ yData3.push(i[3]);
+ });
+
+ setLegendArr(res.competition_subs);
+ setBarXData(xData);
+
+ barYDataArr[0] = yData1;
+ barYDataArr[1] = yData2;
+ barYDataArr[2] = yData3;
+ // setBarYData(barYData);
+
+ let yData = [];
+ yData.push(yData1.reduce((pre, current) => { return pre + current }, 0));
+ yData.push(yData2.reduce((pre, current) => { return pre + current }, 0));
+ yData.push(yData3.reduce((pre, current) => { return pre + current }, 0));
+ res.competition_subs.forEach((item, index) => {
+ pieArrList.push({
+ name: item,
+ value: yData[index],
+ })
+ });
+ setPieArr(pieArrList);
+ }
+ });
+ }, []);
+
return (
-
竞赛总报名数
-
竞赛总报名数
+

+
+
+
+
+

+
- {/*
*/}
+
+ {/* 外网 */}
+ {/*
+
综合赛区报名数
- {/*
*/}
+
+ {/* 内网 */}
+
+ */}
- {/*
*/}
+ title=""
+ legendArr={legendArr}
+ xData={barXData}
+ yData={barYData}
+ />
+
)
}
diff --git a/src/military/qz2022/statistics/index.scss b/src/military/qz2022/statistics/index.scss
index cf0b9a52..7ba468dd 100644
--- a/src/military/qz2022/statistics/index.scss
+++ b/src/military/qz2022/statistics/index.scss
@@ -1,11 +1,69 @@
.statistics {
display: flex;
+ margin: 3rem auto;
.statistics-words {
- width: 16.25%;
+ width: 30%;
margin-right: 1rem;
}
- .echart-box {
- width: 50vw;
+
+ .num-item {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ height: 12.25rem;
+ background-color: #ffffff;
+
+ &.sum {
+ border: 2px solid #2e5bfe;
+ box-shadow: 0px 3px 12px #ecf0ff;
+ margin-bottom: 1rem;
+
+ .num-data {
+ color: #2e5bfe;
+ }
+ }
+
+ img {
+ width: 5.125rem;
+ margin-right: 1.75rem;
+ }
+
+ .num-data {
+ font-weight: 700;
+ font-size: 3rem;
+ line-height: 1.4em;
+ border-bottom: 1px solid #d7dbe1;
+ }
+
+ .num-tit {
+ color: #090909;
+ }
+ }
+
+ .right-echart {
+ flex: auto;
+ background: #fff;
+
+ .echart-box {
+ width: 100%;
+ height: 100%;
+ }
+
+ &.outside {
+ padding: 0 1.75rem 0 1.25rem;
+
+ .echart-box {
+ height: calc(100% - 3.5rem);
+ }
+ }
+ }
+
+ .type-name {
+ color: #333333;
+ font-size: 1rem;
+ line-height: 3.5rem;
+ border-bottom: 1px solid rgba(153, 153, 153, 0.2);
+ box-sizing: border-box;
}
}