541 lines
20 KiB
TypeScript
541 lines
20 KiB
TypeScript
import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
|||
|
|
import { Card, Button, List, Tag, Spin, message, DatePicker, Segmented, Space } from 'antd';
|
||
|
|
import {
|
||
|
|
CheckCircleOutlined,
|
||
|
|
WarningOutlined,
|
||
|
|
RocketOutlined,
|
||
|
|
CompassOutlined,
|
||
|
|
PieChartOutlined,
|
||
|
|
} from '@ant-design/icons';
|
||
|
|
import { Line, Pie, Column, Area, Rose } from '@ant-design/plots';
|
||
|
|
import { history } from 'umi';
|
||
|
|
import dayjs from 'dayjs';
|
||
|
|
import {
|
||
|
|
getDeviceStats,
|
||
|
|
getTaskStats,
|
||
|
|
getTrendData,
|
||
|
|
getMockAlerts,
|
||
|
|
DeviceStats,
|
||
|
|
TaskStats,
|
||
|
|
TrendItem,
|
||
|
|
AlertItem,
|
||
|
|
} from '@/services/dashboard';
|
||
|
|
import './index.less';
|
||
|
|
|
||
|
|
// 无人船图标组件
|
||
|
|
const USVIcon = () => (
|
||
|
|
<svg viewBox="0 0 24 24" width="1em" height="1em" fill="currentColor">
|
||
|
|
<path d="M20 21c-1.39 0-2.78-.47-4-1.32-2.44 1.71-5.56 1.71-8 0C6.78 20.53 5.39 21 4 21H2v2h2c1.38 0 2.74-.35 4-.99 2.52 1.29 5.48 1.29 8 0 1.26.64 2.63.99 4 .99h2v-2h-2zM3.95 19H4c1.6 0 3.02-.88 4-2 .98 1.12 2.4 2 4 2s3.02-.88 4-2c.98 1.12 2.4 2 4 2h.05l1.89-6.68c.08-.26.06-.54-.06-.78s-.34-.42-.6-.5L20 10.62V6c0-1.1-.9-2-2-2h-3V1H9v3H6c-1.1 0-2 .9-2 2v4.62l-1.29.42c-.26.08-.48.26-.6.5s-.15.52-.06.78L3.95 19zM6 6h12v3.97L12 8 6 9.97V6z"/>
|
||
|
|
</svg>
|
||
|
|
);
|
||
|
|
|
||
|
|
const MaritimeDashboard: React.FC = () => {
|
||
|
|
const [loading, setLoading] = useState(true);
|
||
|
|
const [deviceStats, setDeviceStats] = useState<DeviceStats | null>(null);
|
||
|
|
const [taskStats, setTaskStats] = useState<TaskStats | null>(null);
|
||
|
|
const [taskTrend, setTaskTrend] = useState<TrendItem[]>([]);
|
||
|
|
const [deviceTrend, setDeviceTrend] = useState<TrendItem[]>([]);
|
||
|
|
const [alerts, setAlerts] = useState<AlertItem[]>([]);
|
||
|
|
const [annualData, setAnnualData] = useState<any[]>([]);
|
||
|
|
const [violationAnalysisData, setViolationAnalysisData] = useState<any[]>([]);
|
||
|
|
const [taskStatType, setTaskStatType] = useState<'day' | 'month' | 'year'>('day');
|
||
|
|
const [taskStatDate, setTaskStatDate] = useState(dayjs());
|
||
|
|
const [tenantId, setTenantId] = useState<string | undefined>();
|
||
|
|
const [includeChildren, setIncludeChildren] = useState<boolean>(true);
|
||
|
|
|
||
|
|
useEffect(() => {
|
||
|
|
// 模拟年度数据
|
||
|
|
const mockAnnual: any[] = [];
|
||
|
|
for (let i = 1; i <= 12; i++) {
|
||
|
|
mockAnnual.push({
|
||
|
|
month: `${i}月`,
|
||
|
|
value: Math.floor(Math.random() * 500) + 100,
|
||
|
|
type: '巡检任务',
|
||
|
|
});
|
||
|
|
mockAnnual.push({
|
||
|
|
month: `${i}月`,
|
||
|
|
value: Math.floor(Math.random() * 450) + 80,
|
||
|
|
type: '完成任务',
|
||
|
|
});
|
||
|
|
}
|
||
|
|
setAnnualData(mockAnnual);
|
||
|
|
|
||
|
|
// 违规类型分析数据
|
||
|
|
setViolationAnalysisData([
|
||
|
|
{ type: '超速航行', value: 32 },
|
||
|
|
{ type: '违规锚泊', value: 25 },
|
||
|
|
{ type: '未按航道行驶', value: 20 },
|
||
|
|
{ type: '证照过期', value: 12 },
|
||
|
|
{ type: '污染排放', value: 8 },
|
||
|
|
{ type: '其他违规', value: 3 },
|
||
|
|
]);
|
||
|
|
}, []);
|
||
|
|
|
||
|
|
useEffect(() => {
|
||
|
|
const handler = (e: any) => {
|
||
|
|
const nextTenantId = e?.detail?.tenantId as string | undefined;
|
||
|
|
const nextIncludeChildren = !!e?.detail?.includeChildren;
|
||
|
|
setTenantId(nextTenantId);
|
||
|
|
setIncludeChildren(nextIncludeChildren);
|
||
|
|
};
|
||
|
|
window.addEventListener('tenant-change', handler as any);
|
||
|
|
return () => window.removeEventListener('tenant-change', handler as any);
|
||
|
|
}, []);
|
||
|
|
|
||
|
|
const fetchData = useCallback(async () => {
|
||
|
|
setLoading(true);
|
||
|
|
try {
|
||
|
|
const [deviceRes, taskRes, trendRes] = await Promise.all([
|
||
|
|
getDeviceStats({ tenantId, includeChildren }),
|
||
|
|
getTaskStats({
|
||
|
|
tenantId,
|
||
|
|
includeChildren,
|
||
|
|
statType: taskStatType,
|
||
|
|
date:
|
||
|
|
taskStatType === 'day'
|
||
|
|
? taskStatDate.format('YYYY-MM-DD')
|
||
|
|
: taskStatType === 'month'
|
||
|
|
? taskStatDate.format('YYYY-MM')
|
||
|
|
: taskStatDate.format('YYYY'),
|
||
|
|
}),
|
||
|
|
getTrendData(7),
|
||
|
|
]);
|
||
|
|
setDeviceStats(deviceRes);
|
||
|
|
setTaskStats(taskRes);
|
||
|
|
setTaskTrend(trendRes.taskTrend);
|
||
|
|
setDeviceTrend(trendRes.deviceTrend);
|
||
|
|
// 模拟海事告警数据
|
||
|
|
setAlerts(getMaritimeAlerts());
|
||
|
|
} catch (error) {
|
||
|
|
console.error('获取数据失败:', error);
|
||
|
|
message.error('数据加载异常');
|
||
|
|
} finally {
|
||
|
|
setLoading(false);
|
||
|
|
}
|
||
|
|
}, [includeChildren, taskStatDate, taskStatType, tenantId]);
|
||
|
|
|
||
|
|
// 海事专用告警数据
|
||
|
|
const getMaritimeAlerts = (): AlertItem[] => {
|
||
|
|
return [
|
||
|
|
{ id: '1', type: 'device_fault', level: 'critical', deviceName: '巡检船-01', message: '检测到船只超速航行,航速28节', timestamp: new Date(Date.now() - 120000).toISOString() },
|
||
|
|
{ id: '2', type: 'device_offline', level: 'error', deviceName: '巡检船-03', message: '设备信号丢失超过10分钟', timestamp: new Date(Date.now() - 300000).toISOString() },
|
||
|
|
{ id: '3', type: 'task_failed', level: 'warning', taskName: '巡检任务#1024', message: '发现违规锚泊船只1艘', timestamp: new Date(Date.now() - 600000).toISOString() },
|
||
|
|
{ id: '4', type: 'low_battery', level: 'warning', deviceName: '巡检船-02', message: '电池电量低于20%', timestamp: new Date(Date.now() - 900000).toISOString() },
|
||
|
|
{ id: '5', type: 'task_failed', level: 'warning', taskName: '巡检任务#1023', message: '巡检完成,未发现违规', timestamp: new Date(Date.now() - 1200000).toISOString() },
|
||
|
|
];
|
||
|
|
};
|
||
|
|
|
||
|
|
useEffect(() => {
|
||
|
|
if (!tenantId) return;
|
||
|
|
fetchData();
|
||
|
|
}, [fetchData]);
|
||
|
|
|
||
|
|
// 定时刷新
|
||
|
|
useEffect(() => {
|
||
|
|
const dataTimer = setInterval(fetchData, 30000);
|
||
|
|
return () => {
|
||
|
|
clearInterval(dataTimer);
|
||
|
|
};
|
||
|
|
}, [fetchData]);
|
||
|
|
|
||
|
|
const goTo3D = () => {
|
||
|
|
history.push('/map3d');
|
||
|
|
};
|
||
|
|
|
||
|
|
// --- 图表配置 ---
|
||
|
|
|
||
|
|
const taskTrendSeriesData = useMemo(() => {
|
||
|
|
return taskTrend.flatMap((t) => [
|
||
|
|
{ date: t.date, type: '下发', value: t.created || 0 },
|
||
|
|
{ date: t.date, type: '完成', value: t.completed || 0 },
|
||
|
|
{ date: t.date, type: '失败', value: t.failed || 0 },
|
||
|
|
]);
|
||
|
|
}, [taskTrend]);
|
||
|
|
|
||
|
|
const deviceOnlineRateTrendData = useMemo(() => {
|
||
|
|
return deviceTrend.map((t) => {
|
||
|
|
const total = t.total || 0;
|
||
|
|
const online = t.online || 0;
|
||
|
|
return {
|
||
|
|
date: t.date,
|
||
|
|
value: total > 0 ? Math.round((online / total) * 100) : 0,
|
||
|
|
};
|
||
|
|
});
|
||
|
|
}, [deviceTrend]);
|
||
|
|
|
||
|
|
const taskTrendConfig: any = {
|
||
|
|
data: taskTrendSeriesData,
|
||
|
|
xField: 'date',
|
||
|
|
yField: 'value',
|
||
|
|
seriesField: 'type',
|
||
|
|
smooth: true,
|
||
|
|
color: ['#00b4d8', '#00e5a0', '#ff9f43'],
|
||
|
|
areaStyle: {
|
||
|
|
fill: 'l(270) 0:#ffffff 0.5:#7ec2f3 1:#0077b6',
|
||
|
|
fillOpacity: 0.1,
|
||
|
|
},
|
||
|
|
xAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: null },
|
||
|
|
yAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(0,150,200,0.1)' } } } },
|
||
|
|
tooltip: { showMarkers: true },
|
||
|
|
height: 180,
|
||
|
|
};
|
||
|
|
|
||
|
|
// 设备类型分布 - 模拟数据
|
||
|
|
const usvTypeData: { name: string; count: number }[] = useMemo(() => {
|
||
|
|
return (deviceStats?.byType || [
|
||
|
|
{ name: '巡检型', count: 12 },
|
||
|
|
{ name: '监测型', count: 8 },
|
||
|
|
{ name: '救援型', count: 5 },
|
||
|
|
{ name: '测量型', count: 3 },
|
||
|
|
]).map(item => ({ name: item.name, count: item.count }));
|
||
|
|
}, [deviceStats]);
|
||
|
|
|
||
|
|
const pieConfig: any = {
|
||
|
|
data: usvTypeData,
|
||
|
|
angleField: 'count',
|
||
|
|
colorField: 'name',
|
||
|
|
radius: 0.7,
|
||
|
|
innerRadius: 0.5,
|
||
|
|
color: ['#00b4d8', '#0096c7', '#00e5a0', '#48cae4'],
|
||
|
|
label: {
|
||
|
|
text: (datum: any) => {
|
||
|
|
const name = datum?.name || '';
|
||
|
|
const count = datum?.count ?? 0;
|
||
|
|
const data = usvTypeData as { name: string; count: number }[];
|
||
|
|
const total = data.reduce((sum, d) => sum + (d.count || 0), 0);
|
||
|
|
const percent = total > 0 ? ((count / total) * 100).toFixed(1) : 0;
|
||
|
|
return `${name} ${percent}%`;
|
||
|
|
},
|
||
|
|
style: { fill: 'rgba(200,230,255,0.65)' },
|
||
|
|
},
|
||
|
|
legend: { position: 'bottom', itemValue: { style: { fill: 'rgba(200,230,255,0.65)' } }, itemName: { style: { fill: 'rgba(200,230,255,0.65)' } } },
|
||
|
|
height: 200,
|
||
|
|
};
|
||
|
|
|
||
|
|
const columnConfig: any = {
|
||
|
|
data: [
|
||
|
|
{ type: '在线', value: deviceStats?.online || 0 },
|
||
|
|
{ type: '离线', value: deviceStats?.offline || 0 },
|
||
|
|
{ type: '故障', value: deviceStats?.fault || 0 },
|
||
|
|
],
|
||
|
|
xField: 'type',
|
||
|
|
yField: 'value',
|
||
|
|
seriesField: 'type',
|
||
|
|
color: ({ type }: any) => {
|
||
|
|
if (type === '在线') return '#00e5a0';
|
||
|
|
if (type === '故障') return '#ff4d4f';
|
||
|
|
return '#8b9dc3';
|
||
|
|
},
|
||
|
|
label: {
|
||
|
|
text: (datum: any) => datum?.value?.toString() || '0',
|
||
|
|
style: { fill: '#fff' },
|
||
|
|
},
|
||
|
|
xAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } } },
|
||
|
|
yAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(0,150,200,0.1)' } } } },
|
||
|
|
legend: false,
|
||
|
|
height: 180,
|
||
|
|
};
|
||
|
|
|
||
|
|
const deviceOnlineRateConfig: any = {
|
||
|
|
data: deviceOnlineRateTrendData,
|
||
|
|
xField: 'date',
|
||
|
|
yField: 'value',
|
||
|
|
smooth: true,
|
||
|
|
color: '#00b4d8',
|
||
|
|
areaStyle: { fillOpacity: 0.2 },
|
||
|
|
xAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: null },
|
||
|
|
yAxis: {
|
||
|
|
label: { style: { fill: 'rgba(200,230,255,0.65)' } },
|
||
|
|
grid: { line: { style: { stroke: 'rgba(0,150,200,0.08)' } } },
|
||
|
|
},
|
||
|
|
tooltip: { showMarkers: true },
|
||
|
|
height: 160,
|
||
|
|
};
|
||
|
|
|
||
|
|
const areaConfig: any = {
|
||
|
|
data: annualData,
|
||
|
|
xField: 'month',
|
||
|
|
yField: 'value',
|
||
|
|
seriesField: 'type',
|
||
|
|
color: ['#00b4d8', '#00e5a0'],
|
||
|
|
areaStyle: { fillOpacity: 0.25 },
|
||
|
|
xAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } } },
|
||
|
|
yAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(0,150,200,0.1)' } } } },
|
||
|
|
legend: { position: 'top-right', itemName: { style: { fill: 'rgba(200,230,255,0.8)' } } },
|
||
|
|
smooth: true,
|
||
|
|
height: 220,
|
||
|
|
};
|
||
|
|
|
||
|
|
const roseConfig: any = {
|
||
|
|
data: violationAnalysisData,
|
||
|
|
xField: 'type',
|
||
|
|
yField: 'value',
|
||
|
|
seriesField: 'type',
|
||
|
|
radius: 0.9,
|
||
|
|
color: ['#ff6b6b', '#ffa502', '#ff9f43', '#00b4d8', '#48cae4', '#90e0ef'],
|
||
|
|
label: {
|
||
|
|
text: (datum: any) => datum?.type || '',
|
||
|
|
style: { fill: '#fff', fontSize: 10 },
|
||
|
|
},
|
||
|
|
legend: { position: 'bottom', itemName: { style: { fill: 'rgba(200,230,255,0.65)' } } },
|
||
|
|
height: 200,
|
||
|
|
};
|
||
|
|
|
||
|
|
const taskStatusPieConfig: any = {
|
||
|
|
data: [
|
||
|
|
{ name: '待执行', value: taskStats?.pending || 0 },
|
||
|
|
{ name: '执行中', value: taskStats?.running || 0 },
|
||
|
|
{ name: '已完成', value: taskStats?.completed || 0 },
|
||
|
|
{ name: '已失败', value: taskStats?.failed || 0 },
|
||
|
|
],
|
||
|
|
angleField: 'value',
|
||
|
|
colorField: 'name',
|
||
|
|
radius: 0.85,
|
||
|
|
innerRadius: 0.55,
|
||
|
|
color: ['#ffa502', '#00b4d8', '#00e5a0', '#ff6b6b'],
|
||
|
|
label: {
|
||
|
|
text: (datum: any) => {
|
||
|
|
const name = datum?.name || '';
|
||
|
|
const value = datum?.value ?? 0;
|
||
|
|
const total = (taskStats?.pending || 0) + (taskStats?.running || 0) + (taskStats?.completed || 0) + (taskStats?.failed || 0);
|
||
|
|
const percent = total > 0 ? ((value / total) * 100).toFixed(1) : 0;
|
||
|
|
return `${name} ${percent}%`;
|
||
|
|
},
|
||
|
|
style: { fill: 'rgba(200,230,255,0.65)' },
|
||
|
|
},
|
||
|
|
legend: { position: 'bottom', itemValue: { style: { fill: 'rgba(200,230,255,0.65)' } }, itemName: { style: { fill: 'rgba(200,230,255,0.65)' } } },
|
||
|
|
height: 190,
|
||
|
|
};
|
||
|
|
|
||
|
|
const getAlertColor = (level: string) => {
|
||
|
|
switch (level) {
|
||
|
|
case 'critical': return '#ff4757';
|
||
|
|
case 'error': return '#ff9f43';
|
||
|
|
case 'warning': return '#feca57';
|
||
|
|
default: return '#54a0ff';
|
||
|
|
}
|
||
|
|
};
|
||
|
|
|
||
|
|
const taskPeriodText = useMemo(() => {
|
||
|
|
if (taskStatType === 'day') return '当日';
|
||
|
|
if (taskStatType === 'month') return '当月';
|
||
|
|
return '当年';
|
||
|
|
}, [taskStatType]);
|
||
|
|
|
||
|
|
const taskNewLabel = useMemo(() => {
|
||
|
|
if (taskStatType === 'day') return '当日任务';
|
||
|
|
if (taskStatType === 'month') return '当月任务';
|
||
|
|
return '当年任务';
|
||
|
|
}, [taskStatType]);
|
||
|
|
|
||
|
|
const datePickerFormat = useMemo(() => {
|
||
|
|
if (taskStatType === 'day') return 'YYYY-MM-DD';
|
||
|
|
if (taskStatType === 'month') return 'YYYY-MM';
|
||
|
|
return 'YYYY';
|
||
|
|
}, [taskStatType]);
|
||
|
|
|
||
|
|
return (
|
||
|
|
<div className="maritime-dashboard">
|
||
|
|
<div className="wave-bg-animation"></div>
|
||
|
|
<div className="wave-layer"></div>
|
||
|
|
<div className="wave-layer-2"></div>
|
||
|
|
<div className="wave-layer-3"></div>
|
||
|
|
|
||
|
|
<Spin spinning={loading} wrapperClassName="maritime-spin">
|
||
|
|
<div className="maritime-content">
|
||
|
|
<div className="maritime-grid">
|
||
|
|
|
||
|
|
{/* 左侧栏:设备态势 */}
|
||
|
|
<div className="grid-col left-col">
|
||
|
|
<Card title="设备类型分布" className="panel-card ocean-glass" size="small">
|
||
|
|
<div className="chart-wrapper">
|
||
|
|
<Pie {...pieConfig} />
|
||
|
|
</div>
|
||
|
|
</Card>
|
||
|
|
|
||
|
|
<Card title="设备状态统计" className="panel-card ocean-glass" size="small">
|
||
|
|
<div className="chart-wrapper">
|
||
|
|
<Column {...columnConfig} />
|
||
|
|
</div>
|
||
|
|
</Card>
|
||
|
|
|
||
|
|
<Card title="近7日在线率趋势" className="panel-card ocean-glass" size="small">
|
||
|
|
<div className="chart-wrapper">
|
||
|
|
<Area {...deviceOnlineRateConfig} />
|
||
|
|
</div>
|
||
|
|
</Card>
|
||
|
|
|
||
|
|
<Card
|
||
|
|
title={<span><WarningOutlined className="icon-warning" /> 实时告警</span>}
|
||
|
|
className="panel-card ocean-glass flex-grow"
|
||
|
|
size="small"
|
||
|
|
extra={<Tag color="#ff9f43">LIVE</Tag>}
|
||
|
|
>
|
||
|
|
<div className="alert-list-container">
|
||
|
|
<List
|
||
|
|
dataSource={alerts}
|
||
|
|
split={false}
|
||
|
|
renderItem={(item) => (
|
||
|
|
<List.Item className="alert-item">
|
||
|
|
<div className="alert-row">
|
||
|
|
<div className="alert-badge">
|
||
|
|
<Tag color={getAlertColor(item.level)}>{item.level.toUpperCase().slice(0, 1)}</Tag>
|
||
|
|
</div>
|
||
|
|
<div className="alert-content">
|
||
|
|
<div className="alert-head">
|
||
|
|
<span className="alert-name">{item.deviceName || item.taskName}</span>
|
||
|
|
<span className="alert-time">{dayjs(item.timestamp).format('HH:mm')}</span>
|
||
|
|
</div>
|
||
|
|
<div className="alert-msg">{item.message}</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</List.Item>
|
||
|
|
)}
|
||
|
|
/>
|
||
|
|
</div>
|
||
|
|
</Card>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
{/* 中间栏:核心监控 */}
|
||
|
|
<div className="grid-col center-col">
|
||
|
|
{/* 顶部KPI */}
|
||
|
|
<div className="kpi-row">
|
||
|
|
<div className="kpi-card">
|
||
|
|
<div className="kpi-icon ship"><USVIcon /></div>
|
||
|
|
<div className="kpi-info">
|
||
|
|
<div className="label">设备总数</div>
|
||
|
|
<div className="value">{deviceStats?.total || 0}</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div className="kpi-card">
|
||
|
|
<div className="kpi-icon anchor"><CheckCircleOutlined /></div>
|
||
|
|
<div className="kpi-info">
|
||
|
|
<div className="label">在线率</div>
|
||
|
|
<div className="value">{deviceStats?.onlineRate || 0}<small>%</small></div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div className="kpi-card">
|
||
|
|
<div className="kpi-icon alert"><RocketOutlined /></div>
|
||
|
|
<div className="kpi-info">
|
||
|
|
<div className="label">{taskNewLabel}</div>
|
||
|
|
<div className="value">{taskStats?.todayNew || 0}</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div className="kpi-card">
|
||
|
|
<div className="kpi-icon route"><PieChartOutlined /></div>
|
||
|
|
<div className="kpi-info">
|
||
|
|
<div className="label">执行成功率</div>
|
||
|
|
<div className="value">{taskStats?.successRate || 0}<small>%</small></div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
{/* 海域监控入口 */}
|
||
|
|
<div className="map-portal-wrapper">
|
||
|
|
<div className="nautical-grid"></div>
|
||
|
|
<div className="compass-sweep"></div>
|
||
|
|
<div className="map-content">
|
||
|
|
<div className="portal-center">
|
||
|
|
<CompassOutlined style={{ fontSize: 52, color: '#00b4d8', marginBottom: 16 }} />
|
||
|
|
<h2 className="portal-title">海域智慧巡检监控中心</h2>
|
||
|
|
<Button type="primary" shape="round" size="large" onClick={goTo3D} className="portal-btn">
|
||
|
|
进入海域监控视图
|
||
|
|
</Button>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
{/* 年度巡检任务趋势 */}
|
||
|
|
<Card title="年度巡检任务趋势分析" className="panel-card ocean-glass fill-bottom" size="small">
|
||
|
|
<div className="chart-wrapper">
|
||
|
|
<Area {...areaConfig} />
|
||
|
|
</div>
|
||
|
|
</Card>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
{/* 右侧栏:任务与运维 */}
|
||
|
|
<div className="grid-col right-col">
|
||
|
|
<Card
|
||
|
|
title={`${taskPeriodText}巡检任务`}
|
||
|
|
className="panel-card ocean-glass"
|
||
|
|
size="small"
|
||
|
|
extra={
|
||
|
|
<Space size={8} className="task-filter">
|
||
|
|
<Segmented
|
||
|
|
size="small"
|
||
|
|
options={[
|
||
|
|
{ label: '日', value: 'day' },
|
||
|
|
{ label: '月', value: 'month' },
|
||
|
|
{ label: '年', value: 'year' },
|
||
|
|
]}
|
||
|
|
value={taskStatType}
|
||
|
|
onChange={(v) => setTaskStatType(v as any)}
|
||
|
|
/>
|
||
|
|
<DatePicker
|
||
|
|
size="small"
|
||
|
|
value={taskStatDate}
|
||
|
|
onChange={(v) => v && setTaskStatDate(v)}
|
||
|
|
picker={taskStatType === 'day' ? 'date' : taskStatType}
|
||
|
|
allowClear={false}
|
||
|
|
format={datePickerFormat}
|
||
|
|
disabledDate={(d) => !!d && d.isAfter(dayjs(), 'day')}
|
||
|
|
/>
|
||
|
|
</Space>
|
||
|
|
}
|
||
|
|
>
|
||
|
|
<div className="ship-status-grid">
|
||
|
|
<div className="ship-stat-box">
|
||
|
|
<div className="val sailing">{taskStats?.pending || 0}</div>
|
||
|
|
<div className="lbl">待执行</div>
|
||
|
|
</div>
|
||
|
|
<div className="ship-stat-box">
|
||
|
|
<div className="val anchored">{taskStats?.running || 0}</div>
|
||
|
|
<div className="lbl">执行中</div>
|
||
|
|
</div>
|
||
|
|
<div className="ship-stat-box">
|
||
|
|
<div className="val docked">{taskStats?.completed || 0}</div>
|
||
|
|
<div className="lbl">已完成</div>
|
||
|
|
</div>
|
||
|
|
<div className="ship-stat-box">
|
||
|
|
<div className="val warning">{taskStats?.failed || 0}</div>
|
||
|
|
<div className="lbl">已失败</div>
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
<div style={{ marginTop: 16, textAlign: 'center' }}>
|
||
|
|
<div style={{ fontSize: '32px', fontWeight: 'bold', color: '#00e5a0' }}>
|
||
|
|
{taskStats?.successRate || 0}%
|
||
|
|
</div>
|
||
|
|
<div style={{ fontSize: '14px', color: '#e0f7ff', marginTop: 4 }}>
|
||
|
|
{taskPeriodText}成功率
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</Card>
|
||
|
|
|
||
|
|
<Card title="任务状态占比" className="panel-card ocean-glass" size="small">
|
||
|
|
<div className="chart-wrapper">
|
||
|
|
<Pie {...taskStatusPieConfig} />
|
||
|
|
</div>
|
||
|
|
</Card>
|
||
|
|
|
||
|
|
<Card title="近7日巡检趋势" className="panel-card ocean-glass" size="small">
|
||
|
|
<div className="chart-wrapper">
|
||
|
|
<Line {...taskTrendConfig} />
|
||
|
|
</div>
|
||
|
|
</Card>
|
||
|
|
|
||
|
|
<Card title="违规类型分析" className="panel-card ocean-glass flex-grow" size="small">
|
||
|
|
<div className="chart-wrapper">
|
||
|
|
<Rose {...roseConfig} />
|
||
|
|
</div>
|
||
|
|
</Card>
|
||
|
|
</div>
|
||
|
|
|
||
|
|
</div>
|
||
|
|
</div>
|
||
|
|
</Spin>
|
||
|
|
</div>
|
||
|
|
);
|
||
|
|
};
|
||
|
|
|
||
|
|
export default MaritimeDashboard;
|