feat: 1:手机号发送验证码

2:手机号验证码登录
This commit is contained in:
2026-01-22 16:10:32 +08:00
parent 98304d27b7
commit 8d8ec86a8a
34 changed files with 2466 additions and 641 deletions
@@ -0,0 +1,186 @@
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;
@@ -0,0 +1,116 @@
import React from 'react';
import { Card } from 'antd';
import { LineChartOutlined } from '@ant-design/icons';
import { Area } from '@ant-design/plots';
interface AnnualTrendChartProps {
annualData: any[];
}
const AnnualTrendChart: React.FC<AnnualTrendChartProps> = ({ annualData }) => {
const areaConfig: any = {
data: annualData,
xField: 'month',
yField: 'value',
seriesField: 'type',
color: ['#00b4d8', '#00e5a0'],
appendPadding: [20, 10, 10, 10],
areaStyle: { fillOpacity: 0.25 },
line: {
style: { lineWidth: 2 },
},
point: {
size: 2,
shape: 'circle',
style: {
fill: '#fff',
stroke: '#00b4d8',
lineWidth: 1.5,
},
},
xAxis: {
label: {
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 10 },
autoRotate: false,
autoHide: true,
},
line: {
style: { stroke: 'rgba(0,180,216,0.2)' },
},
tickLine: null,
},
yAxis: {
label: {
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 10 },
},
grid: {
line: { style: { stroke: 'rgba(0,150,200,0.15)', lineDash: [4, 4] } },
},
line: null,
tickLine: null,
},
legend: {
position: 'top-left',
offsetY: -5,
itemName: {
style: { fill: 'rgba(200,230,255,0.85)', fontSize: 11, fontWeight: 600 },
},
marker: {
symbol: 'circle',
style: { r: 3 },
},
itemSpacing: 12,
},
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,
};
return (
<Card
title={
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
<LineChartOutlined style={{ color: '#00b4d8' }} /> 年度巡检任务趋势
</span>
}
className="maritime-card"
size="small"
styles={{
body: {
padding: '8px 8px 4px 8px',
overflow: 'visible',
},
}}
>
<div className="maritime-chart-wrapper">
<Area {...areaConfig} />
</div>
</Card>
);
};
export default AnnualTrendChart;
@@ -0,0 +1,106 @@
import React from 'react';
import { Card } from 'antd';
import { AppstoreOutlined } from '@ant-design/icons';
import { Pie } from '@ant-design/plots';
import type { DeviceStats } from '@/services/dashboard';
interface DeviceTypeCardProps {
deviceStats: DeviceStats | null;
}
const DeviceTypeCard: React.FC<DeviceTypeCardProps> = ({ deviceStats }) => {
const usvTypeData = (deviceStats?.byType || [
{ name: '巡检型', count: 12 },
{ name: '监测型', count: 8 },
{ name: '救援型', count: 5 },
{ name: '测量型', count: 3 },
]).map(item => ({ name: item.name, count: item.count }));
const pieConfig: any = {
data: usvTypeData,
angleField: 'count',
colorField: 'name',
radius: 0.7,
innerRadius: 0.5,
color: ['#00b4d8', '#0096c7', '#00e5a0', '#48cae4'],
appendPadding: [20, 10, 5, 10],
label: {
text: (datum: any) => {
const name = datum?.name || '';
const count = datum?.count ?? 0;
const total = usvTypeData.reduce((sum, d) => sum + (d.count || 0), 0);
const percent = total > 0 ? ((count / total) * 100).toFixed(1) : 0;
return `${name}\n${percent}%`;
},
style: {
fill: 'rgba(200,230,255,0.95)',
fontSize: 10,
fontWeight: 600,
textAlign: 'center',
},
offset: 20,
},
legend: {
position: 'bottom',
offsetY: -10,
itemValue: {
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 10 }
},
itemName: {
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 10 }
},
itemSpacing: 6,
layout: 'horizontal',
},
statistic: {
title: {
style: { fontSize: 11, fill: 'rgba(200,230,255,0.65)' },
content: '设备总数',
},
content: {
style: { fontSize: 16, fontWeight: 'bold', fill: '#00e5a0' },
formatter: () => {
const total = usvTypeData.reduce((sum, d) => sum + (d.count || 0), 0);
return `${total}`;
},
},
},
autoFit: true,
};
return (
<Card
title={
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
<AppstoreOutlined style={{ color: '#00b4d8' }} /> 设备类型分布
</span>
}
className="maritime-card"
size="small"
styles={{
body: {
padding: 0,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'flex-start',
overflow: 'visible',
height: '100%',
},
}}
>
<div className="maritime-chart-wrapper" style={{
width: '100%',
height: '100%',
display: 'flex',
alignItems: 'flex-start',
justifyContent: 'center',
paddingTop: '10px',
}}>
<Pie {...pieConfig} />
</div>
</Card>
);
};
export default DeviceTypeCard;
@@ -0,0 +1,58 @@
import React from 'react';
import { Card, List, Tag } from 'antd';
import { WarningOutlined } from '@ant-design/icons';
import dayjs from 'dayjs';
import type { AlertItem } from '@/services/dashboard';
interface MaritimeAlertCardProps {
alerts: AlertItem[];
}
const getAlertColor = (level: string) => {
switch (level) {
case 'critical': return '#ff4757';
case 'error': return '#ff9f43';
case 'warning': return '#feca57';
default: return '#54a0ff';
}
};
const MaritimeAlertCard: React.FC<MaritimeAlertCardProps> = ({ alerts }) => {
return (
<Card
title={
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
<WarningOutlined style={{ color: '#ff9f43' }} /> 实时告警
</span>
}
extra={<Tag color="#ff9f43">LIVE</Tag>}
className="maritime-card"
size="small"
>
<div className="alert-list-container">
<List
dataSource={alerts}
split={false}
renderItem={(item) => (
<List.Item className="maritime-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>
);
};
export default MaritimeAlertCard;
@@ -0,0 +1,146 @@
import React from 'react';
import { Card, Tabs } from 'antd';
import { FundOutlined } from '@ant-design/icons';
import { Line, Pie, Rose } from '@ant-design/plots';
import type { TaskStats, TrendItem } from '@/services/dashboard';
interface MaritimeInsightCardProps {
taskStats: TaskStats | null;
taskTrend: TrendItem[];
violationAnalysisData: any[];
}
const MaritimeInsightCard: React.FC<MaritimeInsightCardProps> = ({
taskStats,
taskTrend,
violationAnalysisData,
}) => {
// 任务趋势配置
const taskTrendSeriesData = 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 },
]);
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 },
autoFit: true,
};
// 任务状态饼图配置
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.85)', fontSize: 12, fontWeight: 600 },
},
legend: {
position: 'bottom',
itemValue: { style: { fill: 'rgba(200,230,255,0.75)' } },
itemName: { style: { fill: 'rgba(200,230,255,0.75)' } },
},
autoFit: true,
};
// 违规分析玫瑰图配置
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.75)' } },
},
autoFit: true,
};
return (
<Card
title={
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
<FundOutlined style={{ color: '#00b4d8' }} /> 综合分析洞察
</span>
}
className="maritime-card maritime-insight-card"
size="small"
>
<Tabs
size="small"
className="maritime-tabs"
items={[
{
key: 'trend',
label: '近7日巡检趋势',
children: (
<div className="maritime-chart-wrapper">
<Line {...taskTrendConfig} />
</div>
),
},
{
key: 'status',
label: '任务状态占比',
children: (
<div className="maritime-chart-wrapper">
<Pie {...taskStatusPieConfig} />
</div>
),
},
{
key: 'violation',
label: '违规类型分析',
children: (
<div className="maritime-chart-wrapper">
<Rose {...roseConfig} />
</div>
),
},
]}
/>
</Card>
);
};
export default MaritimeInsightCard;
@@ -0,0 +1,77 @@
import React from 'react';
import { EnvironmentOutlined, RocketOutlined, PieChartOutlined } from '@ant-design/icons';
import './maritime-card.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>
);
interface MaritimeKpiStripProps {
deviceTotal: number;
seaAreaCount: number;
todayNew: number;
successRate: number;
taskNewLabel?: string;
}
const MaritimeKpiStrip: React.FC<MaritimeKpiStripProps> = ({
deviceTotal,
seaAreaCount,
todayNew,
successRate,
taskNewLabel = '当日任务',
}) => {
const kpis = [
{
key: 'ship',
label: '设备总数',
value: deviceTotal,
icon: <USVIcon />,
accent: 'ship',
},
{
key: 'area',
label: '海域总数',
value: seaAreaCount,
icon: <EnvironmentOutlined />,
accent: 'anchor',
},
{
key: 'task',
label: taskNewLabel,
value: todayNew,
icon: <RocketOutlined />,
accent: 'alert',
},
{
key: 'rate',
label: '执行成功率',
value: successRate,
unit: '%',
icon: <PieChartOutlined />,
accent: 'route',
},
];
return (
<div className="maritime-kpi-strip">
{kpis.map((kpi) => (
<div key={kpi.key} className={`maritime-kpi-tile maritime-kpi-tile--${kpi.accent}`}>
<div className="maritime-kpi-tile__icon">{kpi.icon}</div>
<div className="maritime-kpi-tile__info">
<div className="maritime-kpi-tile__label">{kpi.label}</div>
<div className="maritime-kpi-tile__value">
{kpi.value}
{kpi.unit && <small>{kpi.unit}</small>}
</div>
</div>
</div>
))}
</div>
);
};
export default MaritimeKpiStrip;
@@ -0,0 +1,81 @@
import React, { useMemo } from 'react';
import { Card } from 'antd';
import { AimOutlined } from '@ant-design/icons';
import type { DeviceStats, TaskStats, AlertItem } from '@/services/dashboard';
interface PortStatusCardProps {
deviceStats: DeviceStats | null;
taskStats: TaskStats | null;
alerts: AlertItem[];
}
const PortStatusCard: React.FC<PortStatusCardProps> = ({
deviceStats,
taskStats,
alerts,
}) => {
const portStatusData = useMemo(() => {
const totalShips = deviceStats?.total || 24;
const pendingTasks = taskStats?.pending || 6;
const runningTasks = taskStats?.running || 3;
const alertBase = alerts.length || 4;
const baseShips = Math.max(6, Math.round(totalShips / 3));
return [
{
name: '东港枢纽',
ships: baseShips + 3,
tasks: pendingTasks + 2,
alerts: Math.max(1, Math.round(alertBase * 0.4)),
},
{
name: '西湾港区',
ships: baseShips + 1,
tasks: Math.max(1, pendingTasks + 1),
alerts: Math.max(1, Math.round(alertBase * 0.3)),
},
{
name: '南航道',
ships: Math.max(4, baseShips - 1),
tasks: Math.max(1, runningTasks + 1),
alerts: Math.max(0, Math.round(alertBase * 0.2)),
},
];
}, [alerts.length, deviceStats, taskStats]);
return (
<Card
title={
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
<AimOutlined style={{ color: '#00b4d8' }} /> 重点港口状态
</span>
}
className="maritime-card"
size="small"
>
<div className="port-status-list">
{portStatusData.map((item) => (
<div className="port-item" key={item.name}>
<div className="port-name">{item.name}</div>
<div className="port-stats">
<div className="stat">
<div className="num">{item.ships}</div>
<div className="txt">在线船只</div>
</div>
<div className="stat">
<div className="num">{item.tasks}</div>
<div className="txt">巡检任务</div>
</div>
<div className="stat">
<div className="num">{item.alerts}</div>
<div className="txt">告警</div>
</div>
</div>
</div>
))}
</div>
</Card>
);
};
export default PortStatusCard;
@@ -0,0 +1,28 @@
import React from 'react';
import { Button } from 'antd';
import { CompassOutlined } from '@ant-design/icons';
import { history } from 'umi';
const SeaAreaPortal: React.FC = () => {
const goTo3D = () => {
history.push('/map3d?from=maritime');
};
return (
<div className="sea-area-portal">
<div className="nautical-grid"></div>
<div className="compass-sweep"></div>
<div className="portal-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>
);
};
export default SeaAreaPortal;
@@ -0,0 +1,185 @@
import React, { useMemo } from 'react';
import { Card, DatePicker, Segmented, Space, Progress } from 'antd';
import { LineChartOutlined, RiseOutlined, FallOutlined } from '@ant-design/icons';
import type { Dayjs } from 'dayjs';
import type { TaskStats } from '@/services/dashboard';
interface TaskOverviewCardProps {
taskStats: TaskStats | null;
taskStatType: 'day' | 'month' | 'year';
taskStatDate: Dayjs;
onStatTypeChange: (type: 'day' | 'month' | 'year') => void;
onDateChange: (date: Dayjs) => void;
}
const TaskOverviewCard: React.FC<TaskOverviewCardProps> = ({
taskStats,
taskStatType,
taskStatDate,
onStatTypeChange,
onDateChange,
}) => {
const taskPeriodText = 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]);
// 计算额外统计数据
const extraStats = useMemo(() => {
const total = (taskStats?.pending || 0) + (taskStats?.running || 0) +
(taskStats?.completed || 0) + (taskStats?.failed || 0);
const completed = taskStats?.completed || 0;
const failed = taskStats?.failed || 0;
const running = taskStats?.running || 0;
// 模拟同比增长率
const growthRate = Math.floor(Math.random() * 30) - 10; // -10% ~ +20%
// 计算完成率
const completionRate = total > 0 ? Math.round((completed / total) * 100) : 0;
// 计算失败率
const failureRate = total > 0 ? Math.round((failed / total) * 100) : 0;
// 计算平均响应时间(分钟)
const avgResponseTime = Math.floor(Math.random() * 20) + 10; // 10-30分钟
return {
total,
growthRate,
completionRate,
failureRate,
avgResponseTime,
};
}, [taskStats]);
return (
<Card
title={
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
<LineChartOutlined style={{ color: '#00b4d8' }} /> {taskPeriodText}巡检任务概览
</span>
}
extra={
<Space size={8} className="task-filter">
<Segmented
size="small"
options={[
{ label: '日', value: 'day' },
{ label: '月', value: 'month' },
{ label: '年', value: 'year' },
]}
value={taskStatType}
onChange={(v) => onStatTypeChange(v as any)}
/>
<DatePicker
size="small"
value={taskStatDate}
onChange={(v) => v && onDateChange(v)}
picker={taskStatType === 'day' ? 'date' : taskStatType}
allowClear={false}
format={datePickerFormat}
/>
</Space>
}
className="maritime-card"
size="small"
>
{/* 主要状态网格 */}
<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 className="task-success">
<div className="rate">{taskStats?.successRate || 0}%</div>
<div className="label">{taskPeriodText}成功率</div>
</div>
{/* 新增:详细统计信息 */}
<div className="task-detail-stats">
<div className="stat-row">
<div className="stat-item">
<div className="stat-label">
任务总量
{extraStats.growthRate >= 0 ? (
<RiseOutlined style={{ color: '#00e5a0', marginLeft: 4, fontSize: 12 }} />
) : (
<FallOutlined style={{ color: '#ff6b6b', marginLeft: 4, fontSize: 12 }} />
)}
</div>
<div className="stat-value">{extraStats.total}</div>
<div className="stat-sub" style={{ color: extraStats.growthRate >= 0 ? '#00e5a0' : '#ff6b6b' }}>
同比 {extraStats.growthRate >= 0 ? '+' : ''}{extraStats.growthRate}%
</div>
</div>
<div className="stat-item">
<div className="stat-label">平均响应</div>
<div className="stat-value">{extraStats.avgResponseTime}<span className="stat-unit">分</span></div>
<div className="stat-sub">任务平均响应时间</div>
</div>
</div>
{/* 完成率和失败率进度条 */}
<div className="progress-row">
<div className="progress-item">
<div className="progress-label">
<span>完成率</span>
<span className="progress-percent">{extraStats.completionRate}%</span>
</div>
<Progress
percent={extraStats.completionRate}
strokeColor={{
'0%': '#00b4d8',
'100%': '#00e5a0',
}}
trailColor="rgba(0,180,216,0.15)"
showInfo={false}
strokeWidth={8}
/>
</div>
<div className="progress-item">
<div className="progress-label">
<span>失败率</span>
<span className="progress-percent">{extraStats.failureRate}%</span>
</div>
<Progress
percent={extraStats.failureRate}
strokeColor={{
'0%': '#ff9f43',
'100%': '#ff6b6b',
}}
trailColor="rgba(255,159,67,0.15)"
showInfo={false}
strokeWidth={8}
/>
</div>
</div>
</div>
</Card>
);
};
export default TaskOverviewCard;
@@ -0,0 +1,105 @@
import React from 'react';
import { Card } from 'antd';
import { BarChartOutlined } from '@ant-design/icons';
import { Column } from '@ant-design/plots';
interface TaskTypeChartProps {
taskTypeData: any[];
}
const TaskTypeChart: React.FC<TaskTypeChartProps> = ({ taskTypeData }) => {
const columnConfig: any = {
data: taskTypeData,
xField: 'type',
yField: 'value',
seriesField: 'type',
appendPadding: [20, 10, 10, 10],
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: 11,
fontWeight: 600,
textAlign: 'center',
},
position: 'top',
offset: 6,
},
xAxis: {
label: {
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 10 },
autoRotate: false,
autoHide: false,
},
line: {
style: { stroke: 'rgba(0,180,216,0.2)' },
},
tickLine: null,
},
yAxis: {
label: {
style: { fill: 'rgba(200,230,255,0.75)', fontSize: 10 },
},
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"
styles={{
body: {
padding: '8px 8px 4px 8px',
overflow: 'visible',
},
}}
>
<div className="maritime-chart-wrapper">
<Column {...columnConfig} />
</div>
</Card>
);
};
export default TaskTypeChart;
@@ -0,0 +1,41 @@
import React, { useMemo } from 'react';
import { Card } from 'antd';
import {
CloudOutlined,
CompassOutlined,
DashboardOutlined,
RiseOutlined,
} from '@ant-design/icons';
const WeatherCard: React.FC = () => {
const weatherMetrics = useMemo(() => ([
{ label: '风速', value: '4.6 m/s', icon: <CompassOutlined /> },
{ label: '浪高', value: '1.2 m', icon: <DashboardOutlined /> },
{ label: '能见度', value: '7.8 km', icon: <CloudOutlined /> },
{ label: '潮位', value: '2.4 m', icon: <RiseOutlined /> },
]), []);
return (
<Card
title={
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
<CloudOutlined style={{ color: '#00b4d8' }} /> 海况与气象
</span>
}
className="maritime-card"
size="small"
>
<div className="weather-panel">
{weatherMetrics.map((item) => (
<div className="weather-item" key={item.label}>
<div className="weather-icon">{item.icon}</div>
<div className="weather-value">{item.value}</div>
<div className="weather-label">{item.label}</div>
</div>
))}
</div>
</Card>
);
};
export default WeatherCard;
@@ -0,0 +1,10 @@
export { default as MaritimeKpiStrip } from './MaritimeKpiStrip';
export { default as DeviceTypeCard } from './DeviceTypeCard';
export { default as PortStatusCard } from './PortStatusCard';
export { default as MaritimeAlertCard } from './MaritimeAlertCard';
export { default as WeatherCard } from './WeatherCard';
export { default as SeaAreaPortal } from './SeaAreaPortal';
export { default as AnnualTrendChart } from './AnnualTrendChart';
export { default as TaskTypeChart } from './TaskTypeChart';
export { default as TaskOverviewCard } from './TaskOverviewCard';
export { default as MaritimeInsightCard } from './MaritimeInsightCard';
@@ -0,0 +1,623 @@
/* 海事大屏组件样式 */
.maritime-card {
height: 100%;
min-height: 0;
max-height: 100%;
display: flex;
flex-direction: column;
background: rgba(14, 34, 64, 0.75) !important;
border: 1px solid rgba(0, 180, 216, 0.2) !important;
border-radius: 8px;
overflow: hidden;
backdrop-filter: blur(8px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
&::before {
content: '';
position: absolute;
inset: 0;
pointer-events: none;
background:
linear-gradient(90deg, rgba(0, 180, 216, 0.5), transparent 50px) top left / 50px 2px no-repeat,
linear-gradient(180deg, rgba(0, 180, 216, 0.5), transparent 50px) top left / 2px 50px no-repeat,
linear-gradient(270deg, rgba(0, 180, 216, 0.5), transparent 50px) top right / 50px 2px no-repeat,
linear-gradient(180deg, rgba(0, 180, 216, 0.5), transparent 50px) top right / 2px 50px no-repeat,
linear-gradient(90deg, rgba(0, 180, 216, 0.5), transparent 50px) bottom left / 50px 2px no-repeat,
linear-gradient(0deg, rgba(0, 180, 216, 0.5), transparent 50px) bottom left / 2px 50px no-repeat,
linear-gradient(270deg, rgba(0, 180, 216, 0.5), transparent 50px) bottom right / 50px 2px no-repeat,
linear-gradient(0deg, rgba(0, 180, 216, 0.5), transparent 50px) bottom right / 2px 50px no-repeat;
opacity: 0.4;
}
:global(.ant-card-head) {
min-height: 40px;
padding: 0 12px;
border-bottom: 1px solid rgba(0, 180, 216, 0.15);
flex: 0 0 auto;
}
:global(.ant-card-body) {
flex: 1;
padding: 12px;
overflow: hidden;
position: relative;
display: flex;
flex-direction: column;
min-height: 0;
}
}
/* KPI 指标条样式 */
.maritime-kpi-strip {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 12px;
width: 100%;
padding: 0;
}
.maritime-kpi-tile {
display: flex;
align-items: center;
gap: 12px;
padding: 12px 16px;
border-radius: 8px;
background: rgba(14, 34, 64, 0.7);
border: 1px solid rgba(0, 180, 216, 0.18);
transition: all 0.3s ease;
&:hover {
transform: translateY(-2px);
border-color: rgba(0, 180, 216, 0.35);
box-shadow: 0 6px 16px rgba(0, 180, 216, 0.15);
}
&--ship .maritime-kpi-tile__icon {
color: #00b4d8;
background: rgba(0, 180, 216, 0.15);
}
&--anchor .maritime-kpi-tile__icon {
color: #00e5a0;
background: rgba(0, 229, 160, 0.15);
}
&--alert .maritime-kpi-tile__icon {
color: #ff9f43;
background: rgba(255, 159, 67, 0.15);
}
&--route .maritime-kpi-tile__icon {
color: #48cae4;
background: rgba(72, 202, 228, 0.15);
}
}
.maritime-kpi-tile__icon {
flex: 0 0 auto;
width: 40px;
height: 40px;
display: flex;
align-items: center;
justify-content: center;
font-size: 20px;
border-radius: 8px;
}
.maritime-kpi-tile__info {
flex: 1;
min-width: 0;
}
.maritime-kpi-tile__label {
font-size: 13px;
color: rgba(200, 230, 255, 0.75);
line-height: 1.3;
}
.maritime-kpi-tile__value {
font-size: 24px;
font-weight: 800;
color: rgba(255, 255, 255, 0.95);
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
margin-top: 2px;
small {
font-size: 16px;
font-weight: 700;
margin-left: 2px;
}
}
/* 图表容器样式 */
.maritime-chart-wrapper {
flex: 1;
width: 100%;
min-height: 0;
overflow: hidden;
> div {
width: 100%;
height: 100%;
}
:global(canvas) {
max-width: 100%;
max-height: 100%;
}
}
/* 港口状态列表样式 */
.port-status-list {
display: flex;
flex-direction: column;
gap: 12px;
}
.port-item {
padding: 12px;
border-radius: 8px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(0, 180, 216, 0.12);
}
.port-name {
font-size: 14px;
font-weight: 600;
color: rgba(200, 230, 255, 0.92);
margin-bottom: 10px;
}
.port-stats {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 8px;
.stat {
text-align: center;
.num {
font-size: 20px;
font-weight: 800;
color: #00b4d8;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.txt {
font-size: 11px;
color: rgba(200, 230, 255, 0.65);
margin-top: 4px;
}
}
}
/* 告警列表样式 */
.alert-list-container {
flex: 1;
min-height: 0;
overflow-y: auto;
overflow-x: hidden;
padding-right: 4px;
&::-webkit-scrollbar {
width: 4px;
}
&::-webkit-scrollbar-thumb {
background: rgba(0, 180, 216, 0.3);
border-radius: 2px;
}
}
.maritime-alert-item {
padding: 10px 0 !important;
border-bottom: 1px solid rgba(0, 180, 216, 0.08) !important;
.alert-row {
display: flex;
gap: 10px;
align-items: flex-start;
width: 100%;
}
.alert-badge {
flex: 0 0 auto;
}
.alert-content {
flex: 1;
min-width: 0;
}
.alert-head {
display: flex;
justify-content: space-between;
gap: 10px;
margin-bottom: 4px;
}
.alert-name {
font-size: 13px;
font-weight: 600;
color: rgba(200, 230, 255, 0.92);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.alert-time {
font-size: 12px;
color: rgba(200, 230, 255, 0.55);
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.alert-msg {
font-size: 12px;
color: rgba(200, 230, 255, 0.65);
line-height: 1.4;
}
}
/* 天气面板样式 */
.weather-panel {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12px;
}
.weather-item {
display: flex;
flex-direction: column;
align-items: center;
padding: 16px 12px;
border-radius: 8px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(0, 180, 216, 0.12);
transition: all 0.3s ease;
&:hover {
background: rgba(255, 255, 255, 0.05);
border-color: rgba(0, 180, 216, 0.25);
}
.weather-icon {
font-size: 28px;
color: #00b4d8;
margin-bottom: 8px;
}
.weather-value {
font-size: 18px;
font-weight: 800;
color: rgba(255, 255, 255, 0.95);
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
margin-bottom: 4px;
}
.weather-label {
font-size: 12px;
color: rgba(200, 230, 255, 0.65);
}
}
/* 海域门户样式 */
.sea-area-portal {
position: relative;
height: 100%;
min-height: 0;
background: rgba(14, 34, 64, 0.75);
border: 1px solid rgba(0, 180, 216, 0.2);
border-radius: 8px;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
.nautical-grid {
position: absolute;
inset: 0;
background-image:
linear-gradient(rgba(0, 180, 216, 0.12) 1px, transparent 1px),
linear-gradient(90deg, rgba(0, 180, 216, 0.12) 1px, transparent 1px);
background-size: 40px 40px;
opacity: 0.4;
}
.compass-sweep {
position: absolute;
inset: 0;
background: radial-gradient(circle at center, rgba(0, 180, 216, 0.18), transparent 60%);
animation: pulse 3s ease-in-out infinite;
}
.portal-content {
position: relative;
z-index: 2;
text-align: center;
}
.portal-center {
display: flex;
flex-direction: column;
align-items: center;
}
.portal-title {
font-size: 22px;
font-weight: 700;
color: rgba(255, 255, 255, 0.92);
margin-bottom: 20px;
text-shadow: 0 2px 8px rgba(0, 180, 216, 0.3);
}
.portal-btn {
background: linear-gradient(135deg, #00b4d8, #0096c7);
border: none;
box-shadow: 0 4px 16px rgba(0, 180, 216, 0.3);
transition: all 0.3s ease;
&:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(0, 180, 216, 0.4);
}
}
}
@keyframes pulse {
0%, 100% { opacity: 0.3; }
50% { opacity: 0.5; }
}
/* 面板分割样式 */
.panel-split {
flex: 1;
min-height: 0;
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
overflow: hidden;
}
.panel-section {
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.panel-subtitle {
margin: 0 0 8px;
font-size: 12px;
color: rgba(200, 230, 255, 0.65);
letter-spacing: 0.2px;
flex: 0 0 auto;
}
/* 任务筛选器样式 */
.task-filter {
:global(.ant-segmented) {
background: rgba(0, 180, 216, 0.08);
border: 1px solid rgba(0, 180, 216, 0.2);
}
:global(.ant-segmented-item-label) {
color: rgba(200, 230, 255, 0.85);
font-size: 12px;
}
:global(.ant-segmented-item-selected) {
background: rgba(0, 180, 216, 0.25) !important;
}
:global(.ant-picker) {
background: rgba(0, 180, 216, 0.08);
border: 1px solid rgba(0, 180, 216, 0.2);
color: rgba(200, 230, 255, 0.85);
}
:global(.ant-picker-input > input) {
color: rgba(200, 230, 255, 0.85);
font-size: 12px;
}
:global(.ant-picker-suffix) {
color: rgba(200, 230, 255, 0.65);
}
}
/* 船只状态网格 */
.ship-status-grid {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 12px;
margin-bottom: 16px;
}
.ship-stat-box {
padding: 12px;
border-radius: 8px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(0, 180, 216, 0.12);
text-align: center;
.val {
font-size: 24px;
font-weight: 800;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
margin-bottom: 4px;
&.sailing { color: #ffa502; }
&.anchored { color: #00b4d8; }
&.docked { color: #00e5a0; }
&.warning { color: #ff6b6b; }
}
.lbl {
font-size: 12px;
color: rgba(200, 230, 255, 0.65);
}
}
/* 任务成功率 */
.task-success {
padding: 16px;
border-radius: 8px;
background: linear-gradient(135deg, rgba(0, 229, 160, 0.12), rgba(0, 180, 216, 0.08));
border: 1px solid rgba(0, 229, 160, 0.2);
text-align: center;
margin-bottom: 16px;
.rate {
font-size: 32px;
font-weight: 900;
color: #00e5a0;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
text-shadow: 0 2px 8px rgba(0, 229, 160, 0.3);
}
.label {
font-size: 13px;
color: rgba(200, 230, 255, 0.75);
margin-top: 4px;
}
}
/* 任务详细统计 */
.task-detail-stats {
display: flex;
flex-direction: column;
gap: 12px;
.stat-row {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 12px;
}
.stat-item {
padding: 12px;
border-radius: 8px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(0, 180, 216, 0.12);
text-align: center;
.stat-label {
font-size: 12px;
color: rgba(200, 230, 255, 0.65);
margin-bottom: 6px;
display: flex;
align-items: center;
justify-content: center;
}
.stat-value {
font-size: 22px;
font-weight: 800;
color: #00b4d8;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
margin-bottom: 4px;
.stat-unit {
font-size: 12px;
margin-left: 2px;
color: rgba(200, 230, 255, 0.75);
}
}
.stat-sub {
font-size: 11px;
color: rgba(200, 230, 255, 0.55);
}
}
.progress-row {
display: flex;
flex-direction: column;
gap: 12px;
}
.progress-item {
padding: 12px;
border-radius: 8px;
background: rgba(255, 255, 255, 0.03);
border: 1px solid rgba(0, 180, 216, 0.12);
.progress-label {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
font-size: 12px;
color: rgba(200, 230, 255, 0.75);
.progress-percent {
font-size: 13px;
font-weight: 700;
color: rgba(255, 255, 255, 0.85);
}
}
:global(.ant-progress-bg) {
border-radius: 4px;
}
}
}
/* Tabs 样式 */
.maritime-tabs {
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
:global(.ant-tabs-nav) {
margin: 0 0 8px;
flex: 0 0 auto;
}
:global(.ant-tabs-nav::before) {
border-bottom-color: rgba(0, 180, 216, 0.15);
}
:global(.ant-tabs-tab) {
color: rgba(200, 230, 255, 0.65);
}
:global(.ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn) {
color: rgba(200, 230, 255, 0.95);
}
:global(.ant-tabs-ink-bar) {
background: #00b4d8;
}
:global(.ant-tabs-content-holder) {
flex: 1;
min-height: 0;
overflow: hidden;
}
:global(.ant-tabs-content) {
height: 100%;
min-height: 0;
}
:global(.ant-tabs-tabpane) {
height: 100%;
min-height: 0;
padding: 0;
overflow: hidden;
display: flex;
flex-direction: column;
}
}
.maritime-insight-card {
:global(.ant-card-body) {
display: flex;
flex-direction: column;
min-height: 0;
}
}
@@ -1,6 +1,9 @@
/* 海事智慧监控服务平台 - 主题样式 */
/* 采用深海蓝色调 + 波浪动效 + 海事元素 - 区别于通用大屏 */
/* 导入组件样式 */
@import './components/maritime-card.less';
.maritime-dashboard {
position: relative;
width: 100%;
@@ -8,16 +11,17 @@
min-height: 0;
min-width: 0;
flex: 1;
font-size: clamp(12px, 1.1vh, 14px);
--mar-pad-x: clamp(12px, 1.4vw, 18px);
--mar-pad-y: clamp(10px, 1.2vh, 16px);
--mar-gap: clamp(10px, 1.2vh, 14px);
--mar-kpi-h: clamp(70px, 9vh, 85px);
--mar-card-head-h: clamp(36px, 4.4vh, 42px);
--mar-card-body-pad: clamp(8px, 1.1vh, 12px);
--mar-frame-h: clamp(18px, 2.6vh, 28px);
--mar-frame-gap: clamp(6px, 0.9vh, 12px);
--mar-map-min: clamp(240px, 33vh, 360px);
font-size: clamp(11px, 1.0vh, 13px);
--mar-pad-x: clamp(10px, 1.1vw, 14px);
--mar-pad-y: clamp(8px, 0.9vh, 12px);
--mar-gap: clamp(8px, 0.9vh, 12px);
--mar-kpi-h: clamp(62px, 7.2vh, 78px);
--mar-card-head-h: clamp(32px, 3.6vh, 38px);
--mar-card-body-pad: clamp(6px, 0.9vh, 10px);
--mar-frame-h: clamp(14px, 2.0vh, 20px);
--mar-frame-gap: clamp(4px, 0.6vh, 8px);
/* 重要:避免中心入口的 min-height 撑破网格,导致底部卡片被挤出屏幕 */
--mar-map-min: 0px;
background: linear-gradient(180deg,
#020c1b 0%,
#051525 25%,
@@ -121,47 +125,50 @@
}
.maritime-dashboard--compact-1 {
--mar-pad-x: clamp(10px, 1.1vw, 16px);
--mar-pad-y: clamp(8px, 1.0vh, 12px);
--mar-gap: clamp(8px, 1.0vh, 12px);
--mar-kpi-h: clamp(64px, 8vh, 78px);
--mar-card-head-h: clamp(34px, 4.0vh, 40px);
--mar-card-body-pad: clamp(6px, 0.9vh, 10px);
--mar-frame-h: clamp(16px, 2.2vh, 24px);
--mar-frame-gap: clamp(4px, 0.7vh, 10px);
--mar-map-min: clamp(220px, 30vh, 320px);
--mar-pad-x: clamp(8px, 0.95vw, 12px);
--mar-pad-y: clamp(6px, 0.75vh, 10px);
--mar-gap: clamp(6px, 0.75vh, 10px);
--mar-kpi-h: clamp(56px, 6.4vh, 70px);
--mar-card-head-h: clamp(30px, 3.2vh, 36px);
--mar-card-body-pad: clamp(6px, 0.75vh, 9px);
--mar-frame-h: clamp(12px, 1.8vh, 18px);
--mar-frame-gap: clamp(3px, 0.5vh, 7px);
--mar-map-min: 0px;
}
.maritime-dashboard--compact-2 {
--mar-pad-x: clamp(8px, 1.0vw, 14px);
--mar-pad-y: clamp(6px, 0.8vh, 10px);
--mar-gap: clamp(6px, 0.9vh, 10px);
--mar-kpi-h: clamp(58px, 7vh, 70px);
--mar-card-head-h: clamp(32px, 3.6vh, 38px);
--mar-card-body-pad: clamp(6px, 0.8vh, 9px);
--mar-frame-h: clamp(14px, 2.0vh, 22px);
--mar-frame-gap: clamp(4px, 0.6vh, 8px);
--mar-map-min: clamp(200px, 28vh, 300px);
--mar-pad-x: clamp(6px, 0.85vw, 10px);
--mar-pad-y: clamp(4px, 0.65vh, 8px);
--mar-gap: clamp(5px, 0.65vh, 8px);
--mar-kpi-h: clamp(52px, 6vh, 64px);
--mar-card-head-h: clamp(28px, 3.0vh, 34px);
--mar-card-body-pad: clamp(5px, 0.65vh, 8px);
--mar-frame-h: clamp(10px, 1.6vh, 16px);
--mar-frame-gap: clamp(3px, 0.45vh, 6px);
--mar-map-min: 0px;
}
/* 主内容区域 */
.maritime-spin {
height: 100%;
min-height: 0;
display: flex;
display: block;
flex: 1;
width: 100%;
:global(.ant-spin-container) {
height: 100%;
display: flex;
flex-direction: column;
min-height: 0;
width: 100%;
}
}
.maritime-content {
flex: 1;
padding: var(--mar-pad-y) var(--mar-pad-x);
padding-bottom: calc(var(--mar-pad-y) + var(--mar-frame-h) + var(--mar-frame-gap));
/* 参考智慧城市:底部装饰条保留但尽量少占内容区高度 */
padding-bottom: calc(var(--mar-pad-y) + var(--mar-frame-h));
overflow: hidden;
position: relative;
z-index: 1;
@@ -169,6 +176,8 @@
min-height: 0;
display: flex;
flex-direction: column;
width: 100%;
box-sizing: border-box;
}
.maritime-bottom-frame {
@@ -212,23 +221,47 @@
.maritime-grid {
display: grid;
grid-template-columns: minmax(0, 25%) minmax(0, 50%) minmax(0, 25%);
grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr);
grid-template-rows: minmax(0, 1fr);
gap: var(--mar-gap);
height: 100%;
/* 只用 flex 约束高度,避免百分比高度在某些容器链路下变成不确定值 */
flex: 1;
width: 100%;
min-height: 0;
min-width: 0;
flex: 1;
justify-items: stretch;
align-items: stretch;
}
.grid-col {
display: flex;
flex-direction: column;
.maritime-dashboard .grid-col {
display: grid;
gap: var(--mar-gap);
height: 100%;
overflow: hidden;
min-height: 0;
min-width: 0;
width: 100%;
}
.maritime-dashboard .grid-col > * {
min-height: 0;
max-height: 100%;
overflow: hidden;
}
.maritime-dashboard .grid-col.left-col {
/* 4张卡片:上两张偏“静态概览”稍矮,告警为主要信息流更高,海况为补充更矮 */
grid-template-rows: minmax(0, 0.9fr) minmax(0, 0.85fr) minmax(0, 1.35fr) minmax(0, 0.55fr);
}
.maritime-dashboard .grid-col.right-col {
/* 4张卡片:概览较高,其余三张均衡 */
grid-template-rows: minmax(0, 1.15fr) minmax(0, 0.95fr) minmax(0, 1fr) minmax(0, 0.9fr);
}
.maritime-dashboard .grid-col.center-col {
/* 参考智慧城市:固定 KPI + 其余区域按比例分配,避免底部卡片被挤出屏幕 */
grid-template-rows: var(--mar-kpi-h) minmax(0, 1.35fr) minmax(0, 0.85fr);
}
/* 海事风格玻璃面板 */
@@ -269,14 +302,14 @@
:global(.ant-card-head) {
min-height: var(--mar-card-head-h);
padding: 0 14px;
padding: 0 12px;
border-bottom: 1px solid rgba(0, 180, 230, 0.15);
background: linear-gradient(90deg, rgba(0, 100, 150, 0.2), transparent);
.ant-card-head-title {
font-size: 15px;
font-size: 13px;
color: #e0f7ff;
padding: 10px 0;
padding: 8px 0;
letter-spacing: 1px;
}
}
@@ -291,6 +324,49 @@
}
}
.panel-block {
height: 100%;
min-height: 0;
}
.panel-split {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: var(--mar-gap);
height: 100%;
min-height: 0;
}
.panel-split--ratio {
grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
}
.panel-stack {
display: grid;
grid-template-rows: repeat(2, minmax(0, 1fr));
gap: var(--mar-gap);
height: 100%;
min-height: 0;
}
.panel-stack--alert {
grid-template-rows: minmax(0, 1.3fr) minmax(0, 0.7fr);
}
.panel-section {
display: flex;
flex-direction: column;
min-height: 0;
overflow: hidden;
}
.panel-subtitle {
font-size: 12px;
color: rgba(200, 230, 255, 0.7);
letter-spacing: 1px;
margin-bottom: 6px;
}
.chart-wrapper {
flex: 1;
width: 100%;
@@ -320,7 +396,7 @@
border-radius: 8px;
display: flex;
align-items: center;
padding: 0 16px;
padding: 0 12px;
position: relative;
overflow: hidden;
@@ -336,10 +412,10 @@
}
.kpi-icon {
font-size: 26px;
margin-right: 14px;
width: 46px;
height: 46px;
font-size: 22px;
margin-right: 10px;
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
@@ -355,7 +431,7 @@
.kpi-info {
.label { font-size: 12px; color: rgba(200, 230, 255, 0.7); }
.value {
font-size: 26px;
font-size: 22px;
font-weight: bold;
color: #fff;
font-family: 'Segoe UI', sans-serif;
@@ -370,6 +446,7 @@
.map-portal-wrapper {
flex: 2;
min-height: var(--mar-map-min);
height: 100%;
position: relative;
background: linear-gradient(180deg, rgba(0, 40, 80, 0.5) 0%, rgba(0, 60, 100, 0.3) 100%);
border: 1px solid rgba(0, 180, 230, 0.35);
@@ -442,8 +519,8 @@
.portal-center {
text-align: center;
width: 320px;
height: 320px;
width: clamp(240px, 16vw, 300px);
height: clamp(240px, 16vw, 300px);
display: flex;
flex-direction: column;
align-items: center;
@@ -474,16 +551,16 @@
.portal-title {
color: #e0f7ff;
margin-bottom: 20px;
font-size: 20px;
margin-bottom: 14px;
font-size: 18px;
letter-spacing: 3px;
text-shadow: 0 0 15px rgba(0, 200, 255, 0.5);
}
.portal-btn {
height: 46px;
padding: 0 36px;
font-size: 15px;
height: 42px;
padding: 0 30px;
font-size: 14px;
background: linear-gradient(135deg, #0096c7 0%, #0077b6 100%);
border: none;
box-shadow: 0 4px 20px rgba(0, 150, 200, 0.4);
@@ -501,6 +578,8 @@
/* 告警列表 - 海事风格 */
.alert-list-container {
flex: 1;
min-height: 0;
height: 100%;
overflow-y: auto;
@@ -576,11 +655,31 @@
}
}
.task-success {
margin-top: 16px;
text-align: center;
.rate {
font-size: 32px;
font-weight: bold;
color: #00e5a0;
}
.label {
font-size: 14px;
color: #e0f7ff;
margin-top: 4px;
}
}
/* 气象信息面板 */
.weather-panel {
display: flex;
flex-wrap: wrap;
gap: 12px;
flex: 1;
min-height: 0;
align-content: flex-start;
.weather-item {
flex: 1;
@@ -613,6 +712,13 @@
/* 港口状态 */
.port-status-list {
display: flex;
flex-direction: column;
gap: 8px;
flex: 1;
min-height: 0;
overflow-y: auto;
.port-item {
display: flex;
align-items: center;
@@ -620,7 +726,7 @@
padding: 10px 12px;
background: rgba(0, 80, 120, 0.25);
border-radius: 6px;
margin-bottom: 8px;
margin-bottom: 0;
border-left: 3px solid #00b4d8;
.port-name {
@@ -724,9 +830,19 @@
}
/* 响应式布局 */
@media (max-width: 1400px) {
@media (max-width: 1680px) {
.maritime-grid {
grid-template-columns: 28% 44% 28%;
grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.8fr) minmax(0, 1.1fr);
}
}
@media (max-width: 1440px) {
.maritime-grid {
grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.6fr) minmax(0, 1.2fr);
}
}
@@ -746,7 +862,10 @@
grid-template-rows: auto;
}
.grid-col {
.maritime-dashboard .grid-col {
display: flex;
flex-direction: column;
gap: var(--mar-gap);
height: auto;
min-height: 400px;
}
@@ -1,34 +1,22 @@
import React, { useState, useEffect, useCallback, useMemo } from 'react';
import { Card, Button, List, Tag, Spin, message, DatePicker, Segmented, Space } from 'antd';
import {
WarningOutlined,
RocketOutlined,
CompassOutlined,
PieChartOutlined,
EnvironmentOutlined,
} from '@ant-design/icons';
import { Line, Pie, Column, Area, Rose } from '@ant-design/plots';
import { history } from 'umi';
import { Spin, message } from 'antd';
import dayjs from 'dayjs';
import type { AlertItem, DeviceStats, TaskStats, TrendItem } from '@/services/dashboard';
import { getDeviceStats, getTaskStats, getTrendData } from '@/services/dashboard';
import {
getDeviceStats,
getTaskStats,
getTrendData,
getMockAlerts,
DeviceStats,
TaskStats,
TrendItem,
AlertItem,
} from '@/services/dashboard';
MaritimeKpiStrip,
DeviceTypeCard,
PortStatusCard,
MaritimeAlertCard,
WeatherCard,
SeaAreaPortal,
AnnualTrendChart,
TaskTypeChart,
TaskOverviewCard,
MaritimeInsightCard,
} from './components';
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);
@@ -42,19 +30,19 @@ const MaritimeDashboard: React.FC = () => {
const [taskStatDate, setTaskStatDate] = useState(dayjs());
const [tenantId, setTenantId] = useState<string | undefined>();
const [includeChildren, setIncludeChildren] = useState<boolean>(true);
const [compactLevel, setCompactLevel] = useState<0 | 1 | 2>(0);
useEffect(() => {
const calc = () => {
const height = window?.innerHeight || 0;
const next: 0 | 1 | 2 = height <= 760 ? 2 : height <= 900 ? 1 : 0;
setCompactLevel(next);
};
calc();
window.addEventListener('resize', calc);
return () => window.removeEventListener('resize', calc);
// 海事专用告警数据
const getMaritimeAlerts = useCallback((): 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(() => {
// 模拟年度数据
const mockAnnual: any[] = [];
@@ -90,6 +78,7 @@ const MaritimeDashboard: React.FC = () => {
]);
}, []);
// 监听租户变化
useEffect(() => {
const handler = (e: any) => {
const nextTenantId = e?.detail?.tenantId as string | undefined;
@@ -101,6 +90,7 @@ const MaritimeDashboard: React.FC = () => {
return () => window.removeEventListener('tenant-change', handler as any);
}, []);
// 获取数据
const fetchData = useCallback(async () => {
setLoading(true);
try {
@@ -122,7 +112,6 @@ const MaritimeDashboard: React.FC = () => {
setDeviceStats(deviceRes);
setTaskStats(taskRes);
setTaskTrend(trendRes.taskTrend);
// 模拟海事告警数据
setAlerts(getMaritimeAlerts());
} catch (error) {
console.error('获取数据失败:', error);
@@ -130,258 +119,36 @@ const MaritimeDashboard: React.FC = () => {
} 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() },
];
};
}, [getMaritimeAlerts, includeChildren, taskStatDate, taskStatType, tenantId]);
// 初始化和定时刷新数据
useEffect(() => {
if (!tenantId) return;
fetchData();
}, [fetchData]);
// 定时刷新
useEffect(() => {
const dataTimer = setInterval(fetchData, 30000);
return () => {
clearInterval(dataTimer);
};
}, [fetchData]);
const goTo3D = () => {
// 传递来源页面,以便从map3d返回时能回到正确的大屏
history.push('/map3d?from=maritime');
};
// --- 图表配置 ---
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]);
// 近7日任务完成数趋势数据
const taskCompleteTrendData = useMemo(() => {
return taskTrend.map((t) => ({
date: t.date,
value: t.completed || 0,
}));
}, [taskTrend]);
const chartHeights = useMemo(() => {
if (compactLevel === 2) {
return {
taskTrend: 140,
pie: 160,
column: 140,
taskComplete: 120,
area: 170,
rose: 160,
taskStatus: 150,
};
}
if (compactLevel === 1) {
return {
taskTrend: 160,
pie: 180,
column: 160,
taskComplete: 140,
area: 190,
rose: 180,
taskStatus: 170,
};
}
return {
taskTrend: 180,
pie: 200,
column: 180,
taskComplete: 160,
area: 220,
rose: 200,
taskStatus: 190,
};
}, [compactLevel]);
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: chartHeights.taskTrend,
};
// 设备类型分布 - 模拟数据
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: chartHeights.pie,
};
const columnConfig: any = {
data: taskTypeData,
xField: 'type',
yField: 'value',
seriesField: 'type',
color: ({ type }: any) => {
if (type === '航线巡检') return '#00b4d8';
if (type === '定点监测') return '#00e5a0';
return '#ff9f43';
},
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: chartHeights.column,
};
const taskCompleteTrendConfig: any = {
data: taskCompleteTrendData,
xField: 'date',
yField: 'value',
smooth: true,
color: '#00e5a0',
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: chartHeights.taskComplete,
};
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: chartHeights.area,
};
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: chartHeights.rose,
};
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: chartHeights.taskStatus,
};
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]);
// 使用 CSS Grid 强制分配高度(类似智慧城市首页)
const gap = 12;
return (
<div className={`maritime-dashboard maritime-dashboard--compact-${compactLevel}`}>
<div style={{
width: '100%',
height: '100%',
background: 'var(--bg-primary)',
overflow: 'hidden',
padding: 12,
boxSizing: 'border-box',
}}>
{/* 保留海事背景装饰 */}
<div className="wave-bg-animation"></div>
<div className="wave-layer"></div>
<div className="wave-layer-2"></div>
@@ -389,194 +156,104 @@ const MaritimeDashboard: React.FC = () => {
<div className="maritime-bottom-frame" aria-hidden="true" />
<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 {...taskCompleteTrendConfig} />
</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 style={{
display: 'grid',
gridTemplateColumns: '25% 50% 25%',
gap: gap,
height: 'calc(100vh - 80px - 24px)',
width: '100%',
}}>
{/* 左侧栏 - CSS Grid 四个卡片分配,设备类型分布给更多空间 */}
<div style={{
display: 'grid',
gridTemplateRows: '1.2fr 1fr 1.1fr 0.7fr',
gap: gap,
height: '100%',
minHeight: 0,
overflow: 'hidden',
}}>
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
<DeviceTypeCard deviceStats={deviceStats} />
</div>
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
<PortStatusCard
deviceStats={deviceStats}
taskStats={taskStats}
alerts={alerts}
/>
</div>
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
<MaritimeAlertCard alerts={alerts} />
</div>
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
<WeatherCard />
</div>
</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"><EnvironmentOutlined /></div>
<div className="kpi-info">
<div className="label">海域总数</div>
<div className="value">{deviceStats?.tourismCount || 0}</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>
{/* 中间栏 - KPI固定70px + 海域门户 + 年度趋势和任务类型左右并排 */}
<div style={{
display: 'grid',
gridTemplateRows: '70px 1fr 1fr',
gap: gap,
height: '100%',
minHeight: 0,
overflow: 'hidden',
}}>
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
<MaritimeKpiStrip
deviceTotal={deviceStats?.total || 0}
seaAreaCount={deviceStats?.tourismCount || 0}
todayNew={taskStats?.todayNew || 0}
successRate={taskStats?.successRate || 0}
taskNewLabel={taskNewLabel}
/>
</div>
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
<SeaAreaPortal />
</div>
{/* 年度趋势和任务类型左右并排 */}
<div style={{
display: 'grid',
gridTemplateColumns: '1fr 1fr',
gap: gap,
minHeight: 0,
maxHeight: '100%',
overflow: 'hidden',
}}>
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
<AnnualTrendChart annualData={annualData} />
</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 style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
<TaskTypeChart taskTypeData={taskTypeData} />
</div>
{/* 年度巡检任务趋势 */}
<Card title="年度巡检任务趋势分析" className="panel-card ocean-glass fill-bottom" size="small">
<div className="chart-wrapper">
<Area {...areaConfig} />
</div>
</Card>
</div>
</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>
{/* 右侧栏 - CSS Grid 各50% */}
<div style={{
display: 'grid',
gridTemplateRows: '1fr 1fr',
gap: gap,
height: '100%',
minHeight: 0,
overflow: 'hidden',
}}>
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
<TaskOverviewCard
taskStats={taskStats}
taskStatType={taskStatType}
taskStatDate={taskStatDate}
onStatTypeChange={setTaskStatType}
onDateChange={setTaskStatDate}
/>
</div>
<div style={{ minHeight: 0, maxHeight: '100%', overflow: 'hidden' }}>
<MaritimeInsightCard
taskStats={taskStats}
taskTrend={taskTrend}
violationAnalysisData={violationAnalysisData}
/>
</div>
</div>
</div>
</Spin>