feat: 1:手机号发送验证码
2:手机号验证码登录
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user