import React from 'react'; import { Card, Tabs, Carousel, Empty, Tag, Progress } from 'antd'; import { AlertOutlined } from '@ant-design/icons'; import { Pie } from '@ant-design/plots'; import './card.less'; interface AiSnapshot { id: string; tag: string; timeText: string; title: string; location: string; confidence: number; severity: string; } interface RegionCoverage { id: string; name: string; coverage: number; pending: number; risk: string; updatedAt: string; } interface DroneInsightCardProps { aiSnapshots: AiSnapshot[]; fleet: { avgBattery: number; lowBatteryAlerts: number; flightHoursToday: number; flightMileageToday: number; dockOnline: number; dockTotal: number; droneInFlight: number; droneStandby: number; droneMaintenance: number; droneOnline: number; droneTotal: number; }; airspace: { complianceIndex: number; safetyIndex: number; geofenceTriggers: number; noFlyWarnings: number; approvalsToday: number; approvalsPassRate: number; }; regionCoverage: RegionCoverage[]; compactLevel: 0 | 1 | 2; snapshotsPerPage: number; airspaceGaugeSize: number; } const regionRiskColor = (risk: string) => { if (risk === 'critical') return '#ff4757'; if (risk === 'warning') return '#ffb800'; return '#00ff88'; }; const DroneInsightCard: React.FC = ({ aiSnapshots, fleet, airspace, regionCoverage, compactLevel, snapshotsPerPage, airspaceGaugeSize, }) => { const droneStatusPieConfig: any = React.useMemo(() => { const total = fleet.droneInFlight + fleet.droneStandby + fleet.droneMaintenance; if (!total) return {}; return { data: [ { type: '在飞', value: fleet.droneInFlight }, { type: '待命', value: fleet.droneStandby }, { type: '维护', value: fleet.droneMaintenance }, ], angleField: 'value', colorField: 'type', radius: 0.92, innerRadius: 0.62, color: ['rgba(157, 78, 221, 0.95)', 'rgba(0, 212, 255, 0.9)', 'rgba(255, 184, 0, 0.92)'], legend: false, label: false, statistic: { title: false, content: { style: { color: 'rgba(255,255,255,0.88)', fontSize: 18, fontWeight: 700, whiteSpace: 'pre-line' }, content: `${fleet.droneOnline}/${fleet.droneTotal}\n在线`, }, }, autoFit: true, }; }, [fleet]); const visibleRegionCoverage = React.useMemo(() => { const max = compactLevel === 2 ? 2 : compactLevel === 1 ? 4 : 6; return regionCoverage.slice(0, max); }, [regionCoverage, compactLevel]); return ( 无人机态势与AI洞察 } className="dashboard-card glass-panel" size="small" style={{ height: '100%', minHeight: 0, maxHeight: '100%' }} styles={{ header: { flex: '0 0 auto', minHeight: 40, padding: '0 12px', borderBottom: '1px solid rgba(0, 212, 255, 0.1)' }, body: { flex: 1, padding: 12, overflow: 'hidden', display: 'flex', flexDirection: 'column', minHeight: 0 }, }} >
平均电量
{fleet.avgBattery}%
低电 {fleet.lowBatteryAlerts} 起
飞行时长
{fleet.flightHoursToday}h
今日累计
飞行里程
{fleet.flightMileageToday}km
含航线复飞
可用机库
{fleet.dockOnline}/{fleet.dockTotal}
在线/总量
机队状态占比
{Object.keys(droneStatusPieConfig).length ? ( ) : ( )}
重点区域覆盖
{visibleRegionCoverage.map((r) => (
{r.name} {r.risk === 'critical' ? '高风险' : r.risk === 'warning' ? '关注' : '正常'} {r.updatedAt}
{r.coverage}% 待处置 {r.pending}
))}
), }, { key: 'snap', label: 'AI快照', children: (
{new Array(Math.max(1, Math.ceil(aiSnapshots.length / snapshotsPerPage))) .fill(0) .map((_, pageIdx) => { const start = pageIdx * snapshotsPerPage; const page = aiSnapshots.slice(start, start + snapshotsPerPage); return (
{page.map((s) => (
{s.tag} {s.timeText}
{s.title}
{s.location} 置信度 {s.confidence}%
))}
); })}
), }, { key: 'airspace', label: '空域合规', children: (
合规指数
围栏/禁飞/审批综合
城市安全指数 {airspace.safetyIndex}
{airspace.geofenceTriggers}
围栏触发
{airspace.noFlyWarnings}
禁飞预警
{airspace.approvalsToday}
今日审批
{airspace.approvalsPassRate}%
通过率
重点区域启用"低空走廊",优先保障应急任务快速通行。
{compactLevel === 2 ? null : ( <>
围栏触发或禁飞预警上升时,建议自动降级为"复核模式"。
审批通过率稳定后,可扩大夜航与多机协同策略的投放比例。
)}
), }, ]} />
); }; export default DroneInsightCard;