diff --git a/src/pages/ElecEvaluation/MonitorScreen/Home/index.tsx b/src/pages/ElecEvaluation/MonitorScreen/Home/index.tsx
index 98908ca..704c4b0 100644
--- a/src/pages/ElecEvaluation/MonitorScreen/Home/index.tsx
+++ b/src/pages/ElecEvaluation/MonitorScreen/Home/index.tsx
@@ -56,7 +56,7 @@ export const proviceEnum = {
"001000": "集团"
}
function dealWithData() {
- var geoCoordMap = {
+ let geoCoordMap = {
长春: [125.35, 43.88, 20],
沈阳: [123.38, 41.8, 19],
集团: [116.26, 39.92, 18],
@@ -89,8 +89,8 @@ function dealWithData() {
合肥: [117.27, 31.86, 10],
武汉: [114.31, 30.52, 10],
};
- var data = [];
- for (var key in geoCoordMap) {
+ let data = [];
+ for (let key in geoCoordMap) {
data.push({ name: key, value: geoCoordMap[key] });
}
return data;
@@ -152,10 +152,17 @@ export const LocalTime = () => {
当前时间:{time}
)
}
-
+/**
+ * 评标室项目情况-跳转
+ */
const projectClick = () => {
history.push("/ElecMonitorScreen/MonitorRoom");
}
+/**
+ * echarts图表
+ * @param props
+ * @returns
+ */
const GraphChart = (props: { type: string, chartData: any[] }) => {
const { type, chartData } = props;
const random = Math.random().toString();
@@ -176,9 +183,9 @@ const GraphChart = (props: { type: string, chartData: any[] }) => {
// to a column of dataset.source by default.
series: [{ type: 'bar' }, { type: 'bar' }]
};
- var dataValue = dealWithData();
- var data1 = dataValue.splice(0, 3);
- var index = 0;
+ let dataValue = dealWithData();
+ let data1 = dataValue.splice(0, 3);
+ let index = 0;
const autoTooltip = () => {
const dataLength = data1.length;
setTimeout(() => {
@@ -202,17 +209,30 @@ const GraphChart = (props: { type: string, chartData: any[] }) => {
orient: 'vertical',
right: '3%',
top: 'middle',
- textStyle: { color: '#fff' }
+ textStyle: { color: '#fff' },
+ icon: 'circle',
+ formatter: (name) => {
+ let total = 0; // 用于计算总数
+ let target; // 遍历拿到数据
+ for (let i = 0, chartLength = chartData.length; i < chartLength; i++) {
+ total += chartData[i].value;
+ if (chartData[i].name == name) {
+ target = chartData[i].value;
+ }
+ }
+ let v = ((target / total) * 100).toFixed(0);
+ return `${name} ${target}个,占比${v}%`;
+ },
},
- tooltip: {},
- dataset: {
- source: chartData
+ tooltip: {
+ trigger: 'item'
},
series: [
{
type: 'pie',
radius: ['40%', '70%'],
- center: ['15%', '50%'],
+ center: ['30%', '50%'],
+ avoidLabelOverlap: false,
label: {
show: false,
position: 'center'
@@ -225,52 +245,10 @@ const GraphChart = (props: { type: string, chartData: any[] }) => {
color: '#fff'
}
},
- encode: {
- itemName: 'product',
- value: 'reserve'
- }
- },
- {
- type: 'pie',
- radius: ['40%', '70%'],
- center: ['45%', '50%'],
- label: {
- show: false,
- position: 'center'
+ labelLine: {
+ show: false
},
- emphasis: {
- label: {
- show: true,
- fontSize: '20px',
- fontWeight: 'bold',
- color: '#fff'
- }
- },
- encode: {
- itemName: 'product',
- value: 'ing'
- }
- },
- {
- type: 'pie',
- radius: ['40%', '70%'],
- center: ['75%', '50%'],
- label: {
- show: false,
- position: 'center'
- },
- emphasis: {
- label: {
- show: true,
- fontSize: '20px',
- fontWeight: 'bold',
- color: '#fff'
- }
- },
- encode: {
- itemName: 'product',
- value: 'end'
- }
+ data: chartData,
}
]
};
@@ -418,6 +396,38 @@ export const EarlyWarn = ({ img, name, num }: { img: string, name: string, num:
)
}
+//饼图数据格式化
+const formatPieData = (data: any[]) => {
+ const list = [{ name: "招标项目", value: Number(data[0].number) + Number(data[1].number) }];//招标项目=公开招标+邀请招标
+ for (const ite of data) {
+ if (method.includes(ite.bidMethod)) {
+ list.push({ name: ite.bidMethod, value: Number(ite.number) });
+ }
+ }
+ var str = list.splice(3, 1);
+ list.push(str[0]);
+ return list;
+}
+//单个饼图
+const PieChart = (props: { data: any[], title: string }) => {
+ const { data, title } = props;
+ const pieChart = useMemo(() => {
+ if (data && data.length > 0) {
+ const pieData = formatPieData(data);
+ return