187 lines
4.4 KiB
TypeScript
187 lines
4.4 KiB
TypeScript
import React from 'react';
|
|
import { Card } from 'antd';
|
|
import { BarChartOutlined } from '@ant-design/icons';
|
|
import { Area, Column } from '@ant-design/plots';
|
|
|
|
interface AnnualTrendCardProps {
|
|
annualData: any[];
|
|
taskTypeData: any[];
|
|
}
|
|
|
|
const AnnualTrendCard: React.FC<AnnualTrendCardProps> = ({ annualData, taskTypeData }) => {
|
|
const areaConfig: any = {
|
|
data: annualData,
|
|
xField: 'month',
|
|
yField: 'value',
|
|
seriesField: 'type',
|
|
color: ['#00b4d8', '#00e5a0'],
|
|
areaStyle: { fillOpacity: 0.3 },
|
|
line: {
|
|
style: { lineWidth: 2 },
|
|
},
|
|
point: {
|
|
size: 3,
|
|
shape: 'circle',
|
|
style: {
|
|
fill: '#fff',
|
|
stroke: '#00b4d8',
|
|
lineWidth: 2,
|
|
},
|
|
},
|
|
xAxis: {
|
|
label: {
|
|
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 11 },
|
|
},
|
|
line: {
|
|
style: { stroke: 'rgba(0,180,216,0.2)' },
|
|
},
|
|
tickLine: null,
|
|
},
|
|
yAxis: {
|
|
label: {
|
|
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 11 },
|
|
},
|
|
grid: {
|
|
line: { style: { stroke: 'rgba(0,150,200,0.15)', lineDash: [4, 4] } },
|
|
},
|
|
line: null,
|
|
tickLine: null,
|
|
},
|
|
legend: {
|
|
position: 'top',
|
|
itemName: {
|
|
style: { fill: 'rgba(200,230,255,0.85)', fontSize: 12, fontWeight: 600 },
|
|
},
|
|
marker: {
|
|
symbol: 'circle',
|
|
style: { r: 4 },
|
|
},
|
|
itemSpacing: 16,
|
|
},
|
|
smooth: true,
|
|
animation: {
|
|
appear: {
|
|
animation: 'wave-in',
|
|
duration: 1000,
|
|
},
|
|
},
|
|
tooltip: {
|
|
showMarkers: true,
|
|
marker: {
|
|
fill: '#00b4d8',
|
|
},
|
|
domStyles: {
|
|
'g2-tooltip': {
|
|
background: 'rgba(10, 30, 50, 0.95)',
|
|
boxShadow: '0 4px 12px rgba(0,0,0,0.3)',
|
|
border: '1px solid rgba(0,180,216,0.3)',
|
|
},
|
|
'g2-tooltip-title': {
|
|
color: 'rgba(200,230,255,0.95)',
|
|
},
|
|
'g2-tooltip-list-item': {
|
|
color: 'rgba(200,230,255,0.85)',
|
|
},
|
|
},
|
|
},
|
|
autoFit: true,
|
|
};
|
|
|
|
const columnConfig: any = {
|
|
data: taskTypeData,
|
|
xField: 'type',
|
|
yField: 'value',
|
|
seriesField: 'type',
|
|
color: ({ type }: any) => {
|
|
if (type === '航线巡检') return '#00b4d8';
|
|
if (type === '定点监测') return '#00e5a0';
|
|
return '#ff9f43';
|
|
},
|
|
columnStyle: {
|
|
radius: [6, 6, 0, 0],
|
|
},
|
|
label: {
|
|
text: (datum: any) => datum?.value?.toString() || '0',
|
|
style: {
|
|
fill: '#fff',
|
|
fontSize: 12,
|
|
fontWeight: 600,
|
|
textAlign: 'center',
|
|
},
|
|
position: 'top',
|
|
offset: 8,
|
|
},
|
|
xAxis: {
|
|
label: {
|
|
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 11 },
|
|
},
|
|
line: {
|
|
style: { stroke: 'rgba(0,180,216,0.2)' },
|
|
},
|
|
tickLine: null,
|
|
},
|
|
yAxis: {
|
|
label: {
|
|
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 11 },
|
|
},
|
|
grid: {
|
|
line: { style: { stroke: 'rgba(0,150,200,0.15)', lineDash: [4, 4] } },
|
|
},
|
|
line: null,
|
|
tickLine: null,
|
|
},
|
|
legend: false,
|
|
animation: {
|
|
appear: {
|
|
animation: 'scale-in-y',
|
|
duration: 800,
|
|
},
|
|
},
|
|
tooltip: {
|
|
domStyles: {
|
|
'g2-tooltip': {
|
|
background: 'rgba(10, 30, 50, 0.95)',
|
|
boxShadow: '0 4px 12px rgba(0,0,0,0.3)',
|
|
border: '1px solid rgba(0,180,216,0.3)',
|
|
},
|
|
'g2-tooltip-title': {
|
|
color: 'rgba(200,230,255,0.95)',
|
|
},
|
|
'g2-tooltip-list-item': {
|
|
color: 'rgba(200,230,255,0.85)',
|
|
},
|
|
},
|
|
},
|
|
autoFit: true,
|
|
};
|
|
|
|
return (
|
|
<Card
|
|
title={
|
|
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
|
|
<BarChartOutlined style={{ color: '#00b4d8' }} /> 年度巡检任务趋势与任务类型
|
|
</span>
|
|
}
|
|
className="maritime-card"
|
|
size="small"
|
|
>
|
|
<div className="panel-split">
|
|
<div className="panel-section">
|
|
<div className="panel-subtitle">年度巡检趋势</div>
|
|
<div className="maritime-chart-wrapper">
|
|
<Area {...areaConfig} />
|
|
</div>
|
|
</div>
|
|
<div className="panel-section">
|
|
<div className="panel-subtitle">任务类型统计</div>
|
|
<div className="maritime-chart-wrapper">
|
|
<Column {...columnConfig} />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</Card>
|
|
);
|
|
};
|
|
|
|
export default AnnualTrendCard;
|