feat: 短信服务

This commit is contained in:
2026-01-19 17:12:43 +08:00
parent f7a5a20549
commit 98304d27b7
40 changed files with 4887 additions and 2131 deletions
+9
View File
@@ -57,12 +57,21 @@ body {
/* Ant Design 覆盖 */
.ant-layout {
background: var(--bg-primary) !important;
height: 100%;
min-height: 0;
}
.ant-layout-header {
flex: 0 0 auto;
background: var(--bg-secondary) !important;
}
.ant-layout-content {
flex: 1;
min-height: 0;
overflow: hidden;
}
.ant-card {
background: var(--bg-card) !important;
border-color: var(--border-color) !important;
+27 -11
View File
@@ -1,7 +1,13 @@
.blank-layout {
min-height: 100vh;
height: 100vh;
height: 100dvh;
max-height: 100vh;
max-height: 100dvh;
overflow: hidden;
background: var(--bg-primary);
/* Dashboard 高度自适应:同一份变量同时驱动 Header 与 Content,避免“减去固定像素”导致不同屏幕被遮挡 */
display: flex;
flex-direction: column;
/* Dashboard 高度自适应:同一份变量同时驱动 Header 与 Content,避免"减去固定像素"导致不同屏幕被遮挡 */
--dashboard-header-h: 80px;
}
@@ -18,6 +24,7 @@
}
.blank-header {
flex: 0 0 auto;
display: flex;
align-items: center;
justify-content: space-between;
@@ -27,8 +34,7 @@
background: linear-gradient(180deg, rgba(19, 26, 61, 0.98) 0%, rgba(10, 14, 39, 0.95) 100%) !important;
border-bottom: 1px solid var(--border-color);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
position: sticky;
top: 0;
position: relative;
z-index: 100;
}
@@ -100,18 +106,16 @@
}
.blank-content {
height: calc(100vh - 56px);
height: calc(100dvh - 56px);
flex: 1;
min-height: 0;
overflow: auto;
background: var(--bg-primary);
min-height: 0;
}
.blank-content--dashboard {
height: calc(100vh - var(--dashboard-header-h));
height: calc(100dvh - var(--dashboard-header-h));
overflow: hidden;
flex: 1;
min-height: 0;
overflow: hidden;
display: flex;
flex-direction: column;
@@ -209,6 +213,7 @@
}
.blank-header--dashboard {
flex: 0 0 var(--dashboard-header-h);
height: var(--dashboard-header-h);
line-height: var(--dashboard-header-h);
padding: 0 22px;
@@ -218,7 +223,7 @@
box-shadow:
0 2px 12px rgba(0, 0, 0, 0.28),
inset 0 -1px 0 rgba(0, 212, 255, 0.18);
position: sticky;
position: relative;
&::before {
content: '';
@@ -597,12 +602,23 @@
.blank-content--maritime {
height: calc(100vh - 88px);
height: calc(100dvh - 88px);
overflow: hidden;
min-height: 0;
width: 100%;
display: flex;
flex-direction: column;
background: linear-gradient(180deg,
#020c1b 0%,
#071a2f 30%,
#0c2340 60%,
#0f2847 100%);
> * {
flex: 1;
min-height: 0;
min-width: 0;
}
}
@keyframes maritimeSweep {
@@ -0,0 +1,84 @@
import React from 'react';
import { Card, Tabs } from 'antd';
import { RadarChartOutlined } from '@ant-design/icons';
import { Radar, Line, Heatmap } from '@ant-design/plots';
interface CityVitalCardProps {
radarConfig: any;
envLineConfig: any;
trafficHeatmapConfig: any;
}
const CityVitalCard: React.FC<CityVitalCardProps> = ({
radarConfig,
envLineConfig,
trafficHeatmapConfig,
}) => {
return (
<Card
title={
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
<RadarChartOutlined style={{ color: 'rgba(0,212,255,0.95)' }} /> 城市运行体征
</span>
}
style={{
height: '100%',
background: 'rgba(19, 26, 61, 0.7)',
border: '1px solid rgba(0, 212, 255, 0.15)',
borderRadius: 8,
display: 'flex',
flexDirection: 'column',
}}
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 },
}}
size="small"
>
<Tabs
size="small"
style={{ height: '100%', display: 'flex', flexDirection: 'column' }}
items={[
{
key: 'grid',
label: '网格治理',
children: (
<div style={{ height: '100%', display: 'flex', flexDirection: 'column', overflow: 'hidden' }}>
<div style={{ fontSize: 12, color: 'rgba(255,255,255,0.55)', marginBottom: 8 }}>覆盖、发现、处置、复核一体化评分</div>
<div style={{ flex: 1, minHeight: 0 }}>
<Radar {...radarConfig} />
</div>
</div>
),
},
{
key: 'env',
label: '环境感知',
children: (
<div style={{ height: '100%', display: 'flex', flexDirection: 'column', overflow: 'hidden' }}>
<div style={{ fontSize: 12, color: 'rgba(255,255,255,0.55)', marginBottom: 8 }}>空地协同采集 · 24 小时滚动</div>
<div style={{ flex: 1, minHeight: 0 }}>
<Line {...envLineConfig} />
</div>
</div>
),
},
{
key: 'traffic',
label: '交通热力',
children: (
<div style={{ height: '100%', display: 'flex', flexDirection: 'column', overflow: 'hidden' }}>
<div style={{ fontSize: 12, color: 'rgba(255,255,255,0.55)', marginBottom: 8 }}>重点片区热度分布(网格化)</div>
<div style={{ flex: 1, minHeight: 0 }}>
<Heatmap {...trafficHeatmapConfig} />
</div>
</div>
),
},
]}
/>
</Card>
);
};
export default CityVitalCard;
@@ -0,0 +1,149 @@
import React from 'react';
import { Card, Space, Segmented, DatePicker } from 'antd';
import { RocketOutlined } from '@ant-design/icons';
import { Line } from '@ant-design/plots';
import dayjs from 'dayjs';
import './card.less';
interface TaskStats {
pending: number;
running: number;
completed: number;
failed: number;
successRate: number;
}
interface TrendItem {
date: string;
type: string;
value: number;
}
interface DispatchCardProps {
taskStats: TaskStats | null;
taskTrendData: TrendItem[];
taskStatType: 'day' | 'month' | 'year';
taskStatDate: dayjs.Dayjs;
onStatTypeChange: (type: 'day' | 'month' | 'year') => void;
onDateChange: (date: dayjs.Dayjs) => void;
}
const DispatchCard: React.FC<DispatchCardProps> = ({
taskStats,
taskTrendData,
taskStatType,
taskStatDate,
onStatTypeChange,
onDateChange,
}) => {
const taskPeriodText = React.useMemo(() => {
if (taskStatType === 'day') return '当日';
if (taskStatType === 'month') return '当月';
return '当年';
}, [taskStatType]);
const datePickerFormat = React.useMemo(() => {
if (taskStatType === 'day') return 'YYYY-MM-DD';
if (taskStatType === 'month') return 'YYYY-MM';
return 'YYYY';
}, [taskStatType]);
const dispatchTrendConfig: any = React.useMemo(() => {
return {
data: taskTrendData,
xField: 'date',
yField: 'value',
seriesField: 'type',
appendPadding: [2, 6, 6, 4],
smooth: true,
color: ['#00d4ff', '#00ff88', '#ffb800'],
xAxis: {
label: { style: { fill: 'rgba(255,255,255,0.62)', fontSize: 10 } },
grid: null,
},
yAxis: {
label: { style: { fill: 'rgba(255,255,255,0.62)', fontSize: 10 } },
grid: { line: { style: { stroke: 'rgba(255,255,255,0.08)' } } },
},
legend: {
position: 'top-right',
itemName: { style: { fill: 'rgba(255,255,255,0.72)', fontSize: 10 } },
itemSpacing: 8,
marker: { symbol: 'circle', style: { r: 4 } },
},
tooltip: { showMarkers: true },
autoFit: true,
};
}, [taskTrendData]);
return (
<Card
title={
<span className="panel-title">
<RocketOutlined /> {taskPeriodText}运行调度
</span>
}
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 },
}}
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}
disabledDate={(d) => !!d && d.isAfter(dayjs(), 'day')}
/>
</Space>
}
>
<div className="dispatch-grid">
<div className="dispatch-stat">
<div className="dispatch-stat__val dispatch-stat__val--pending">{taskStats?.pending || 0}</div>
<div className="dispatch-stat__lbl">待执行</div>
</div>
<div className="dispatch-stat">
<div className="dispatch-stat__val dispatch-stat__val--running">{taskStats?.running || 0}</div>
<div className="dispatch-stat__lbl">执行中</div>
</div>
<div className="dispatch-stat">
<div className="dispatch-stat__val dispatch-stat__val--done">{taskStats?.completed || 0}</div>
<div className="dispatch-stat__lbl">已完成</div>
</div>
<div className="dispatch-stat">
<div className="dispatch-stat__val dispatch-stat__val--fail">{taskStats?.failed || 0}</div>
<div className="dispatch-stat__lbl">异常</div>
</div>
<div className="dispatch-highlight">
<div className="dispatch-highlight__val">{taskStats?.successRate || 0}%</div>
<div className="dispatch-highlight__lbl">成功率</div>
</div>
</div>
<div className="dispatch-trend">
<div className="dispatch-trend__title">近 7 日任务趋势</div>
<div className="chart-wrapper">
<Line {...dispatchTrendConfig} />
</div>
</div>
</Card>
);
};
export default DispatchCard;
@@ -0,0 +1,303 @@
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<DroneInsightCardProps> = ({
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 (
<Card
title={
<span className="panel-title">
<AlertOutlined /> 无人机态势与AI洞察
</span>
}
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 },
}}
>
<Tabs
size="small"
className="dash-tabs"
defaultActiveKey="fleet"
items={[
{
key: 'fleet',
label: '机队态势',
children: (
<div className="tab-pane fleet-pane">
<div className="fleet-metrics">
<div className="fleet-metric">
<div className="fleet-metric__label">平均电量</div>
<div className="fleet-metric__value">{fleet.avgBattery}%</div>
<div className="fleet-metric__sub">低电 {fleet.lowBatteryAlerts} 起</div>
</div>
<div className="fleet-metric">
<div className="fleet-metric__label">飞行时长</div>
<div className="fleet-metric__value">{fleet.flightHoursToday}h</div>
<div className="fleet-metric__sub">今日累计</div>
</div>
<div className="fleet-metric">
<div className="fleet-metric__label">飞行里程</div>
<div className="fleet-metric__value">{fleet.flightMileageToday}km</div>
<div className="fleet-metric__sub">含航线复飞</div>
</div>
<div className="fleet-metric">
<div className="fleet-metric__label">可用机库</div>
<div className="fleet-metric__value">
{fleet.dockOnline}/{fleet.dockTotal}
</div>
<div className="fleet-metric__sub">在线/总量</div>
</div>
</div>
<div className="fleet-split">
<div className="fleet-split__left">
<div className="panel-subtitle">机队状态占比</div>
<div className="chart-wrapper">
{Object.keys(droneStatusPieConfig).length ? (
<Pie {...droneStatusPieConfig} />
) : (
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无无人机数据" />
)}
</div>
</div>
<div className="fleet-split__right">
<div className="panel-subtitle">重点区域覆盖</div>
<div className="region-list">
{visibleRegionCoverage.map((r) => (
<div key={r.id} className="region-item">
<div className="region-item__head">
<span className="region-item__name">{r.name}</span>
<span className="region-item__meta">
<Tag className="region-item__tag" color={regionRiskColor(r.risk)}>
{r.risk === 'critical' ? '高风险' : r.risk === 'warning' ? '关注' : '正常'}
</Tag>
<span className="region-item__time">{r.updatedAt}</span>
</span>
</div>
<div className="region-item__bar">
<Progress
percent={r.coverage}
size="small"
showInfo={false}
strokeColor={regionRiskColor(r.risk)}
trailColor="rgba(255,255,255,0.08)"
/>
<span className="region-item__pct">{r.coverage}%</span>
<span className="region-item__pending">待处置 {r.pending}</span>
</div>
</div>
))}
</div>
</div>
</div>
</div>
),
},
{
key: 'snap',
label: 'AI快照',
children: (
<div className="tab-pane">
<Carousel autoplay autoplaySpeed={5500} dots className="snapshot-carousel">
{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 (
<div key={`page-${pageIdx}`} className="snapshot-page">
<div className="snapshot-grid">
{page.map((s) => (
<div key={s.id} className={`snapshot-card snapshot-card--${s.severity}`}>
<div className="snapshot-card__head">
<span className="snapshot-card__tag">{s.tag}</span>
<span className="snapshot-card__time">{s.timeText}</span>
</div>
<div className="snapshot-card__title">{s.title}</div>
<div className="snapshot-card__meta">
<span className="snapshot-card__loc">{s.location}</span>
<span className="snapshot-card__conf">置信度 {s.confidence}%</span>
</div>
</div>
))}
</div>
</div>
);
})}
</Carousel>
</div>
),
},
{
key: 'airspace',
label: '空域合规',
children: (
<div className="tab-pane airspace-pane">
<div className="airspace-top">
<div className="airspace-score">
<Progress
type="dashboard"
percent={airspace.complianceIndex}
strokeColor={{
'0%': 'rgba(255, 71, 87, 0.95)',
'55%': 'rgba(255, 184, 0, 0.95)',
'100%': 'rgba(0, 255, 136, 0.95)',
}}
trailColor="rgba(255,255,255,0.08)"
size={airspaceGaugeSize}
/>
<div className="airspace-score__meta">
<div className="airspace-score__title">合规指数</div>
<div className="airspace-score__sub">围栏/禁飞/审批综合</div>
<div className="airspace-score__sub">城市安全指数 {airspace.safetyIndex}</div>
</div>
</div>
<div className="airspace-metrics">
<div className="airspace-metric">
<div className="airspace-metric__val">{airspace.geofenceTriggers}</div>
<div className="airspace-metric__lbl">围栏触发</div>
</div>
<div className="airspace-metric">
<div className="airspace-metric__val">{airspace.noFlyWarnings}</div>
<div className="airspace-metric__lbl">禁飞预警</div>
</div>
<div className="airspace-metric">
<div className="airspace-metric__val">{airspace.approvalsToday}</div>
<div className="airspace-metric__lbl">今日审批</div>
</div>
<div className="airspace-metric">
<div className="airspace-metric__val">{airspace.approvalsPassRate}%</div>
<div className="airspace-metric__lbl">通过率</div>
</div>
</div>
</div>
<div className="airspace-notes">
<div className="airspace-note">
<span className="airspace-note__dot" />
<span className="airspace-note__text">重点区域启用"低空走廊",优先保障应急任务快速通行。</span>
</div>
{compactLevel === 2 ? null : (
<>
<div className="airspace-note">
<span className="airspace-note__dot airspace-note__dot--warn" />
<span className="airspace-note__text">围栏触发或禁飞预警上升时,建议自动降级为"复核模式"。</span>
</div>
<div className="airspace-note">
<span className="airspace-note__dot airspace-note__dot--ok" />
<span className="airspace-note__text">审批通过率稳定后,可扩大夜航与多机协同策略的投放比例。</span>
</div>
</>
)}
</div>
</div>
),
},
]}
/>
</Card>
);
};
export default DroneInsightCard;
@@ -0,0 +1,260 @@
import React from 'react';
import { Card, Tabs, Empty } from 'antd';
import { EnvironmentOutlined } from '@ant-design/icons';
import { Funnel, RadialBar, Pie, Column, Rose, Line } from '@ant-design/plots';
import './card.less';
interface EventInsightCardProps {
eventFunnelData: any[];
eventTypeData: any[];
terminalPieData: any[];
taskTypeData: any[];
failureAnalysisData: any[];
annualData: any[];
}
const EventInsightCard: React.FC<EventInsightCardProps> = ({
eventFunnelData,
eventTypeData,
terminalPieData,
taskTypeData,
failureAnalysisData,
annualData,
}) => {
const funnelConfig: any = React.useMemo(() => {
return {
data: eventFunnelData,
xField: 'stage',
yField: 'value',
legend: false,
conversionTag: false,
tooltip: {
formatter: (d: any) => ({ name: d?.stage ?? d?.name ?? '阶段', value: d?.value ?? 0 }),
},
label: {
formatter: (d: any) => {
const stage = d?.stage ?? d?.name ?? d?.type ?? '阶段';
const value = d?.value ?? d?.count ?? 0;
return `${stage} ${value}`;
},
content: (d: any) => {
const stage = d?.stage ?? d?.name ?? d?.type ?? '阶段';
const value = d?.value ?? d?.count ?? 0;
return `${stage} ${value}`;
},
style: { fill: 'rgba(255,255,255,0.78)', fontSize: 12 },
},
color: ['#00d4ff', '#00ff88', '#ffb800', '#9d4edd', '#00d4ff'],
autoFit: true,
};
}, [eventFunnelData]);
const eventRadialConfig: any = React.useMemo(() => {
return {
data: eventTypeData,
xField: 'type',
yField: 'value',
radius: 0.88,
innerRadius: 0.25,
colorField: 'type',
color: ['#00d4ff', '#00ff88', '#ffb800', '#9d4edd', '#ff4757', '#13c2c2'],
legend: false,
label: { style: { fill: 'rgba(255,255,255,0.72)' } },
autoFit: true,
};
}, [eventTypeData]);
const terminalPieConfig: any = React.useMemo(() => {
const data = terminalPieData || [];
return {
data,
angleField: 'count',
colorField: 'name',
radius: 0.8,
innerRadius: 0.58,
label: {
text: (datum: any) => {
const total = data.reduce((sum, d) => sum + (d.count || 0), 0);
const count = datum?.count ?? 0;
const percent = total > 0 ? ((count / total) * 100).toFixed(0) : '0';
return `${datum?.name || ''} ${percent}%`;
},
style: { fill: 'rgba(255,255,255,0.7)' },
},
legend: false,
autoFit: true,
};
}, [terminalPieData]);
const taskTypeColumnConfig: any = React.useMemo(() => {
return {
data: taskTypeData,
xField: 'type',
yField: 'value',
columnWidthRatio: 0.55,
color: ['#00d4ff'],
label: { style: { fill: 'rgba(255,255,255,0.85)' } },
xAxis: { label: { style: { fill: 'rgba(255,255,255,0.62)' } } },
yAxis: {
label: { style: { fill: 'rgba(255,255,255,0.62)' } },
grid: { line: { style: { stroke: 'rgba(255,255,255,0.08)' } } },
},
legend: false,
autoFit: true,
};
}, [taskTypeData]);
const riskRoseConfig: any = React.useMemo(() => {
return {
data: failureAnalysisData,
xField: 'type',
yField: 'value',
seriesField: 'type',
radius: 0.85,
innerRadius: 0.25,
colorField: 'type',
color: ['#ffb800', '#00d4ff', '#00ff88', '#9d4edd', '#ff4757', '#13c2c2'],
label: {
content: (d: any) => `${d.type}\n${d.value}`,
style: { fill: 'rgba(255,255,255,0.72)' },
},
legend: false,
autoFit: true,
};
}, [failureAnalysisData]);
const annualLineConfig: any = React.useMemo(() => {
return {
data: annualData,
xField: 'month',
yField: 'value',
seriesField: 'type',
smooth: true,
color: ['#00d4ff', '#00ff88'],
areaStyle: { fillOpacity: 0.12 },
xAxis: { label: { style: { fill: 'rgba(255,255,255,0.62)' } } },
yAxis: {
label: { style: { fill: 'rgba(255,255,255,0.62)' } },
grid: { line: { style: { stroke: 'rgba(255,255,255,0.08)' } } },
},
legend: { position: 'top', itemName: { style: { fill: 'rgba(255,255,255,0.72)' } } },
autoFit: true,
};
}, [annualData]);
return (
<Card
title={
<span className="panel-title">
<EnvironmentOutlined /> 事件处置与洞察
</span>
}
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 },
}}
>
<Tabs
size="small"
className="dash-tabs"
items={[
{
key: 'funnel',
label: '处置闭环',
children: (
<div className="tab-pane">
<div className="chart-wrapper">
<Funnel {...funnelConfig} />
</div>
</div>
),
},
{
key: 'types',
label: '类型分布',
children: (
<div className="tab-pane">
<div className="chart-wrapper">
<RadialBar {...eventRadialConfig} />
</div>
</div>
),
},
{
key: 'asset',
label: '资产构成',
children: terminalPieData?.length ? (
<div className="tab-pane">
<div className="chart-wrapper">
<Pie {...terminalPieConfig} />
</div>
</div>
) : (
<div className="tab-pane">
<div className="empty-holder">
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无资产数据" />
</div>
</div>
),
},
{
key: 'capacity',
label: '作业结构',
children: taskTypeData?.length ? (
<div className="tab-pane">
<div className="chart-wrapper">
<Column {...taskTypeColumnConfig} />
</div>
</div>
) : (
<div className="tab-pane">
<div className="empty-holder">
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无结构数据" />
</div>
</div>
),
},
{
key: 'risk',
label: '风险画像',
children: failureAnalysisData?.length ? (
<div className="tab-pane">
<div className="chart-wrapper">
<Rose {...riskRoseConfig} />
</div>
</div>
) : (
<div className="tab-pane">
<div className="empty-holder">
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无风险数据" />
</div>
</div>
),
},
{
key: 'year',
label: '年度趋势',
children: annualData?.length ? (
<div className="tab-pane">
<div className="chart-wrapper">
<Line {...annualLineConfig} />
</div>
</div>
) : (
<div className="tab-pane">
<div className="empty-holder">
<Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无年度数据" />
</div>
</div>
),
},
]}
/>
</Card>
);
};
export default EventInsightCard;
@@ -0,0 +1,93 @@
import React from 'react';
import { Card, List, Tag, Empty } from 'antd';
import { AlertOutlined } from '@ant-design/icons';
interface EventItem {
id: string;
title: string;
timeText: string;
location: string;
status: string;
source: string;
desc: string;
severity: string;
}
interface EventStreamCardProps {
events: EventItem[];
}
const severityColor = (severity: string) => {
if (severity === 'critical') return '#ff4757';
if (severity === 'warning') return '#ffb800';
return '#00d4ff';
};
const statusTagColor = (status: string) => {
if (status === '已闭环') return '#00ff88';
if (status === '处理中') return '#9d4edd';
if (status === '已派单') return '#00d4ff';
return 'rgba(255,255,255,0.25)';
};
const EventStreamCard: React.FC<EventStreamCardProps> = ({ events }) => {
return (
<Card
title={
<span style={{ color: 'rgba(255,255,255,0.92)', display: 'flex', alignItems: 'center', gap: 8 }}>
<AlertOutlined style={{ color: 'rgba(0,212,255,0.95)' }} /> 城市事件流
</span>
}
extra={<Tag color="cyan">实时</Tag>}
style={{
height: '100%',
background: 'rgba(19, 26, 61, 0.7)',
border: '1px solid rgba(0, 212, 255, 0.15)',
borderRadius: 8,
display: 'flex',
flexDirection: 'column',
}}
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 },
}}
size="small"
>
<div style={{ flex: 1, minHeight: 0, overflowY: 'auto', overflowX: 'hidden' }}>
<List
dataSource={events}
split={false}
locale={{ emptyText: <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} description="暂无事件" /> }}
renderItem={(item) => (
<List.Item style={{ padding: '10px 0', borderBottom: '1px solid rgba(255,255,255,0.06)' }}>
<div style={{ display: 'flex', gap: 10, alignItems: 'flex-start', width: '100%' }}>
<div style={{
width: 8,
height: 8,
borderRadius: '50%',
marginTop: 6,
background: severityColor(item.severity),
flexShrink: 0,
}} />
<div style={{ flex: 1, minWidth: 0 }}>
<div style={{ display: 'flex', justifyContent: 'space-between', gap: 10, marginBottom: 4 }}>
<span style={{ fontSize: 13, fontWeight: 600, color: 'rgba(255,255,255,0.92)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{item.title}</span>
<span style={{ fontSize: 12, color: 'rgba(255,255,255,0.55)', fontFamily: 'monospace' }}>{item.timeText}</span>
</div>
<div style={{ display: 'flex', flexWrap: 'wrap', gap: 6, alignItems: 'center', marginBottom: 4 }}>
<span style={{ fontSize: 12, color: 'rgba(255,255,255,0.65)' }}>{item.location}</span>
<Tag color={statusTagColor(item.status)} style={{ marginRight: 0 }}>{item.status}</Tag>
<Tag color="rgba(0,212,255,0.18)" style={{ marginRight: 0 }}>{item.source}</Tag>
</div>
<div style={{ fontSize: 12, color: 'rgba(255,255,255,0.56)', lineHeight: 1.3 }}>{item.desc}</div>
</div>
</div>
</List.Item>
)}
/>
</div>
</Card>
);
};
export default EventStreamCard;
@@ -0,0 +1,37 @@
import React from 'react';
import './card.less';
interface KpiItem {
key: string;
label: string;
value: string | number;
unit?: string;
sub?: string;
accent?: string;
}
interface KpiStripProps {
kpis: KpiItem[];
}
const KpiStrip: React.FC<KpiStripProps> = ({ kpis }) => {
return (
<div className="kpi-strip">
{kpis.map((kpi) => (
<div key={kpi.key} className={`kpi-tile kpi-tile--${kpi.accent || 'blue'}`}>
<div className="kpi-tile__head">
<span className="kpi-tile__label">{kpi.label}</span>
<span className="kpi-tile__dot" />
</div>
<div className="kpi-tile__value">
<span className="kpi-tile__num">{kpi.value}</span>
{kpi.unit ? <span className="kpi-tile__unit">{kpi.unit}</span> : null}
</div>
{kpi.sub ? <div className="kpi-tile__sub">{kpi.sub}</div> : null}
</div>
))}
</div>
);
};
export default KpiStrip;
@@ -0,0 +1,99 @@
import React from 'react';
import { Button, Tag } from 'antd';
import { SafetyCertificateOutlined, AimOutlined, EnvironmentOutlined } from '@ant-design/icons';
import { history } from 'umi';
import './card.less';
interface TwinPortalProps {
fleet: {
droneOnline: number;
droneInFlight: number;
dockOnline: number;
};
airspace: {
complianceIndex: number;
};
compactLevel: 0 | 1 | 2;
}
const TwinPortal: React.FC<TwinPortalProps> = ({ fleet, airspace, compactLevel }) => {
const goTo3D = () => {
history.push('/map3d?from=dashboard');
};
return (
<div className="twin-portal">
<div className="twin-portal__grid" />
<div className="twin-portal__sweep" />
<div className="twin-portal__overlay">
<div className="twin-portal__top">
{compactLevel === 2 ? (
<div className="twin-portal__tags">
<Tag color="cyan">事件点位</Tag>
<Tag color="green">AI识别</Tag>
</div>
) : (
<>
<div className="twin-portal__tags">
<Tag color="cyan">事件点位</Tag>
<Tag color="geekblue">航线叠加</Tag>
<Tag color="purple">电子围栏</Tag>
<Tag color="green">AI识别</Tag>
</div>
<div className="twin-portal__chips">
<span className="chip">
<SafetyCertificateOutlined /> 安全态势
</span>
<span className="chip">
<AimOutlined /> 空域管理
</span>
<span className="chip">
<EnvironmentOutlined /> 数字孪生
</span>
</div>
</>
)}
</div>
<div className="twin-portal__center">
<div className="twin-portal__title">全域数字孪生中枢</div>
<div className="twin-portal__desc">空地协同巡检 · 城市事件识别 · 应急快速响应</div>
<Button type="primary" shape="round" size="large" onClick={goTo3D} className="twin-portal__btn">
进入 3D 监控视图
</Button>
</div>
<div className="twin-portal__bottom">
<div className="mini-metric">
<span className="mini-metric__label">在线无人机</span>
<span className="mini-metric__value">{fleet.droneOnline}</span>
</div>
<div className="mini-metric">
<span className="mini-metric__label">在飞架次</span>
<span className="mini-metric__value">{fleet.droneInFlight}</span>
</div>
{compactLevel === 2 ? null : (
<>
<div className="mini-metric">
<span className="mini-metric__label">可用机库</span>
<span className="mini-metric__value">{fleet.dockOnline}</span>
</div>
<div className="mini-metric">
<span className="mini-metric__label">合规指数</span>
<span
className={`mini-metric__value${
airspace.complianceIndex < 85 ? ' mini-metric__value--warn' : ''
}`}
>
{airspace.complianceIndex}
</span>
</div>
</>
)}
</div>
</div>
</div>
);
};
export default TwinPortal;
@@ -0,0 +1,733 @@
/* 组件级样式 - 每个卡片独立管理高度 */
.dashboard-card {
height: 100%;
min-height: 0;
max-height: 100%;
display: flex;
flex-direction: column;
background: transparent !important;
border-radius: 8px;
overflow: hidden;
&.glass-panel {
position: relative;
background: rgba(19, 26, 61, 0.7) !important;
border: 1px solid rgba(0, 212, 255, 0.15) !important;
backdrop-filter: blur(8px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
&::before {
content: '';
position: absolute;
inset: 0;
pointer-events: none;
background:
linear-gradient(90deg, rgba(0, 212, 255, 0.6), transparent 60px) top left / 60px 2px no-repeat,
linear-gradient(180deg, rgba(0, 212, 255, 0.6), transparent 60px) top left / 2px 60px no-repeat,
linear-gradient(270deg, rgba(0, 212, 255, 0.6), transparent 60px) top right / 60px 2px no-repeat,
linear-gradient(180deg, rgba(0, 212, 255, 0.6), transparent 60px) top right / 2px 60px no-repeat,
linear-gradient(90deg, rgba(0, 212, 255, 0.6), transparent 60px) bottom left / 60px 2px no-repeat,
linear-gradient(0deg, rgba(0, 212, 255, 0.6), transparent 60px) bottom left / 2px 60px no-repeat,
linear-gradient(270deg, rgba(0, 212, 255, 0.6), transparent 60px) bottom right / 60px 2px no-repeat,
linear-gradient(0deg, rgba(0, 212, 255, 0.6), transparent 60px) bottom right / 2px 60px no-repeat;
opacity: 0.35;
}
}
:global(.ant-card-head) {
min-height: 40px;
padding: 0 12px;
border-bottom: 1px solid rgba(0, 212, 255, 0.1);
flex: 0 0 auto;
}
:global(.ant-card-body) {
flex: 1;
padding: 12px;
overflow: hidden;
position: relative;
display: flex;
flex-direction: column;
min-height: 0;
}
}
/* 事件列表滚动容器 */
.event-list-scroll {
flex: 1;
min-height: 0;
overflow-x: hidden;
overflow-y: auto;
padding-right: 4px;
&::-webkit-scrollbar {
width: 4px;
}
&::-webkit-scrollbar-thumb {
background: rgba(0, 212, 255, 0.22);
border-radius: 2px;
}
:global(.ant-list) {
height: auto;
}
:global(.ant-spin-nested-loading),
:global(.ant-spin-container) {
height: auto;
}
}
/* 通用样式复用 */
.panel-title {
display: inline-flex;
align-items: center;
gap: 8px;
color: rgba(255, 255, 255, 0.92);
:global(.anticon) {
color: rgba(0, 212, 255, 0.95);
}
}
.panel-subtitle {
margin: -2px 0 8px;
font-size: 12px;
color: rgba(255, 255, 255, 0.55);
letter-spacing: 0.2px;
}
.chart-wrapper {
flex: 1;
width: 100%;
min-height: 0;
overflow: hidden;
> div {
width: 100%;
height: 100%;
}
:global(canvas) {
max-width: 100%;
max-height: 100%;
}
}
/* Tabs 样式 */
.dash-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, 212, 255, 0.12);
}
:global(.ant-tabs-tab) {
color: rgba(255, 255, 255, 0.62);
}
:global(.ant-tabs-tab.ant-tabs-tab-active .ant-tabs-tab-btn) {
color: rgba(255, 255, 255, 0.92);
}
:global(.ant-tabs-ink-bar) {
background: rgba(0, 212, 255, 0.9);
}
: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;
}
}
.tab-pane {
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
overflow: hidden;
}
.empty-holder {
height: 100%;
flex: 1;
min-height: 0;
display: flex;
align-items: center;
justify-content: center;
color: rgba(255, 255, 255, 0.55);
}
/* 事件列表项样式 */
.event-item {
padding: 10px 0 !important;
border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
}
.event-item__row {
display: flex;
gap: 10px;
align-items: flex-start;
width: 100%;
}
.event-item__badge {
width: 8px;
height: 8px;
border-radius: 50%;
margin-top: 6px;
box-shadow: 0 0 12px rgba(0, 0, 0, 0.22);
flex: 0 0 auto;
}
.event-item__content {
flex: 1;
min-width: 0;
}
.event-item__head {
display: flex;
justify-content: space-between;
gap: 10px;
margin-bottom: 4px;
}
.event-item__title {
font-size: 13px;
font-weight: 600;
color: rgba(255, 255, 255, 0.92);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.event-item__time {
font-size: 12px;
color: rgba(255, 255, 255, 0.55);
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.event-item__meta {
display: flex;
flex-wrap: wrap;
gap: 6px;
align-items: center;
margin-bottom: 4px;
}
.event-item__loc {
font-size: 12px;
color: rgba(255, 255, 255, 0.65);
}
.event-item__tag {
margin-inline-end: 0 !important;
border: 1px solid rgba(255, 255, 255, 0.12) !important;
color: rgba(255, 255, 255, 0.82) !important;
}
.event-item__desc {
font-size: 12px;
color: rgba(255, 255, 255, 0.56);
line-height: 1.3;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
/* 任务筛选器样式 */
.task-filter {
:global(.ant-segmented) {
background: rgba(0, 212, 255, 0.06);
border: 1px solid rgba(0, 212, 255, 0.18);
}
:global(.ant-segmented-item-label) {
color: rgba(255, 255, 255, 0.75);
font-size: 12px;
}
:global(.ant-segmented-item-selected) {
background: rgba(0, 212, 255, 0.22) !important;
}
:global(.ant-picker) {
background: rgba(0, 212, 255, 0.06);
border: 1px solid rgba(0, 212, 255, 0.18);
color: rgba(255, 255, 255, 0.85);
}
:global(.ant-picker-input > input) {
color: rgba(255, 255, 255, 0.85);
font-size: 12px;
}
:global(.ant-picker-suffix) {
color: rgba(255, 255, 255, 0.55);
}
}
/* Dispatch 样式 */
.dispatch-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 8px;
flex: 0 0 auto;
}
.dispatch-stat {
padding: 8px 10px;
border-radius: 10px;
background: rgba(255, 255, 255, 0.04);
border: 1px solid rgba(255, 255, 255, 0.08);
}
.dispatch-stat__val {
font-size: 18px;
font-weight: 800;
color: rgba(255, 255, 255, 0.92);
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.dispatch-stat__lbl {
margin-top: 2px;
font-size: 11px;
color: rgba(255, 255, 255, 0.55);
}
.dispatch-stat__val--pending { color: rgba(255, 184, 0, 0.92); }
.dispatch-stat__val--running { color: rgba(0, 212, 255, 0.92); }
.dispatch-stat__val--done { color: rgba(0, 255, 136, 0.92); }
.dispatch-stat__val--fail { color: rgba(255, 71, 87, 0.92); }
.dispatch-highlight {
grid-column: 1 / -1;
padding: 8px 12px;
border-radius: 10px;
border: 1px solid rgba(0, 255, 136, 0.18);
background:
radial-gradient(circle at 20% 20%, rgba(0, 255, 136, 0.12), transparent 55%),
linear-gradient(180deg, rgba(19, 26, 61, 0.78), rgba(10, 14, 39, 0.62));
display: flex;
align-items: baseline;
justify-content: space-between;
}
.dispatch-highlight__val {
font-size: clamp(20px, 3vh, 28px);
font-weight: 900;
color: rgba(0, 255, 136, 0.92);
letter-spacing: 1px;
}
.dispatch-highlight__lbl {
font-size: 11px;
color: rgba(255, 255, 255, 0.60);
}
.dispatch-trend {
margin-top: 8px;
min-height: 0;
display: flex;
flex-direction: column;
flex: 1;
overflow: hidden;
}
.dispatch-trend .chart-wrapper {
flex: 1;
min-height: 80px;
padding: 0 4px 4px;
box-sizing: border-box;
overflow: hidden;
}
.dispatch-trend__title {
margin-bottom: 4px;
font-size: 11px;
color: rgba(255, 255, 255, 0.56);
}
/* 机队态势样式 */
.fleet-pane {
gap: 12px;
overflow: hidden;
}
.fleet-metrics {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 12px;
}
.fleet-metric {
padding: 10px 12px;
border-radius: 12px;
border: 1px solid rgba(255, 255, 255, 0.10);
background:
radial-gradient(circle at 25% 20%, rgba(0, 212, 255, 0.14), transparent 55%),
linear-gradient(180deg, rgba(19, 26, 61, 0.74), rgba(10, 14, 39, 0.62));
}
.fleet-metric__label {
font-size: 12px;
color: rgba(255, 255, 255, 0.58);
}
.fleet-metric__value {
margin-top: 6px;
font-size: 22px;
font-weight: 800;
color: rgba(255, 255, 255, 0.92);
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.fleet-metric__sub {
margin-top: 4px;
font-size: 12px;
color: rgba(255, 255, 255, 0.52);
}
.fleet-split {
flex: 1;
min-height: 0;
display: grid;
grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
gap: 12px;
}
.fleet-split__left,
.fleet-split__right {
min-height: 0;
border-radius: 12px;
border: 1px solid rgba(255, 255, 255, 0.10);
background: rgba(255, 255, 255, 0.03);
padding: 10px 12px;
display: flex;
flex-direction: column;
}
.region-list {
flex: 1;
min-height: 0;
overflow: hidden;
padding-right: 2px;
&::-webkit-scrollbar {
width: 4px;
}
&::-webkit-scrollbar-thumb {
background: rgba(0, 212, 255, 0.18);
border-radius: 2px;
}
}
.region-item {
padding: 8px 10px 6px;
border-radius: 10px;
background: rgba(255, 255, 255, 0.02);
border: 1px solid rgba(255, 255, 255, 0.06);
margin-bottom: 8px;
}
.region-item__head {
display: flex;
justify-content: space-between;
align-items: center;
gap: 10px;
margin-bottom: 6px;
}
.region-item__name {
flex: 1;
min-width: 0;
font-size: 13px;
font-weight: 600;
color: rgba(255, 255, 255, 0.88);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.region-item__meta {
display: inline-flex;
align-items: center;
gap: 8px;
flex: 0 0 auto;
}
.region-item__tag {
margin-inline-end: 0 !important;
border: 1px solid rgba(255, 255, 255, 0.12) !important;
color: rgba(255, 255, 255, 0.86) !important;
}
.region-item__time {
font-size: 12px;
color: rgba(255, 255, 255, 0.55);
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.region-item__bar {
display: grid;
grid-template-columns: 1fr auto auto;
align-items: center;
gap: 8px;
:global(.ant-progress) {
margin: 0;
}
}
.region-item__pct {
width: 48px;
text-align: right;
font-size: 12px;
color: rgba(255, 255, 255, 0.72);
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.region-item__pending {
font-size: 12px;
color: rgba(255, 255, 255, 0.52);
white-space: nowrap;
}
/* 空域合规样式 */
.airspace-pane {
gap: 12px;
overflow: hidden;
}
.airspace-top {
display: grid;
grid-template-columns: 1.1fr 1fr;
gap: 12px;
min-height: 0;
}
.airspace-score {
display: flex;
align-items: center;
gap: 12px;
padding: 10px 12px;
border-radius: 12px;
border: 1px solid rgba(255, 255, 255, 0.10);
background:
radial-gradient(circle at 18% 24%, rgba(0, 255, 136, 0.10), transparent 55%),
linear-gradient(180deg, rgba(19, 26, 61, 0.72), rgba(10, 14, 39, 0.62));
:global(.ant-progress) {
flex: 0 0 auto;
}
}
.airspace-score__meta {
display: flex;
flex-direction: column;
gap: 4px;
min-width: 0;
}
.airspace-score__title {
font-size: 14px;
font-weight: 700;
color: rgba(255, 255, 255, 0.9);
}
.airspace-score__sub {
font-size: 12px;
color: rgba(255, 255, 255, 0.55);
}
.airspace-metrics {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12px;
}
.airspace-metric {
padding: 10px 12px;
border-radius: 12px;
border: 1px solid rgba(255, 255, 255, 0.10);
background: rgba(255, 255, 255, 0.03);
}
.airspace-metric__val {
font-size: 22px;
font-weight: 800;
color: rgba(255, 255, 255, 0.92);
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.airspace-metric__lbl {
margin-top: 4px;
font-size: 12px;
color: rgba(255, 255, 255, 0.55);
}
.airspace-notes {
flex: 1;
min-height: 0;
padding: 10px 12px;
border-radius: 12px;
border: 1px solid rgba(255, 255, 255, 0.10);
background: rgba(255, 255, 255, 0.03);
display: flex;
flex-direction: column;
gap: 10px;
}
.airspace-note {
display: flex;
gap: 10px;
align-items: flex-start;
}
.airspace-note__dot {
width: 8px;
height: 8px;
border-radius: 50%;
margin-top: 6px;
background: rgba(0, 212, 255, 0.9);
box-shadow: 0 0 10px rgba(0, 212, 255, 0.25);
flex: 0 0 auto;
}
.airspace-note__dot--warn {
background: rgba(255, 184, 0, 0.92);
box-shadow: 0 0 10px rgba(255, 184, 0, 0.25);
}
.airspace-note__dot--ok {
background: rgba(0, 255, 136, 0.92);
box-shadow: 0 0 10px rgba(0, 255, 136, 0.25);
}
.airspace-note__text {
font-size: 12px;
color: rgba(255, 255, 255, 0.62);
line-height: 1.35;
}
/* AI快照样式 */
.snapshot-carousel {
height: 100%;
flex: 1;
min-height: 0;
:global(.slick-dots) {
bottom: -2px;
}
:global(.slick-dots li button) {
background: rgba(255, 255, 255, 0.25) !important;
}
:global(.slick-dots li.slick-active button) {
background: rgba(0, 212, 255, 0.85) !important;
}
}
.snapshot-grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 12px;
}
.snapshot-card {
border-radius: 12px;
padding: 12px 12px 10px;
border: 1px solid rgba(0, 212, 255, 0.16);
background:
radial-gradient(circle at 20% 10%, rgba(0, 212, 255, 0.16), transparent 55%),
linear-gradient(180deg, rgba(19, 26, 61, 0.78), rgba(10, 14, 39, 0.62));
box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
transition: transform 0.18s ease, border-color 0.18s ease;
&:hover {
transform: translateY(-2px);
border-color: rgba(0, 212, 255, 0.28);
}
}
.snapshot-card__head {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
}
.snapshot-card__tag {
font-size: 12px;
color: rgba(255, 255, 255, 0.72);
padding: 2px 8px;
border-radius: 999px;
background: rgba(0, 212, 255, 0.10);
border: 1px solid rgba(0, 212, 255, 0.18);
}
.snapshot-card__time {
font-size: 12px;
color: rgba(255, 255, 255, 0.55);
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}
.snapshot-card__title {
font-size: clamp(13px, 1.8vh, 16px);
font-weight: 700;
color: rgba(255, 255, 255, 0.92);
margin-bottom: 6px;
}
.snapshot-card__meta {
display: flex;
justify-content: space-between;
gap: 10px;
font-size: 12px;
color: rgba(255, 255, 255, 0.62);
}
.snapshot-card--critical { border-color: rgba(255, 71, 87, 0.26); }
.snapshot-card--warning { border-color: rgba(255, 184, 0, 0.24); }
.snapshot-card--normal { border-color: rgba(0, 212, 255, 0.16); }
@media (max-width: 1440px) {
.fleet-metrics {
grid-template-columns: repeat(2, 1fr);
}
.fleet-split {
grid-template-columns: 1fr;
}
.airspace-top {
grid-template-columns: 1fr;
}
}
@@ -0,0 +1,7 @@
export { default as CityVitalCard } from './CityVitalCard';
export { default as EventStreamCard } from './EventStreamCard';
export { default as KpiStrip } from './KpiStrip';
export { default as TwinPortal } from './TwinPortal';
export { default as DroneInsightCard } from './DroneInsightCard';
export { default as DispatchCard } from './DispatchCard';
export { default as EventInsightCard } from './EventInsightCard';
@@ -0,0 +1,507 @@
// 旧版通用监控大屏(留档备查)
import React, { useState, useEffect, useCallback, useMemo } from 'react';
import { Card, Button, List, Tag, Spin, message, DatePicker, Segmented, Space } from 'antd';
import {
DesktopOutlined,
WarningOutlined,
RocketOutlined,
EnvironmentOutlined,
PieChartOutlined,
FieldTimeOutlined
} 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 Dashboard: 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 [alerts, setAlerts] = useState<AlertItem[]>([]);
const [annualData, setAnnualData] = useState<any[]>([]);
const [failureAnalysisData, setFailureAnalysisData] = useState<any[]>([]);
const [taskTypeData, setTaskTypeData] = 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);
// 模拟失败原因数据
setFailureAnalysisData([
{ type: '信号丢失', value: 27 },
{ type: '电池不足', value: 25 },
{ type: '天气原因', value: 18 },
{ type: '机械故障', value: 15 },
{ type: '人为取消', value: 10 },
{ type: '其他', value: 5 },
]);
// 任务类型分布数据
setTaskTypeData([
{ type: '航线任务', value: 156 },
{ type: '一键起飞', value: 89 },
{ type: '手动控制', value: 45 },
]);
}, []);
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);
setAlerts(getMockAlerts());
} catch (error) {
console.error('获取数据失败:', error);
message.error('数据加载异常');
} finally {
setLoading(false);
}
}, [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=dashboard');
};
// --- 图表配置 ---
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 taskTrendConfig: any = {
data: taskTrendSeriesData,
xField: 'date',
yField: 'value',
seriesField: 'type',
smooth: true,
color: ['#00d4ff', '#00ff88', '#ffb800'],
areaStyle: {
fill: 'l(270) 0:#ffffff 0.5:#7ec2f3 1:#1890ff',
fillOpacity: 0.1,
},
xAxis: { label: { style: { fill: 'rgba(255,255,255,0.65)' } }, grid: null },
yAxis: { label: { style: { fill: 'rgba(255,255,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(255,255,255,0.1)' } } } },
tooltip: { showMarkers: true },
height: 180,
};
const pieConfig: any = {
data: deviceStats?.byType || [],
angleField: 'count',
colorField: 'name',
radius: 0.7,
innerRadius: 0.5,
label: {
text: (datum: any) => {
const name = datum?.name || '';
const count = datum?.count ?? 0;
const data = (deviceStats?.byType || []) 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(255,255,255,0.65)' },
},
legend: { position: 'bottom', itemValue: { style: { fill: 'rgba(255,255,255,0.65)' } }, itemName: { style: { fill: 'rgba(255,255,255,0.65)' } } },
height: 200,
};
const columnConfig: any = {
data: taskTypeData,
xField: 'type',
yField: 'value',
seriesField: 'type',
color: ({ type }: any) => {
if(type === '航线任务') return '#00d4ff';
if(type === '一键起飞') return '#00ff88';
return '#ffb800';
},
label: {
text: (datum: any) => datum?.value?.toString() || '0',
style: { fill: '#fff' },
},
xAxis: { label: { style: { fill: 'rgba(255,255,255,0.65)' } } },
yAxis: { label: { style: { fill: 'rgba(255,255,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(255,255,255,0.1)' } } } },
legend: false,
height: 180,
};
const taskCompleteTrendConfig: any = {
data: taskCompleteTrendData,
xField: 'date',
yField: 'value',
smooth: true,
color: '#00ff88',
areaStyle: { fillOpacity: 0.15 },
xAxis: { label: { style: { fill: 'rgba(255,255,255,0.65)' } }, grid: null },
yAxis: {
label: { style: { fill: 'rgba(255,255,255,0.65)' } },
grid: { line: { style: { stroke: 'rgba(255,255,255,0.08)' } } },
},
tooltip: { showMarkers: true },
height: 160,
};
const areaConfig: any = {
data: annualData,
xField: 'month',
yField: 'value',
seriesField: 'type',
color: ['#00d4ff', '#00ff88'],
areaStyle: { fillOpacity: 0.3 },
xAxis: { label: { style: { fill: 'rgba(255,255,255,0.65)' } } },
yAxis: { label: { style: { fill: 'rgba(255,255,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(255,255,255,0.1)' } } } },
legend: { position: 'top-right', itemName: { style: { fill: '#fff' } } },
smooth: true,
height: 220,
};
const roseConfig: any = {
data: failureAnalysisData,
xField: 'type',
yField: 'value',
seriesField: 'type',
radius: 0.9,
label: {
text: (datum: any) => datum?.type || '',
style: { fill: '#fff' },
},
legend: { position: 'bottom', itemName: { style: { fill: 'rgba(255,255,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,
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(255,255,255,0.65)' },
},
legend: { position: 'bottom', itemValue: { style: { fill: 'rgba(255,255,255,0.65)' } }, itemName: { style: { fill: 'rgba(255,255,255,0.65)' } } },
height: 190,
};
const getAlertColor = (level: string) => {
switch (level) {
case 'critical': return 'red';
case 'error': return 'orange';
case 'warning': return 'gold';
default: return 'blue';
}
};
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="dashboard-page">
<div className="dashboard-bg-animation"></div>
<Spin spinning={loading} wrapperClassName="dashboard-spin">
<div className="dashboard-content">
<div className="dashboard-grid">
{/* 左侧栏:设备态势 */}
<div className="grid-col left-col">
<Card title="设备类型分布" className="panel-card glass-panel" size="small">
<div className="chart-wrapper">
<Pie {...pieConfig} />
</div>
</Card>
<Card title="任务类型统计" className="panel-card glass-panel" size="small">
<div className="chart-wrapper">
<Column {...columnConfig} />
</div>
</Card>
<Card title="近7日任务完成趋势" className="panel-card glass-panel" size="small">
<div className="chart-wrapper">
<Area {...taskCompleteTrendConfig} />
</div>
</Card>
<Card
title={<span><WarningOutlined className="icon-warning" /> 实时告警</span>}
className="panel-card glass-panel flex-grow"
size="small"
extra={<Tag color="#f50">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 blue"><DesktopOutlined /></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 green"><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 yellow"><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 purple"><PieChartOutlined /></div>
<div className="kpi-info">
<div className="label">执行成功率</div>
<div className="value">{taskStats?.successRate || 0}<small>%</small></div>
</div>
</div>
</div>
{/* 地图/3D入口 */}
<div className="map-portal-wrapper">
<div className="map-bg-grid"></div>
<div className="radar-sweep"></div>
<div className="map-content">
<div className="portal-center">
<EnvironmentOutlined style={{ fontSize: 56, color: '#00d4ff', marginBottom: 20 }} />
<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 glass-panel 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 glass-panel"
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="task-overview-grid">
<div className="task-stat-box">
<div className="val pending">{taskStats?.pending || 0}</div>
<div className="lbl">待执行</div>
</div>
<div className="task-stat-box">
<div className="val running">{taskStats?.running || 0}</div>
<div className="lbl">执行中</div>
</div>
<div className="task-stat-box">
<div className="val completed">{taskStats?.completed || 0}</div>
<div className="lbl">已完成</div>
</div>
<div className="task-stat-box">
<div className="val failed">{taskStats?.failed || 0}</div>
<div className="lbl">已失败</div>
</div>
</div>
<div style={{ marginTop: 16, textAlign: 'center' }}>
<div style={{ fontSize: '32px', fontWeight: 'bold', color: '#00ff88' }}>
{taskStats?.successRate || 0}%
</div>
<div style={{ fontSize: '14px', color: '#fff', marginTop: 4 }}>
{taskPeriodText}成功率
</div>
</div>
</Card>
<Card title="任务状态占比" className="panel-card glass-panel" size="small">
<div className="chart-wrapper">
<Pie {...taskStatusPieConfig} />
</div>
</Card>
<Card title="近7日任务趋势" className="panel-card glass-panel" size="small">
<div className="chart-wrapper">
<Line {...taskTrendConfig} />
</div>
</Card>
<Card title="异常原因分析" className="panel-card glass-panel flex-grow" size="small">
<div className="chart-wrapper">
<Rose {...roseConfig} />
</div>
</Card>
</div>
</div>
</div>
</Spin>
</div>
);
};
export default Dashboard;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,401 @@
import dayjs from 'dayjs';
import type { AlertItem, DeviceStats, TaskStats, TrendItem } from '@/services/dashboard';
type Severity = 'normal' | 'warning' | 'critical';
export interface SmartCityKpiItem {
key: string;
label: string;
value: number | string;
unit?: string;
accent?: 'blue' | 'green' | 'yellow' | 'red' | 'purple';
sub?: string;
}
export interface SmartCityEventItem {
id: string;
title: string;
location: string;
source: '无人机' | '摄像头' | '机库' | '多源融合';
severity: Severity;
status: '待确认' | '已派单' | '处理中' | '已闭环';
timeText: string;
desc: string;
}
export interface SmartCityModels {
kpis: SmartCityKpiItem[];
fleet: {
droneTotal: number;
droneOnline: number;
droneInFlight: number;
droneStandby: number;
droneMaintenance: number;
dockTotal: number;
dockOnline: number;
cameraTotal: number;
cameraOnline: number;
lowBatteryAlerts: number;
avgBattery: number;
flightHoursToday: number;
flightMileageToday: number;
};
airspace: {
safetyIndex: number;
complianceIndex: number;
geofenceTriggers: number;
noFlyWarnings: number;
approvalsToday: number;
approvalsPassRate: number;
};
regionCoverage: Array<{
id: string;
name: string;
coverage: number;
pending: number;
risk: Severity;
updatedAt: string;
}>;
terminalPieData: { name: string; count: number }[];
onlineRate: number;
liquidRate: number;
gridRadarData: { item: string; score: number; type: '当前' }[];
envTrendData: { time: string; type: string; value: number }[];
trafficHeatmapData: { x: string; y: string; value: number }[];
eventTypeData: { type: string; value: number }[];
eventFunnelData: { stage: string; value: number }[];
eventList: SmartCityEventItem[];
aiSnapshots: Array<{
id: string;
title: string;
location: string;
tag: string;
confidence: number;
timeText: string;
severity: Severity;
}>;
}
function hashStringToSeed(text: string): number {
let hash = 2166136261;
for (let i = 0; i < text.length; i++) {
hash ^= text.charCodeAt(i);
hash = Math.imul(hash, 16777619);
}
return hash >>> 0;
}
function createRng(seedText: string) {
let seed = hashStringToSeed(seedText) || 1;
return () => {
seed = (Math.imul(seed, 1664525) + 1013904223) >>> 0;
return seed / 4294967296;
};
}
function clampNumber(value: number, min: number, max: number) {
return Math.max(min, Math.min(max, value));
}
function pickOne<T>(rng: () => number, items: T[]): T {
return items[Math.floor(rng() * items.length)];
}
function mapAlertToEvent(alert: AlertItem): Omit<SmartCityEventItem, 'location' | 'source' | 'status'> & {
severity: Severity;
title: string;
} {
const severity: Severity =
alert.level === 'critical' ? 'critical' : alert.level === 'error' ? 'warning' : 'normal';
if (alert.type === 'device_offline') {
return {
id: alert.id,
title: '关键点位离线预警',
severity,
timeText: dayjs(alert.timestamp).format('HH:mm'),
desc: alert.message,
};
}
if (alert.type === 'low_battery') {
return {
id: alert.id,
title: '保障能力风险提示',
severity: severity === 'normal' ? 'warning' : severity,
timeText: dayjs(alert.timestamp).format('HH:mm'),
desc: alert.message,
};
}
if (alert.type === 'task_failed') {
return {
id: alert.id,
title: '巡检任务异常',
severity,
timeText: dayjs(alert.timestamp).format('HH:mm'),
desc: alert.message,
};
}
return {
id: alert.id,
title: '终端运行异常',
severity: severity === 'normal' ? 'warning' : severity,
timeText: dayjs(alert.timestamp).format('HH:mm'),
desc: alert.message,
};
}
function calcSafetyIndex(params: {
deviceStats?: DeviceStats | null;
taskStats?: TaskStats | null;
alerts?: AlertItem[];
baseSeed: string;
}) {
const rng = createRng(`${params.baseSeed}:safety`);
const onlineRate = params.deviceStats?.onlineRate ?? 0;
const successRate = params.taskStats?.successRate ?? 0;
const alerts = params.alerts || [];
const critical = alerts.filter((a) => a.level === 'critical').length;
const error = alerts.filter((a) => a.level === 'error').length;
const warning = alerts.filter((a) => a.level === 'warning').length;
const baseline = 90 + Math.round(rng() * 4);
const penalty = critical * 6 + error * 4 + warning * 2 + Math.round((100 - onlineRate) * 0.18);
const bonus = Math.round((successRate - 80) * 0.15);
return clampNumber(baseline - penalty + bonus, 60, 99);
}
export function buildSmartCityModels(params: {
tenantId?: string;
deviceStats?: DeviceStats | null;
taskStats?: TaskStats | null;
taskTrend?: TrendItem[];
alerts?: AlertItem[];
}): SmartCityModels {
const todayKey = dayjs().format('YYYY-MM-DD');
const baseSeed = `${params.tenantId || 'default'}:${todayKey}`;
const rng = createRng(baseSeed);
const deviceStats = params.deviceStats;
const taskStats = params.taskStats;
const taskTrend = params.taskTrend || [];
const alerts = params.alerts || [];
const onlineRate = deviceStats?.onlineRate ?? 0;
const safetyIndex = calcSafetyIndex({ deviceStats, taskStats, alerts, baseSeed });
const eventCount = alerts.length + 6 + Math.floor(rng() * 6);
const avgResponse = clampNumber(8 + Math.round((1 - (taskStats?.successRate ?? 0) / 100) * 12) + Math.round(rng() * 4), 6, 28);
const closedLoopRate = clampNumber(
taskStats?.total ? Math.round(((taskStats.completed || 0) / taskStats.total) * 100) : 70 + Math.round(rng() * 18),
40,
99,
);
const byType = deviceStats?.byType || [];
const droneTotal = byType.find((d) => d.type === 'drone')?.count || 0;
const dockTotal = byType.find((d) => d.type === 'dock')?.count || 0;
const cameraTotal = byType.find((d) => d.type === 'camera')?.count || 0;
const ratio = clampNumber((onlineRate || 0) / 100, 0, 1);
const droneOnline = clampNumber(Math.round(droneTotal * ratio * (0.94 + rng() * 0.12)), 0, droneTotal);
const dockOnline = clampNumber(Math.round(dockTotal * ratio * (0.92 + rng() * 0.14)), 0, dockTotal);
const cameraOnline = clampNumber(Math.round(cameraTotal * ratio * (0.90 + rng() * 0.16)), 0, cameraTotal);
const runningTasks = taskStats?.running || 0;
const droneInFlight = clampNumber(Math.min(droneOnline, Math.max(0, runningTasks) + Math.round(rng() * 2)), 0, droneOnline);
const droneMaintenance = clampNumber(Math.round(droneTotal * (0.06 + rng() * 0.09)), 0, droneTotal);
const droneStandby = clampNumber(droneOnline - droneInFlight - Math.min(droneMaintenance, droneOnline), 0, droneOnline);
const lowBatteryAlerts = alerts.filter((a) => a.type === 'low_battery').length;
const avgBattery = clampNumber(62 + Math.round(rng() * 28) - lowBatteryAlerts * 3, 18, 98);
const flightHoursToday = clampNumber(6 + Math.round((taskStats?.total || 0) * 0.55) + Math.round(rng() * 4), 0, 78);
const flightMileageToday = clampNumber(28 + Math.round((taskStats?.total || 0) * 2.2) + Math.round(rng() * 12), 0, 420);
const critical = alerts.filter((a) => a.level === 'critical').length;
const error = alerts.filter((a) => a.level === 'error').length;
const warning = alerts.filter((a) => a.level === 'warning').length;
const complianceIndex = clampNumber(95 - critical * 6 - error * 3 - warning * 1 - Math.round((100 - onlineRate) * 0.12) + Math.round(rng() * 2), 60, 99);
const geofenceTriggers = clampNumber(Math.round(rng() * 5) + critical + Math.floor(error / 2), 0, 12);
const noFlyWarnings = clampNumber(Math.round(rng() * 3) + Math.floor(warning / 2), 0, 10);
const approvalsToday = clampNumber(18 + Math.round(rng() * 28), 0, 120);
const approvalsPassRate = clampNumber(92 - critical * 2 - error + Math.round(rng() * 4), 70, 99);
const fleet = {
droneTotal,
droneOnline,
droneInFlight,
droneStandby,
droneMaintenance,
dockTotal,
dockOnline,
cameraTotal,
cameraOnline,
lowBatteryAlerts,
avgBattery,
flightHoursToday,
flightMileageToday,
};
const airspace = {
safetyIndex,
complianceIndex,
geofenceTriggers,
noFlyWarnings,
approvalsToday,
approvalsPassRate,
};
const kpis: SmartCityKpiItem[] = [
{ key: 'air', label: '空域合规指数', value: complianceIndex, unit: '', accent: complianceIndex >= 92 ? 'green' : complianceIndex >= 82 ? 'yellow' : 'red', sub: '围栏/禁飞/链路综合' },
{ key: 'flight', label: '在飞无人机', value: droneInFlight, unit: '架', accent: 'purple', sub: `在线 ${droneOnline}/${droneTotal}` },
{ key: 'sortie', label: '今日出动任务', value: taskStats?.todayNew ?? 0, unit: '次', accent: 'blue', sub: '巡检/应急/处置' },
{ key: 'closed', label: '问题闭环率', value: closedLoopRate, unit: '%', accent: closedLoopRate >= 85 ? 'green' : 'yellow', sub: '发现→处置→复核' },
{ key: 'online', label: '终端在线率', value: onlineRate, unit: '%', accent: onlineRate >= 90 ? 'green' : onlineRate >= 75 ? 'yellow' : 'red', sub: `低电 ${lowBatteryAlerts} 起` },
];
const terminalPieData = (deviceStats?.byType || []).map((d) => ({ name: d.name, count: d.count }));
const regionCoverage = (() => {
const regions = ['政务中心片区', '滨河公园带', '高新大道走廊', '老城商圈', '西站枢纽', '南湖片区', '工业园北区', '东门立交'];
const picked = regions.slice(0, 6);
return picked.map((name, idx) => {
const coverage = clampNumber(72 + Math.round(rng() * 26) - idx * 2, 45, 99);
const pending = clampNumber(Math.round(rng() * 8) + (idx % 2 === 0 ? 1 : 0), 0, 18);
const risk: Severity = coverage >= 88 ? 'normal' : coverage >= 76 ? 'warning' : 'critical';
const updatedAt = dayjs().subtract(5 + Math.round(rng() * 55), 'minute').format('HH:mm');
return { id: `region-${idx}`, name, coverage, pending, risk, updatedAt };
});
})();
const gridRadarData = [
{ item: '巡检覆盖', score: clampNumber(70 + Math.round(rng() * 24), 55, 98), type: '当前' as const },
{ item: '问题发现', score: clampNumber(62 + Math.round(rng() * 30), 50, 98), type: '当前' as const },
{ item: '处置效率', score: clampNumber(68 + Math.round(rng() * 22), 50, 98), type: '当前' as const },
{ item: '复核通过', score: clampNumber(72 + Math.round(rng() * 18), 55, 99), type: '当前' as const },
{ item: '重点关注', score: clampNumber(58 + Math.round(rng() * 34), 45, 98), type: '当前' as const },
];
const envTrendData: { time: string; type: string; value: number }[] = [];
const startHour = dayjs().startOf('day');
const pmBase = clampNumber(22 + Math.round(rng() * 26), 15, 60);
const noiseBase = clampNumber(52 + Math.round(rng() * 10), 45, 70);
for (let i = 0; i < 24; i++) {
const time = startHour.add(i, 'hour').format('HH:00');
const wave = Math.sin((i / 24) * Math.PI * 2);
const pm = clampNumber(pmBase + wave * 10 + (rng() - 0.5) * 6, 8, 85);
const noise = clampNumber(noiseBase + Math.abs(wave) * 9 + (rng() - 0.5) * 4, 35, 85);
envTrendData.push({ time, type: 'PM2.5', value: Number(pm.toFixed(1)) });
envTrendData.push({ time, type: '噪声(dB)', value: Number(noise.toFixed(1)) });
}
const trafficHeatmapData: { x: string; y: string; value: number }[] = [];
const cols = 10;
const rows = 6;
for (let y = 0; y < rows; y++) {
for (let x = 0; x < cols; x++) {
const centerBias = 1 - Math.abs(x - (cols - 1) / 2) / cols;
const value = clampNumber(12 + centerBias * 36 + rng() * 18 + (y % 2 === 0 ? 2 : -2), 0, 100);
trafficHeatmapData.push({ x: `${x + 1}`, y: `${rows - y}`, value: Math.round(value) });
}
}
const locations = ['政务中心', '滨河公园', '高新大道', '老城商圈', '西站枢纽', '南湖片区', '工业园北区', '东门立交'];
const sources: SmartCityEventItem['source'][] = ['无人机', '摄像头', '机库', '多源融合'];
const statuses: SmartCityEventItem['status'][] = ['待确认', '已派单', '处理中', '已闭环'];
const eventListFromAlerts: SmartCityEventItem[] = alerts.slice(0, 8).map((a, idx) => {
const base = mapAlertToEvent(a);
const status = idx === 0 ? '处理中' : idx === 1 ? '待确认' : pickOne(rng, statuses);
const source = idx % 2 === 0 ? '无人机' : '机库';
return {
...base,
location: pickOne(rng, locations),
source,
status,
};
});
const aiEventTypes = ['违停抓拍', '烟火识别', '占道经营', '河道漂浮物', '工地未戴帽', '夜间聚集'];
const aiSnapshots = new Array(10).fill(0).map((_, i) => {
const type = aiEventTypes[i % aiEventTypes.length];
const confidence = clampNumber(78 + Math.round(rng() * 20), 60, 99);
const severity: Severity = confidence >= 92 ? 'critical' : confidence >= 84 ? 'warning' : 'normal';
const timeText = dayjs().subtract(Math.round(rng() * 65), 'minute').format('HH:mm');
return {
id: `snap-${todayKey}-${i}`,
title: type,
location: pickOne(rng, locations),
tag: pickOne(rng, ['AI识别', '多源融合', '重点区域', '高频点位']),
confidence,
timeText,
severity,
};
});
const eventListGenerated: SmartCityEventItem[] = aiSnapshots.slice(0, 6).map((s, idx) => {
const severity: Severity = s.severity;
const status = idx < 2 ? '待确认' : idx < 4 ? '已派单' : pickOne(rng, statuses);
const source = idx % 3 === 0 ? '无人机' : idx % 3 === 1 ? '摄像头' : '多源融合';
return {
id: `evt-${s.id}`,
title: s.title,
location: s.location,
source,
severity,
status,
timeText: s.timeText,
desc: `疑似${s.title}(置信度 ${s.confidence}%)`,
};
});
const eventList = [...eventListGenerated, ...eventListFromAlerts].slice(0, 12);
const eventTypeCounts: Record<string, number> = {};
eventList.forEach((e) => {
const key = e.title;
eventTypeCounts[key] = (eventTypeCounts[key] || 0) + 1;
});
const eventTypeData = Object.entries(eventTypeCounts)
.map(([type, value]) => ({ type, value }))
.sort((a, b) => b.value - a.value)
.slice(0, 6);
const eventFunnelData = (() => {
const total = eventCount;
const confirmed = clampNumber(Math.round(total * (0.78 + rng() * 0.08)), 0, total);
const assigned = clampNumber(Math.round(confirmed * (0.75 + rng() * 0.1)), 0, confirmed);
const processing = clampNumber(Math.round(assigned * (0.72 + rng() * 0.12)), 0, assigned);
const closed = clampNumber(Math.round(processing * (0.78 + rng() * 0.12)), 0, processing);
return [
{ stage: '识别', value: total },
{ stage: '确认', value: confirmed },
{ stage: '派单', value: assigned },
{ stage: '处置', value: processing },
{ stage: '闭环', value: closed },
];
})();
const liquidRate = clampNumber((onlineRate || 0) / 100, 0, 1);
void taskTrend;
return {
kpis,
fleet,
airspace,
regionCoverage,
terminalPieData,
onlineRate,
liquidRate,
gridRadarData,
envTrendData,
trafficHeatmapData,
eventTypeData,
eventFunnelData,
eventList,
aiSnapshots,
};
}
@@ -5,6 +5,19 @@
position: relative;
width: 100%;
height: 100%;
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);
background: linear-gradient(180deg,
#020c1b 0%,
#051525 25%,
@@ -107,40 +120,115 @@
}
}
.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);
}
.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);
}
/* 主内容区域 */
.maritime-spin {
height: 100%;
min-height: 0;
display: flex;
flex: 1;
:global(.ant-spin-container) {
height: 100%;
display: flex;
flex-direction: column;
min-height: 0;
}
}
.maritime-content {
flex: 1;
padding: 16px 18px;
padding: var(--mar-pad-y) var(--mar-pad-x);
padding-bottom: calc(var(--mar-pad-y) + var(--mar-frame-h) + var(--mar-frame-gap));
overflow: hidden;
position: relative;
z-index: 1;
height: 100%;
min-height: 0;
display: flex;
flex-direction: column;
}
.maritime-bottom-frame {
position: absolute;
left: clamp(12px, 1.6vw, 26px);
right: clamp(12px, 1.6vw, 26px);
bottom: clamp(6px, 0.8vh, 12px);
height: var(--mar-frame-h);
border-radius: 12px;
z-index: 2;
pointer-events: none;
background:
linear-gradient(
90deg,
rgba(0, 120, 180, 0.08),
rgba(0, 180, 230, 0.7) 34%,
rgba(0, 229, 160, 0.45) 50%,
rgba(0, 180, 230, 0.7) 66%,
rgba(0, 120, 180, 0.08)
) bottom/100% 2px no-repeat,
linear-gradient(90deg, rgba(0, 220, 255, 0.85), transparent 90px) bottom left/90px 2px no-repeat,
linear-gradient(270deg, rgba(0, 220, 255, 0.85), transparent 90px) bottom right/90px 2px no-repeat,
linear-gradient(180deg, rgba(0, 180, 230, 0.6), transparent 80%) bottom left/2px 100% no-repeat,
linear-gradient(180deg, rgba(0, 180, 230, 0.6), transparent 80%) bottom right/2px 100% no-repeat;
box-shadow: 0 -6px 18px rgba(0, 120, 180, 0.3);
&::before {
content: '';
position: absolute;
left: 50%;
bottom: 6px;
width: clamp(120px, 18vw, 220px);
height: 6px;
transform: translateX(-50%);
border-radius: 999px;
background: linear-gradient(90deg, transparent, rgba(0, 220, 255, 0.85), transparent);
box-shadow: 0 0 12px rgba(0, 180, 230, 0.4);
opacity: 0.85;
}
}
.maritime-grid {
display: grid;
grid-template-columns: 25% 50% 25%;
grid-template-rows: 100%;
gap: 14px;
grid-template-columns: minmax(0, 25%) minmax(0, 50%) minmax(0, 25%);
grid-template-rows: minmax(0, 1fr);
gap: var(--mar-gap);
height: 100%;
width: 100%;
min-height: 0;
min-width: 0;
flex: 1;
}
.grid-col {
display: flex;
flex-direction: column;
gap: 14px;
gap: var(--mar-gap);
height: 100%;
overflow: hidden;
min-height: 0;
}
/* 海事风格玻璃面板 */
@@ -180,7 +268,7 @@
}
:global(.ant-card-head) {
min-height: 42px;
min-height: var(--mar-card-head-h);
padding: 0 14px;
border-bottom: 1px solid rgba(0, 180, 230, 0.15);
background: linear-gradient(90deg, rgba(0, 100, 150, 0.2), transparent);
@@ -195,7 +283,7 @@
:global(.ant-card-body) {
flex: 1;
padding: 12px;
padding: var(--mar-card-body-pad);
overflow: hidden;
position: relative;
display: flex;
@@ -222,8 +310,8 @@
.kpi-row {
display: grid;
grid-template-columns: repeat(4, 1fr);
gap: 12px;
height: 85px;
gap: var(--mar-gap);
height: var(--mar-kpi-h);
}
.kpi-card {
@@ -281,6 +369,7 @@
/* 中央海图监控区域 */
.map-portal-wrapper {
flex: 2;
min-height: var(--mar-map-min);
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);
@@ -42,6 +42,18 @@ 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);
}, []);
useEffect(() => {
// 模拟年度数据
@@ -167,6 +179,40 @@ const MaritimeDashboard: React.FC = () => {
}));
}, [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',
@@ -181,7 +227,7 @@ const MaritimeDashboard: React.FC = () => {
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,
height: chartHeights.taskTrend,
};
// 设备类型分布 - 模拟数据
@@ -213,7 +259,7 @@ const MaritimeDashboard: React.FC = () => {
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,
height: chartHeights.pie,
};
const columnConfig: any = {
@@ -233,7 +279,7 @@ const MaritimeDashboard: React.FC = () => {
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,
height: chartHeights.column,
};
const taskCompleteTrendConfig: any = {
@@ -249,7 +295,7 @@ const MaritimeDashboard: React.FC = () => {
grid: { line: { style: { stroke: 'rgba(0,150,200,0.08)' } } },
},
tooltip: { showMarkers: true },
height: 160,
height: chartHeights.taskComplete,
};
const areaConfig: any = {
@@ -263,7 +309,7 @@ const MaritimeDashboard: React.FC = () => {
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,
height: chartHeights.area,
};
const roseConfig: any = {
@@ -278,7 +324,7 @@ const MaritimeDashboard: React.FC = () => {
style: { fill: '#fff', fontSize: 10 },
},
legend: { position: 'bottom', itemName: { style: { fill: 'rgba(200,230,255,0.65)' } } },
height: 200,
height: chartHeights.rose,
};
const taskStatusPieConfig: any = {
@@ -304,7 +350,7 @@ const MaritimeDashboard: React.FC = () => {
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,
height: chartHeights.taskStatus,
};
const getAlertColor = (level: string) => {
@@ -335,11 +381,12 @@ const MaritimeDashboard: React.FC = () => {
}, [taskStatType]);
return (
<div className="maritime-dashboard">
<div className={`maritime-dashboard maritime-dashboard--compact-${compactLevel}`}>
<div className="wave-bg-animation"></div>
<div className="wave-layer"></div>
<div className="wave-layer-2"></div>
<div className="wave-layer-3"></div>
<div className="maritime-bottom-frame" aria-hidden="true" />
<Spin spinning={loading} wrapperClassName="maritime-spin">
<div className="maritime-content">