chore: dashboard load optimization

This commit is contained in:
jialin
2024-07-05 18:51:13 +08:00
parent e9d8828dcd
commit 8c66c482b2
10 changed files with 238 additions and 227 deletions
+1
View File
@@ -65,6 +65,7 @@ const BarChart: React.FC<ChartProps> = (props) => {
});
const optionsConfig = {
...options,
animation: false,
title: {
...titleConfig,
text: title
+1
View File
@@ -64,6 +64,7 @@ const BarChart: React.FC<ChartProps> = (props) => {
});
const optionsConfig = {
...options,
animation: false,
title: {
...options.title,
left: 'start',
+7 -7
View File
@@ -9,7 +9,7 @@ import {
yAxis
} from '@/components/echarts/config';
import _ from 'lodash';
import { useEffect, useState } from 'react';
import { memo } from 'react';
import { ChartProps } from './types';
const LineChart: React.FC<ChartProps> = (props) => {
@@ -23,7 +23,6 @@ const LineChart: React.FC<ChartProps> = (props) => {
smooth,
title
} = props;
const [dataOptions, setDataOptions] = useState({});
const options = {
title: {
@@ -49,7 +48,7 @@ const LineChart: React.FC<ChartProps> = (props) => {
series: []
};
useEffect(() => {
const generateOptions = (): any => {
const data = _.map(seriesData, (item: any) => {
return {
...item,
@@ -67,6 +66,7 @@ const LineChart: React.FC<ChartProps> = (props) => {
});
const optionsConfig = {
...options,
animation: false,
title: {
...titleConfig,
text: title
@@ -80,9 +80,9 @@ const LineChart: React.FC<ChartProps> = (props) => {
},
series: data
};
console.log('optionsConfig========line=', optionsConfig);
setDataOptions(optionsConfig);
}, [seriesData, xAxisData, title]);
return optionsConfig;
};
const dataOptions = generateOptions();
return (
<Chart
height={height}
@@ -92,4 +92,4 @@ const LineChart: React.FC<ChartProps> = (props) => {
);
};
export default LineChart;
export default memo(LineChart);
+1 -1
View File
@@ -12,6 +12,6 @@
}
.ant-progress.ant-progress-circle .ant-progress-text {
font-size: 24px;
font-size: 20px;
}
}
+1 -1
View File
@@ -18,7 +18,7 @@ const UitilBar: React.FC<UitilBarProps> = (props) => {
gapDegree = 170,
strokeWidth = 10,
title,
size = 160,
size = 150,
strokeColor,
trailColor = 'rgba(221,221,221,.5)'
} = props;