feat: 可视化大屏展示
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
||||
EnvironmentOutlined,
|
||||
PieChartOutlined
|
||||
} from '@ant-design/icons';
|
||||
import { Line, Pie, Column, Area, Gauge, Rose } from '@ant-design/plots';
|
||||
import { Line, Pie, Column, Area, Rose } from '@ant-design/plots';
|
||||
import { history } from 'umi';
|
||||
import dayjs from 'dayjs';
|
||||
import {
|
||||
@@ -169,8 +169,14 @@ const Dashboard: React.FC = () => {
|
||||
radius: 0.7,
|
||||
innerRadius: 0.5,
|
||||
label: {
|
||||
type: 'outer',
|
||||
content: '{name} {percentage}',
|
||||
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)' } } },
|
||||
@@ -192,7 +198,7 @@ const Dashboard: React.FC = () => {
|
||||
return '#8b9dc3';
|
||||
},
|
||||
label: {
|
||||
position: 'middle',
|
||||
text: (datum: any) => datum?.value?.toString() || '0',
|
||||
style: { fill: '#fff' },
|
||||
},
|
||||
xAxis: { label: { style: { fill: 'rgba(255,255,255,0.65)' } } },
|
||||
@@ -230,7 +236,7 @@ const Dashboard: React.FC = () => {
|
||||
smooth: true,
|
||||
height: 220,
|
||||
};
|
||||
|
||||
|
||||
const roseConfig: any = {
|
||||
data: failureAnalysisData,
|
||||
xField: 'type',
|
||||
@@ -238,8 +244,7 @@ const Dashboard: React.FC = () => {
|
||||
seriesField: 'type',
|
||||
radius: 0.9,
|
||||
label: {
|
||||
offset: -15,
|
||||
content: '{name}',
|
||||
text: (datum: any) => datum?.type || '',
|
||||
style: { fill: '#fff' },
|
||||
},
|
||||
legend: { position: 'bottom', itemName: { style: { fill: 'rgba(255,255,255,0.65)' } } },
|
||||
@@ -258,8 +263,13 @@ const Dashboard: React.FC = () => {
|
||||
radius: 0.85,
|
||||
innerRadius: 0.55,
|
||||
label: {
|
||||
type: 'outer',
|
||||
content: '{name} {percentage}',
|
||||
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)' } } },
|
||||
@@ -457,21 +467,13 @@ const Dashboard: React.FC = () => {
|
||||
<div className="lbl">已失败</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ marginTop: 16 }}>
|
||||
<Gauge
|
||||
percent={taskStats?.successRate ? taskStats.successRate / 100 : 0}
|
||||
range={{ color: 'l(0) 0:#bde8ff 1:#9ec9ff' }}
|
||||
startAngle={Math.PI}
|
||||
endAngle={2 * Math.PI}
|
||||
indicator={null}
|
||||
statistic={{
|
||||
content: {
|
||||
style: { fontSize: '20px', color: '#fff' },
|
||||
formatter: () => `${taskPeriodText}成功率`,
|
||||
},
|
||||
}}
|
||||
height={100}
|
||||
/>
|
||||
<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>
|
||||
|
||||
|
||||
@@ -107,9 +107,15 @@ const Map3D: React.FC = () => {
|
||||
setSelectedTourism(null);
|
||||
};
|
||||
|
||||
// 返回大屏
|
||||
// 返回大屏 - 返回到进入时的来源页面
|
||||
const goBack = () => {
|
||||
history.push('/dashboard');
|
||||
// 检查是否有历史记录可以返回
|
||||
if (window.history.length > 1) {
|
||||
history.goBack();
|
||||
} else {
|
||||
// 没有历史记录时返回默认首页
|
||||
history.push('/');
|
||||
}
|
||||
};
|
||||
|
||||
// 全屏切换
|
||||
|
||||
@@ -0,0 +1,668 @@
|
||||
/* 海事智慧监控服务平台 - 主题样式 */
|
||||
/* 采用深海蓝色调 + 波浪动效 + 海事元素 - 区别于通用大屏 */
|
||||
|
||||
.maritime-dashboard {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: linear-gradient(180deg,
|
||||
#020c1b 0%,
|
||||
#051525 25%,
|
||||
#071e35 50%,
|
||||
#0a2845 75%,
|
||||
#0c3050 100%);
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
/* 深海光晕效果 - 更强烈的海洋感 */
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background:
|
||||
radial-gradient(ellipse 120% 80% at 15% 25%, rgba(0, 120, 180, 0.25), transparent 50%),
|
||||
radial-gradient(ellipse 100% 60% at 85% 15%, rgba(0, 180, 220, 0.2), transparent 45%),
|
||||
radial-gradient(ellipse 140% 100% at 50% 95%, rgba(0, 80, 150, 0.3), transparent 55%),
|
||||
radial-gradient(ellipse 80% 50% at 70% 60%, rgba(0, 150, 200, 0.12), transparent 40%);
|
||||
z-index: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* 深海粒子/气泡效果背景 */
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
radial-gradient(circle at 10% 20%, rgba(0, 200, 255, 0.03) 2px, transparent 2px),
|
||||
radial-gradient(circle at 30% 40%, rgba(0, 180, 230, 0.04) 1px, transparent 1px),
|
||||
radial-gradient(circle at 50% 60%, rgba(0, 220, 255, 0.03) 2px, transparent 2px),
|
||||
radial-gradient(circle at 70% 30%, rgba(0, 200, 255, 0.04) 1px, transparent 1px),
|
||||
radial-gradient(circle at 90% 80%, rgba(0, 180, 230, 0.03) 2px, transparent 2px);
|
||||
background-size: 100px 100px, 80px 80px, 120px 120px, 90px 90px, 110px 110px;
|
||||
animation: bubbleFloat 20s linear infinite;
|
||||
z-index: 0;
|
||||
pointer-events: none;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
/* 波浪网格动画背景 - 更细密的海图网格 */
|
||||
.wave-bg-animation {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(0, 150, 200, 0.08) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(0, 150, 200, 0.08) 1px, transparent 1px),
|
||||
linear-gradient(rgba(0, 180, 230, 0.04) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(0, 180, 230, 0.04) 1px, transparent 1px);
|
||||
background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px;
|
||||
animation: waveGrid 30s ease-in-out infinite;
|
||||
z-index: 0;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* 波浪层动画 - 更多层次 */
|
||||
.wave-layer {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 150px;
|
||||
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 100'%3E%3Cpath fill='%230077b6' fill-opacity='0.12' d='M0,64L48,58.7C96,53,192,43,288,48C384,53,480,75,576,80C672,85,768,75,864,64C960,53,1056,43,1152,42.7C1248,43,1344,53,1392,58.7L1440,64L1440,100L1392,100C1344,100,1248,100,1152,100C1056,100,960,100,864,100C768,100,672,100,576,100C480,100,384,100,288,100C192,100,96,100,48,100L0,100Z'%3E%3C/path%3E%3C/svg%3E") repeat-x;
|
||||
background-size: 1440px 120px;
|
||||
animation: waveMove 10s linear infinite;
|
||||
z-index: 0;
|
||||
pointer-events: none;
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.wave-layer-2 {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 100px;
|
||||
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 100'%3E%3Cpath fill='%2300b4d8' fill-opacity='0.08' d='M0,32L48,37.3C96,43,192,53,288,58.7C384,64,480,64,576,58.7C672,53,768,43,864,48C960,53,1056,75,1152,74.7C1248,75,1344,53,1392,42.7L1440,32L1440,100L1392,100C1344,100,1248,100,1152,100C1056,100,960,100,864,100C768,100,672,100,576,100C480,100,384,100,288,100C192,100,96,100,48,100L0,100Z'%3E%3C/path%3E%3C/svg%3E") repeat-x;
|
||||
background-size: 1440px 80px;
|
||||
animation: waveMove 7s linear infinite reverse;
|
||||
z-index: 0;
|
||||
pointer-events: none;
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
/* 第三层波浪 - 更有层次感 */
|
||||
.wave-layer-3 {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 60px;
|
||||
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 100'%3E%3Cpath fill='%2348cae4' fill-opacity='0.05' d='M0,50L60,45C120,40,240,30,360,35C480,40,600,60,720,65C840,70,960,60,1080,50C1200,40,1320,30,1380,25L1440,20L1440,100L1380,100C1320,100,1200,100,1080,100C960,100,840,100,720,100C600,100,480,100,360,100C240,100,120,100,60,100L0,100Z'%3E%3C/path%3E%3C/svg%3E") repeat-x;
|
||||
background-size: 1440px 60px;
|
||||
animation: waveMove 5s linear infinite;
|
||||
z-index: 0;
|
||||
pointer-events: none;
|
||||
opacity: 0.5;
|
||||
}
|
||||
}
|
||||
|
||||
/* 主内容区域 */
|
||||
.maritime-spin {
|
||||
height: 100%;
|
||||
:global(.ant-spin-container) {
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
.maritime-content {
|
||||
flex: 1;
|
||||
padding: 16px 18px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.maritime-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 25% 50% 25%;
|
||||
grid-template-rows: 100%;
|
||||
gap: 14px;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.grid-col {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* 海事风格玻璃面板 */
|
||||
.panel-card {
|
||||
background: transparent !important;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
&.ocean-glass {
|
||||
position: relative;
|
||||
background: linear-gradient(135deg, rgba(13, 33, 55, 0.85) 0%, rgba(10, 40, 70, 0.75) 100%) !important;
|
||||
border: 1px solid rgba(0, 180, 230, 0.25) !important;
|
||||
backdrop-filter: blur(12px);
|
||||
box-shadow:
|
||||
0 4px 20px rgba(0, 0, 0, 0.3),
|
||||
inset 0 1px 0 rgba(0, 200, 255, 0.1);
|
||||
overflow: hidden;
|
||||
|
||||
/* 四角装饰线 - 海事风格 */
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
pointer-events: none;
|
||||
background:
|
||||
linear-gradient(90deg, rgba(0, 180, 230, 0.7), transparent 50px) top left / 50px 2px no-repeat,
|
||||
linear-gradient(180deg, rgba(0, 180, 230, 0.7), transparent 50px) top left / 2px 50px no-repeat,
|
||||
linear-gradient(270deg, rgba(0, 180, 230, 0.7), transparent 50px) top right / 50px 2px no-repeat,
|
||||
linear-gradient(180deg, rgba(0, 180, 230, 0.7), transparent 50px) top right / 2px 50px no-repeat,
|
||||
linear-gradient(90deg, rgba(0, 180, 230, 0.7), transparent 50px) bottom left / 50px 2px no-repeat,
|
||||
linear-gradient(0deg, rgba(0, 180, 230, 0.7), transparent 50px) bottom left / 2px 50px no-repeat,
|
||||
linear-gradient(270deg, rgba(0, 180, 230, 0.7), transparent 50px) bottom right / 50px 2px no-repeat,
|
||||
linear-gradient(0deg, rgba(0, 180, 230, 0.7), transparent 50px) bottom right / 2px 50px no-repeat;
|
||||
opacity: 0.4;
|
||||
}
|
||||
}
|
||||
|
||||
:global(.ant-card-head) {
|
||||
min-height: 42px;
|
||||
padding: 0 14px;
|
||||
border-bottom: 1px solid rgba(0, 180, 230, 0.15);
|
||||
background: linear-gradient(90deg, rgba(0, 100, 150, 0.2), transparent);
|
||||
|
||||
.ant-card-head-title {
|
||||
font-size: 15px;
|
||||
color: #e0f7ff;
|
||||
padding: 10px 0;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
}
|
||||
|
||||
:global(.ant-card-body) {
|
||||
flex: 1;
|
||||
padding: 12px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
.chart-wrapper {
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
min-height: 0;
|
||||
|
||||
> div {
|
||||
height: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
.flex-grow {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
/* 海事KPI卡片行 */
|
||||
.kpi-row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 12px;
|
||||
height: 85px;
|
||||
}
|
||||
|
||||
.kpi-card {
|
||||
background: linear-gradient(135deg, rgba(0, 60, 100, 0.6) 0%, rgba(0, 80, 130, 0.4) 100%);
|
||||
border: 1px solid rgba(0, 180, 230, 0.2);
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 0 16px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
/* 卡片顶部光线 */
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 2px;
|
||||
background: linear-gradient(90deg, transparent, rgba(0, 200, 255, 0.5), transparent);
|
||||
}
|
||||
|
||||
.kpi-icon {
|
||||
font-size: 26px;
|
||||
margin-right: 14px;
|
||||
width: 46px;
|
||||
height: 46px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: rgba(0, 150, 200, 0.15);
|
||||
|
||||
&.ship { color: #00d4ff; box-shadow: 0 0 15px rgba(0, 212, 255, 0.3); }
|
||||
&.anchor { color: #00e5a0; box-shadow: 0 0 15px rgba(0, 229, 160, 0.3); }
|
||||
&.alert { color: #ff9f43; box-shadow: 0 0 15px rgba(255, 159, 67, 0.3); }
|
||||
&.route { color: #54a0ff; box-shadow: 0 0 15px rgba(84, 160, 255, 0.3); }
|
||||
}
|
||||
|
||||
.kpi-info {
|
||||
.label { font-size: 12px; color: rgba(200, 230, 255, 0.7); }
|
||||
.value {
|
||||
font-size: 26px;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
font-family: 'Segoe UI', sans-serif;
|
||||
line-height: 1.2;
|
||||
text-shadow: 0 0 10px rgba(0, 200, 255, 0.3);
|
||||
}
|
||||
small { font-size: 14px; margin-left: 2px; color: rgba(255,255,255,0.7); }
|
||||
}
|
||||
}
|
||||
|
||||
/* 中央海图监控区域 */
|
||||
.map-portal-wrapper {
|
||||
flex: 2;
|
||||
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);
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
/* 海图网格背景 */
|
||||
.nautical-grid {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
background-image:
|
||||
linear-gradient(rgba(0, 150, 200, 0.15) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgba(0, 150, 200, 0.15) 1px, transparent 1px);
|
||||
background-size: 60px 60px;
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
/* 罗盘扫描效果 */
|
||||
.compass-sweep {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: 2;
|
||||
pointer-events: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
width: 480px;
|
||||
height: 480px;
|
||||
border-radius: 50%;
|
||||
background:
|
||||
repeating-radial-gradient(circle, rgba(0, 180, 230, 0.2) 0 1px, transparent 1px 35px),
|
||||
radial-gradient(circle, rgba(0, 150, 200, 0.15), transparent 65%);
|
||||
filter: drop-shadow(0 0 20px rgba(0, 180, 230, 0.2));
|
||||
opacity: 0.6;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 480px;
|
||||
height: 480px;
|
||||
border-radius: 50%;
|
||||
background: conic-gradient(
|
||||
from 0deg,
|
||||
rgba(0, 180, 230, 0) 0deg,
|
||||
rgba(0, 180, 230, 0.35) 15deg,
|
||||
rgba(0, 200, 255, 0.08) 40deg,
|
||||
rgba(0, 180, 230, 0) 70deg,
|
||||
rgba(0, 180, 230, 0) 360deg
|
||||
);
|
||||
mix-blend-mode: screen;
|
||||
animation: compassRotate 4s linear infinite;
|
||||
opacity: 0.85;
|
||||
}
|
||||
}
|
||||
|
||||
.map-content {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.portal-center {
|
||||
text-align: center;
|
||||
width: 320px;
|
||||
height: 320px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
background: linear-gradient(135deg, rgba(10, 30, 50, 0.9) 0%, rgba(15, 40, 70, 0.85) 100%);
|
||||
padding: 0 30px;
|
||||
border-radius: 50%;
|
||||
border: 2px solid rgba(0, 180, 230, 0.4);
|
||||
box-shadow:
|
||||
0 0 40px rgba(0, 180, 230, 0.25),
|
||||
inset 0 0 30px rgba(0, 100, 150, 0.2);
|
||||
backdrop-filter: blur(8px);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
|
||||
/* 内部光晕 */
|
||||
&::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
inset: 15px;
|
||||
border-radius: 50%;
|
||||
background:
|
||||
radial-gradient(circle at 30% 30%, rgba(0, 200, 255, 0.2), transparent 50%),
|
||||
radial-gradient(circle at 70% 70%, rgba(0, 150, 200, 0.15), transparent 50%);
|
||||
opacity: 0.7;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.portal-title {
|
||||
color: #e0f7ff;
|
||||
margin-bottom: 20px;
|
||||
font-size: 20px;
|
||||
letter-spacing: 3px;
|
||||
text-shadow: 0 0 15px rgba(0, 200, 255, 0.5);
|
||||
}
|
||||
|
||||
.portal-btn {
|
||||
height: 46px;
|
||||
padding: 0 36px;
|
||||
font-size: 15px;
|
||||
background: linear-gradient(135deg, #0096c7 0%, #0077b6 100%);
|
||||
border: none;
|
||||
box-shadow: 0 4px 20px rgba(0, 150, 200, 0.4);
|
||||
transition: all 0.3s ease;
|
||||
letter-spacing: 1px;
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-3px);
|
||||
box-shadow: 0 8px 30px rgba(0, 180, 230, 0.5);
|
||||
background: linear-gradient(135deg, #00b4d8 0%, #0096c7 100%);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 告警列表 - 海事风格 */
|
||||
.alert-list-container {
|
||||
height: 100%;
|
||||
overflow-y: auto;
|
||||
|
||||
&::-webkit-scrollbar {
|
||||
width: 4px;
|
||||
}
|
||||
&::-webkit-scrollbar-thumb {
|
||||
background: rgba(0, 180, 230, 0.3);
|
||||
border-radius: 2px;
|
||||
}
|
||||
}
|
||||
|
||||
.alert-item {
|
||||
padding: 10px 0 !important;
|
||||
border-bottom: 1px solid rgba(0, 150, 200, 0.1) !important;
|
||||
|
||||
.alert-row {
|
||||
display: flex;
|
||||
width: 100%;
|
||||
align-items: flex-start;
|
||||
|
||||
.alert-badge {
|
||||
margin-right: 10px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.alert-content {
|
||||
flex: 1;
|
||||
|
||||
.alert-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 3px;
|
||||
|
||||
.alert-name { color: #e0f7ff; font-weight: 500; font-size: 13px; }
|
||||
.alert-time { color: #00b4d8; font-size: 12px; font-family: monospace; }
|
||||
}
|
||||
|
||||
.alert-msg {
|
||||
color: rgba(200, 230, 255, 0.6);
|
||||
font-size: 12px;
|
||||
line-height: 1.3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 船舶状态统计 */
|
||||
.ship-status-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(2, 1fr);
|
||||
gap: 10px;
|
||||
|
||||
.ship-stat-box {
|
||||
background: linear-gradient(135deg, rgba(0, 80, 120, 0.4) 0%, rgba(0, 60, 100, 0.3) 100%);
|
||||
padding: 12px;
|
||||
text-align: center;
|
||||
border-radius: 6px;
|
||||
border: 1px solid rgba(0, 150, 200, 0.15);
|
||||
|
||||
.val {
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
text-shadow: 0 0 8px rgba(0, 200, 255, 0.3);
|
||||
}
|
||||
.lbl { font-size: 11px; color: rgba(200, 230, 255, 0.6); margin-top: 4px; }
|
||||
|
||||
.val.sailing { color: #00e5a0; }
|
||||
.val.anchored { color: #00b4d8; }
|
||||
.val.docked { color: #54a0ff; }
|
||||
.val.warning { color: #ff9f43; }
|
||||
}
|
||||
}
|
||||
|
||||
/* 气象信息面板 */
|
||||
.weather-panel {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 12px;
|
||||
|
||||
.weather-item {
|
||||
flex: 1;
|
||||
min-width: 80px;
|
||||
text-align: center;
|
||||
padding: 10px 8px;
|
||||
background: rgba(0, 100, 150, 0.2);
|
||||
border-radius: 6px;
|
||||
border: 1px solid rgba(0, 150, 200, 0.1);
|
||||
|
||||
.weather-icon {
|
||||
font-size: 24px;
|
||||
margin-bottom: 6px;
|
||||
color: #00b4d8;
|
||||
}
|
||||
|
||||
.weather-value {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.weather-label {
|
||||
font-size: 11px;
|
||||
color: rgba(200, 230, 255, 0.6);
|
||||
margin-top: 2px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 港口状态 */
|
||||
.port-status-list {
|
||||
.port-item {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: 10px 12px;
|
||||
background: rgba(0, 80, 120, 0.25);
|
||||
border-radius: 6px;
|
||||
margin-bottom: 8px;
|
||||
border-left: 3px solid #00b4d8;
|
||||
|
||||
.port-name {
|
||||
color: #e0f7ff;
|
||||
font-size: 13px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.port-stats {
|
||||
display: flex;
|
||||
gap: 16px;
|
||||
|
||||
.stat {
|
||||
text-align: center;
|
||||
|
||||
.num { font-size: 14px; font-weight: bold; color: #00e5a0; }
|
||||
.txt { font-size: 10px; color: rgba(200, 230, 255, 0.5); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 任务过滤器 */
|
||||
.task-filter {
|
||||
:global(.ant-segmented) {
|
||||
background: rgba(0, 100, 150, 0.15);
|
||||
border: 1px solid rgba(0, 150, 200, 0.2);
|
||||
}
|
||||
|
||||
:global(.ant-segmented-item-label) {
|
||||
color: rgba(200, 230, 255, 0.75);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
:global(.ant-segmented-item-selected) {
|
||||
background: rgba(0, 150, 200, 0.3) !important;
|
||||
}
|
||||
|
||||
:global(.ant-picker) {
|
||||
background: rgba(0, 100, 150, 0.15);
|
||||
border: 1px solid rgba(0, 150, 200, 0.2);
|
||||
color: rgba(200, 230, 255, 0.85);
|
||||
}
|
||||
|
||||
:global(.ant-picker-input > input) {
|
||||
color: rgba(200, 230, 255, 0.85);
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
:global(.ant-picker-suffix) {
|
||||
color: rgba(200, 230, 255, 0.55);
|
||||
}
|
||||
}
|
||||
|
||||
/* 动画关键帧 */
|
||||
@keyframes waveGrid {
|
||||
0%, 100% {
|
||||
background-position: 0 0;
|
||||
transform: perspective(500px) rotateX(0deg);
|
||||
}
|
||||
50% {
|
||||
background-position: 25px 25px;
|
||||
transform: perspective(500px) rotateX(2deg);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes waveMove {
|
||||
0% { background-position-x: 0; }
|
||||
100% { background-position-x: 1440px; }
|
||||
}
|
||||
|
||||
@keyframes compassRotate {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
/* 气泡上浮动画 */
|
||||
@keyframes bubbleFloat {
|
||||
0% {
|
||||
background-position: 0 0, 0 0, 0 0, 0 0, 0 0;
|
||||
opacity: 0.6;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.8;
|
||||
}
|
||||
100% {
|
||||
background-position: 0 -100px, 0 -80px, 0 -120px, 0 -90px, 0 -110px;
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
/* 图标告警闪烁 */
|
||||
.icon-warning {
|
||||
color: #ff9f43;
|
||||
animation: warningPulse 1.5s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes warningPulse {
|
||||
0%, 100% { opacity: 1; }
|
||||
50% { opacity: 0.5; }
|
||||
}
|
||||
|
||||
/* 响应式布局 */
|
||||
@media (max-width: 1400px) {
|
||||
.maritime-grid {
|
||||
grid-template-columns: 28% 44% 28%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
.maritime-dashboard {
|
||||
height: auto;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.maritime-content {
|
||||
height: auto;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.maritime-grid {
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-rows: auto;
|
||||
}
|
||||
|
||||
.grid-col {
|
||||
height: auto;
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
.map-portal-wrapper {
|
||||
min-height: 320px;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,540 @@
|
||||
import React, { useState, useEffect, useCallback, useMemo } from 'react';
|
||||
import { Card, Button, List, Tag, Spin, message, DatePicker, Segmented, Space } from 'antd';
|
||||
import {
|
||||
CheckCircleOutlined,
|
||||
WarningOutlined,
|
||||
RocketOutlined,
|
||||
CompassOutlined,
|
||||
PieChartOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { Line, Pie, Column, Area, Rose } from '@ant-design/plots';
|
||||
import { history } from 'umi';
|
||||
import dayjs from 'dayjs';
|
||||
import {
|
||||
getDeviceStats,
|
||||
getTaskStats,
|
||||
getTrendData,
|
||||
getMockAlerts,
|
||||
DeviceStats,
|
||||
TaskStats,
|
||||
TrendItem,
|
||||
AlertItem,
|
||||
} from '@/services/dashboard';
|
||||
import './index.less';
|
||||
|
||||
// 无人船图标组件
|
||||
const USVIcon = () => (
|
||||
<svg viewBox="0 0 24 24" width="1em" height="1em" fill="currentColor">
|
||||
<path d="M20 21c-1.39 0-2.78-.47-4-1.32-2.44 1.71-5.56 1.71-8 0C6.78 20.53 5.39 21 4 21H2v2h2c1.38 0 2.74-.35 4-.99 2.52 1.29 5.48 1.29 8 0 1.26.64 2.63.99 4 .99h2v-2h-2zM3.95 19H4c1.6 0 3.02-.88 4-2 .98 1.12 2.4 2 4 2s3.02-.88 4-2c.98 1.12 2.4 2 4 2h.05l1.89-6.68c.08-.26.06-.54-.06-.78s-.34-.42-.6-.5L20 10.62V6c0-1.1-.9-2-2-2h-3V1H9v3H6c-1.1 0-2 .9-2 2v4.62l-1.29.42c-.26.08-.48.26-.6.5s-.15.52-.06.78L3.95 19zM6 6h12v3.97L12 8 6 9.97V6z"/>
|
||||
</svg>
|
||||
);
|
||||
|
||||
const MaritimeDashboard: React.FC = () => {
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [deviceStats, setDeviceStats] = useState<DeviceStats | null>(null);
|
||||
const [taskStats, setTaskStats] = useState<TaskStats | null>(null);
|
||||
const [taskTrend, setTaskTrend] = useState<TrendItem[]>([]);
|
||||
const [deviceTrend, setDeviceTrend] = useState<TrendItem[]>([]);
|
||||
const [alerts, setAlerts] = useState<AlertItem[]>([]);
|
||||
const [annualData, setAnnualData] = useState<any[]>([]);
|
||||
const [violationAnalysisData, setViolationAnalysisData] = useState<any[]>([]);
|
||||
const [taskStatType, setTaskStatType] = useState<'day' | 'month' | 'year'>('day');
|
||||
const [taskStatDate, setTaskStatDate] = useState(dayjs());
|
||||
const [tenantId, setTenantId] = useState<string | undefined>();
|
||||
const [includeChildren, setIncludeChildren] = useState<boolean>(true);
|
||||
|
||||
useEffect(() => {
|
||||
// 模拟年度数据
|
||||
const mockAnnual: any[] = [];
|
||||
for (let i = 1; i <= 12; i++) {
|
||||
mockAnnual.push({
|
||||
month: `${i}月`,
|
||||
value: Math.floor(Math.random() * 500) + 100,
|
||||
type: '巡检任务',
|
||||
});
|
||||
mockAnnual.push({
|
||||
month: `${i}月`,
|
||||
value: Math.floor(Math.random() * 450) + 80,
|
||||
type: '完成任务',
|
||||
});
|
||||
}
|
||||
setAnnualData(mockAnnual);
|
||||
|
||||
// 违规类型分析数据
|
||||
setViolationAnalysisData([
|
||||
{ type: '超速航行', value: 32 },
|
||||
{ type: '违规锚泊', value: 25 },
|
||||
{ type: '未按航道行驶', value: 20 },
|
||||
{ type: '证照过期', value: 12 },
|
||||
{ type: '污染排放', value: 8 },
|
||||
{ type: '其他违规', value: 3 },
|
||||
]);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
const handler = (e: any) => {
|
||||
const nextTenantId = e?.detail?.tenantId as string | undefined;
|
||||
const nextIncludeChildren = !!e?.detail?.includeChildren;
|
||||
setTenantId(nextTenantId);
|
||||
setIncludeChildren(nextIncludeChildren);
|
||||
};
|
||||
window.addEventListener('tenant-change', handler as any);
|
||||
return () => window.removeEventListener('tenant-change', handler as any);
|
||||
}, []);
|
||||
|
||||
const fetchData = useCallback(async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const [deviceRes, taskRes, trendRes] = await Promise.all([
|
||||
getDeviceStats({ tenantId, includeChildren }),
|
||||
getTaskStats({
|
||||
tenantId,
|
||||
includeChildren,
|
||||
statType: taskStatType,
|
||||
date:
|
||||
taskStatType === 'day'
|
||||
? taskStatDate.format('YYYY-MM-DD')
|
||||
: taskStatType === 'month'
|
||||
? taskStatDate.format('YYYY-MM')
|
||||
: taskStatDate.format('YYYY'),
|
||||
}),
|
||||
getTrendData(7),
|
||||
]);
|
||||
setDeviceStats(deviceRes);
|
||||
setTaskStats(taskRes);
|
||||
setTaskTrend(trendRes.taskTrend);
|
||||
setDeviceTrend(trendRes.deviceTrend);
|
||||
// 模拟海事告警数据
|
||||
setAlerts(getMaritimeAlerts());
|
||||
} catch (error) {
|
||||
console.error('获取数据失败:', error);
|
||||
message.error('数据加载异常');
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [includeChildren, taskStatDate, taskStatType, tenantId]);
|
||||
|
||||
// 海事专用告警数据
|
||||
const getMaritimeAlerts = (): AlertItem[] => {
|
||||
return [
|
||||
{ id: '1', type: 'device_fault', level: 'critical', deviceName: '巡检船-01', message: '检测到船只超速航行,航速28节', timestamp: new Date(Date.now() - 120000).toISOString() },
|
||||
{ id: '2', type: 'device_offline', level: 'error', deviceName: '巡检船-03', message: '设备信号丢失超过10分钟', timestamp: new Date(Date.now() - 300000).toISOString() },
|
||||
{ id: '3', type: 'task_failed', level: 'warning', taskName: '巡检任务#1024', message: '发现违规锚泊船只1艘', timestamp: new Date(Date.now() - 600000).toISOString() },
|
||||
{ id: '4', type: 'low_battery', level: 'warning', deviceName: '巡检船-02', message: '电池电量低于20%', timestamp: new Date(Date.now() - 900000).toISOString() },
|
||||
{ id: '5', type: 'task_failed', level: 'warning', taskName: '巡检任务#1023', message: '巡检完成,未发现违规', timestamp: new Date(Date.now() - 1200000).toISOString() },
|
||||
];
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (!tenantId) return;
|
||||
fetchData();
|
||||
}, [fetchData]);
|
||||
|
||||
// 定时刷新
|
||||
useEffect(() => {
|
||||
const dataTimer = setInterval(fetchData, 30000);
|
||||
return () => {
|
||||
clearInterval(dataTimer);
|
||||
};
|
||||
}, [fetchData]);
|
||||
|
||||
const goTo3D = () => {
|
||||
history.push('/map3d');
|
||||
};
|
||||
|
||||
// --- 图表配置 ---
|
||||
|
||||
const taskTrendSeriesData = useMemo(() => {
|
||||
return taskTrend.flatMap((t) => [
|
||||
{ date: t.date, type: '下发', value: t.created || 0 },
|
||||
{ date: t.date, type: '完成', value: t.completed || 0 },
|
||||
{ date: t.date, type: '失败', value: t.failed || 0 },
|
||||
]);
|
||||
}, [taskTrend]);
|
||||
|
||||
const deviceOnlineRateTrendData = useMemo(() => {
|
||||
return deviceTrend.map((t) => {
|
||||
const total = t.total || 0;
|
||||
const online = t.online || 0;
|
||||
return {
|
||||
date: t.date,
|
||||
value: total > 0 ? Math.round((online / total) * 100) : 0,
|
||||
};
|
||||
});
|
||||
}, [deviceTrend]);
|
||||
|
||||
const taskTrendConfig: any = {
|
||||
data: taskTrendSeriesData,
|
||||
xField: 'date',
|
||||
yField: 'value',
|
||||
seriesField: 'type',
|
||||
smooth: true,
|
||||
color: ['#00b4d8', '#00e5a0', '#ff9f43'],
|
||||
areaStyle: {
|
||||
fill: 'l(270) 0:#ffffff 0.5:#7ec2f3 1:#0077b6',
|
||||
fillOpacity: 0.1,
|
||||
},
|
||||
xAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: null },
|
||||
yAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(0,150,200,0.1)' } } } },
|
||||
tooltip: { showMarkers: true },
|
||||
height: 180,
|
||||
};
|
||||
|
||||
// 设备类型分布 - 模拟数据
|
||||
const usvTypeData: { name: string; count: number }[] = useMemo(() => {
|
||||
return (deviceStats?.byType || [
|
||||
{ name: '巡检型', count: 12 },
|
||||
{ name: '监测型', count: 8 },
|
||||
{ name: '救援型', count: 5 },
|
||||
{ name: '测量型', count: 3 },
|
||||
]).map(item => ({ name: item.name, count: item.count }));
|
||||
}, [deviceStats]);
|
||||
|
||||
const pieConfig: any = {
|
||||
data: usvTypeData,
|
||||
angleField: 'count',
|
||||
colorField: 'name',
|
||||
radius: 0.7,
|
||||
innerRadius: 0.5,
|
||||
color: ['#00b4d8', '#0096c7', '#00e5a0', '#48cae4'],
|
||||
label: {
|
||||
text: (datum: any) => {
|
||||
const name = datum?.name || '';
|
||||
const count = datum?.count ?? 0;
|
||||
const data = usvTypeData as { name: string; count: number }[];
|
||||
const total = data.reduce((sum, d) => sum + (d.count || 0), 0);
|
||||
const percent = total > 0 ? ((count / total) * 100).toFixed(1) : 0;
|
||||
return `${name} ${percent}%`;
|
||||
},
|
||||
style: { fill: 'rgba(200,230,255,0.65)' },
|
||||
},
|
||||
legend: { position: 'bottom', itemValue: { style: { fill: 'rgba(200,230,255,0.65)' } }, itemName: { style: { fill: 'rgba(200,230,255,0.65)' } } },
|
||||
height: 200,
|
||||
};
|
||||
|
||||
const columnConfig: any = {
|
||||
data: [
|
||||
{ type: '在线', value: deviceStats?.online || 0 },
|
||||
{ type: '离线', value: deviceStats?.offline || 0 },
|
||||
{ type: '故障', value: deviceStats?.fault || 0 },
|
||||
],
|
||||
xField: 'type',
|
||||
yField: 'value',
|
||||
seriesField: 'type',
|
||||
color: ({ type }: any) => {
|
||||
if (type === '在线') return '#00e5a0';
|
||||
if (type === '故障') return '#ff4d4f';
|
||||
return '#8b9dc3';
|
||||
},
|
||||
label: {
|
||||
text: (datum: any) => datum?.value?.toString() || '0',
|
||||
style: { fill: '#fff' },
|
||||
},
|
||||
xAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } } },
|
||||
yAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(0,150,200,0.1)' } } } },
|
||||
legend: false,
|
||||
height: 180,
|
||||
};
|
||||
|
||||
const deviceOnlineRateConfig: any = {
|
||||
data: deviceOnlineRateTrendData,
|
||||
xField: 'date',
|
||||
yField: 'value',
|
||||
smooth: true,
|
||||
color: '#00b4d8',
|
||||
areaStyle: { fillOpacity: 0.2 },
|
||||
xAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: null },
|
||||
yAxis: {
|
||||
label: { style: { fill: 'rgba(200,230,255,0.65)' } },
|
||||
grid: { line: { style: { stroke: 'rgba(0,150,200,0.08)' } } },
|
||||
},
|
||||
tooltip: { showMarkers: true },
|
||||
height: 160,
|
||||
};
|
||||
|
||||
const areaConfig: any = {
|
||||
data: annualData,
|
||||
xField: 'month',
|
||||
yField: 'value',
|
||||
seriesField: 'type',
|
||||
color: ['#00b4d8', '#00e5a0'],
|
||||
areaStyle: { fillOpacity: 0.25 },
|
||||
xAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } } },
|
||||
yAxis: { label: { style: { fill: 'rgba(200,230,255,0.65)' } }, grid: { line: { style: { stroke: 'rgba(0,150,200,0.1)' } } } },
|
||||
legend: { position: 'top-right', itemName: { style: { fill: 'rgba(200,230,255,0.8)' } } },
|
||||
smooth: true,
|
||||
height: 220,
|
||||
};
|
||||
|
||||
const roseConfig: any = {
|
||||
data: violationAnalysisData,
|
||||
xField: 'type',
|
||||
yField: 'value',
|
||||
seriesField: 'type',
|
||||
radius: 0.9,
|
||||
color: ['#ff6b6b', '#ffa502', '#ff9f43', '#00b4d8', '#48cae4', '#90e0ef'],
|
||||
label: {
|
||||
text: (datum: any) => datum?.type || '',
|
||||
style: { fill: '#fff', fontSize: 10 },
|
||||
},
|
||||
legend: { position: 'bottom', itemName: { style: { fill: 'rgba(200,230,255,0.65)' } } },
|
||||
height: 200,
|
||||
};
|
||||
|
||||
const taskStatusPieConfig: any = {
|
||||
data: [
|
||||
{ name: '待执行', value: taskStats?.pending || 0 },
|
||||
{ name: '执行中', value: taskStats?.running || 0 },
|
||||
{ name: '已完成', value: taskStats?.completed || 0 },
|
||||
{ name: '已失败', value: taskStats?.failed || 0 },
|
||||
],
|
||||
angleField: 'value',
|
||||
colorField: 'name',
|
||||
radius: 0.85,
|
||||
innerRadius: 0.55,
|
||||
color: ['#ffa502', '#00b4d8', '#00e5a0', '#ff6b6b'],
|
||||
label: {
|
||||
text: (datum: any) => {
|
||||
const name = datum?.name || '';
|
||||
const value = datum?.value ?? 0;
|
||||
const total = (taskStats?.pending || 0) + (taskStats?.running || 0) + (taskStats?.completed || 0) + (taskStats?.failed || 0);
|
||||
const percent = total > 0 ? ((value / total) * 100).toFixed(1) : 0;
|
||||
return `${name} ${percent}%`;
|
||||
},
|
||||
style: { fill: 'rgba(200,230,255,0.65)' },
|
||||
},
|
||||
legend: { position: 'bottom', itemValue: { style: { fill: 'rgba(200,230,255,0.65)' } }, itemName: { style: { fill: 'rgba(200,230,255,0.65)' } } },
|
||||
height: 190,
|
||||
};
|
||||
|
||||
const getAlertColor = (level: string) => {
|
||||
switch (level) {
|
||||
case 'critical': return '#ff4757';
|
||||
case 'error': return '#ff9f43';
|
||||
case 'warning': return '#feca57';
|
||||
default: return '#54a0ff';
|
||||
}
|
||||
};
|
||||
|
||||
const taskPeriodText = useMemo(() => {
|
||||
if (taskStatType === 'day') return '当日';
|
||||
if (taskStatType === 'month') return '当月';
|
||||
return '当年';
|
||||
}, [taskStatType]);
|
||||
|
||||
const taskNewLabel = useMemo(() => {
|
||||
if (taskStatType === 'day') return '当日任务';
|
||||
if (taskStatType === 'month') return '当月任务';
|
||||
return '当年任务';
|
||||
}, [taskStatType]);
|
||||
|
||||
const datePickerFormat = useMemo(() => {
|
||||
if (taskStatType === 'day') return 'YYYY-MM-DD';
|
||||
if (taskStatType === 'month') return 'YYYY-MM';
|
||||
return 'YYYY';
|
||||
}, [taskStatType]);
|
||||
|
||||
return (
|
||||
<div className="maritime-dashboard">
|
||||
<div className="wave-bg-animation"></div>
|
||||
<div className="wave-layer"></div>
|
||||
<div className="wave-layer-2"></div>
|
||||
<div className="wave-layer-3"></div>
|
||||
|
||||
<Spin spinning={loading} wrapperClassName="maritime-spin">
|
||||
<div className="maritime-content">
|
||||
<div className="maritime-grid">
|
||||
|
||||
{/* 左侧栏:设备态势 */}
|
||||
<div className="grid-col left-col">
|
||||
<Card title="设备类型分布" className="panel-card ocean-glass" size="small">
|
||||
<div className="chart-wrapper">
|
||||
<Pie {...pieConfig} />
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card title="设备状态统计" className="panel-card ocean-glass" size="small">
|
||||
<div className="chart-wrapper">
|
||||
<Column {...columnConfig} />
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card title="近7日在线率趋势" className="panel-card ocean-glass" size="small">
|
||||
<div className="chart-wrapper">
|
||||
<Area {...deviceOnlineRateConfig} />
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card
|
||||
title={<span><WarningOutlined className="icon-warning" /> 实时告警</span>}
|
||||
className="panel-card ocean-glass flex-grow"
|
||||
size="small"
|
||||
extra={<Tag color="#ff9f43">LIVE</Tag>}
|
||||
>
|
||||
<div className="alert-list-container">
|
||||
<List
|
||||
dataSource={alerts}
|
||||
split={false}
|
||||
renderItem={(item) => (
|
||||
<List.Item className="alert-item">
|
||||
<div className="alert-row">
|
||||
<div className="alert-badge">
|
||||
<Tag color={getAlertColor(item.level)}>{item.level.toUpperCase().slice(0, 1)}</Tag>
|
||||
</div>
|
||||
<div className="alert-content">
|
||||
<div className="alert-head">
|
||||
<span className="alert-name">{item.deviceName || item.taskName}</span>
|
||||
<span className="alert-time">{dayjs(item.timestamp).format('HH:mm')}</span>
|
||||
</div>
|
||||
<div className="alert-msg">{item.message}</div>
|
||||
</div>
|
||||
</div>
|
||||
</List.Item>
|
||||
)}
|
||||
/>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
{/* 中间栏:核心监控 */}
|
||||
<div className="grid-col center-col">
|
||||
{/* 顶部KPI */}
|
||||
<div className="kpi-row">
|
||||
<div className="kpi-card">
|
||||
<div className="kpi-icon ship"><USVIcon /></div>
|
||||
<div className="kpi-info">
|
||||
<div className="label">设备总数</div>
|
||||
<div className="value">{deviceStats?.total || 0}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="kpi-card">
|
||||
<div className="kpi-icon anchor"><CheckCircleOutlined /></div>
|
||||
<div className="kpi-info">
|
||||
<div className="label">在线率</div>
|
||||
<div className="value">{deviceStats?.onlineRate || 0}<small>%</small></div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="kpi-card">
|
||||
<div className="kpi-icon alert"><RocketOutlined /></div>
|
||||
<div className="kpi-info">
|
||||
<div className="label">{taskNewLabel}</div>
|
||||
<div className="value">{taskStats?.todayNew || 0}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div className="kpi-card">
|
||||
<div className="kpi-icon route"><PieChartOutlined /></div>
|
||||
<div className="kpi-info">
|
||||
<div className="label">执行成功率</div>
|
||||
<div className="value">{taskStats?.successRate || 0}<small>%</small></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 海域监控入口 */}
|
||||
<div className="map-portal-wrapper">
|
||||
<div className="nautical-grid"></div>
|
||||
<div className="compass-sweep"></div>
|
||||
<div className="map-content">
|
||||
<div className="portal-center">
|
||||
<CompassOutlined style={{ fontSize: 52, color: '#00b4d8', marginBottom: 16 }} />
|
||||
<h2 className="portal-title">海域智慧巡检监控中心</h2>
|
||||
<Button type="primary" shape="round" size="large" onClick={goTo3D} className="portal-btn">
|
||||
进入海域监控视图
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 年度巡检任务趋势 */}
|
||||
<Card title="年度巡检任务趋势分析" className="panel-card ocean-glass fill-bottom" size="small">
|
||||
<div className="chart-wrapper">
|
||||
<Area {...areaConfig} />
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
{/* 右侧栏:任务与运维 */}
|
||||
<div className="grid-col right-col">
|
||||
<Card
|
||||
title={`${taskPeriodText}巡检任务`}
|
||||
className="panel-card ocean-glass"
|
||||
size="small"
|
||||
extra={
|
||||
<Space size={8} className="task-filter">
|
||||
<Segmented
|
||||
size="small"
|
||||
options={[
|
||||
{ label: '日', value: 'day' },
|
||||
{ label: '月', value: 'month' },
|
||||
{ label: '年', value: 'year' },
|
||||
]}
|
||||
value={taskStatType}
|
||||
onChange={(v) => setTaskStatType(v as any)}
|
||||
/>
|
||||
<DatePicker
|
||||
size="small"
|
||||
value={taskStatDate}
|
||||
onChange={(v) => v && setTaskStatDate(v)}
|
||||
picker={taskStatType === 'day' ? 'date' : taskStatType}
|
||||
allowClear={false}
|
||||
format={datePickerFormat}
|
||||
disabledDate={(d) => !!d && d.isAfter(dayjs(), 'day')}
|
||||
/>
|
||||
</Space>
|
||||
}
|
||||
>
|
||||
<div className="ship-status-grid">
|
||||
<div className="ship-stat-box">
|
||||
<div className="val sailing">{taskStats?.pending || 0}</div>
|
||||
<div className="lbl">待执行</div>
|
||||
</div>
|
||||
<div className="ship-stat-box">
|
||||
<div className="val anchored">{taskStats?.running || 0}</div>
|
||||
<div className="lbl">执行中</div>
|
||||
</div>
|
||||
<div className="ship-stat-box">
|
||||
<div className="val docked">{taskStats?.completed || 0}</div>
|
||||
<div className="lbl">已完成</div>
|
||||
</div>
|
||||
<div className="ship-stat-box">
|
||||
<div className="val warning">{taskStats?.failed || 0}</div>
|
||||
<div className="lbl">已失败</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style={{ marginTop: 16, textAlign: 'center' }}>
|
||||
<div style={{ fontSize: '32px', fontWeight: 'bold', color: '#00e5a0' }}>
|
||||
{taskStats?.successRate || 0}%
|
||||
</div>
|
||||
<div style={{ fontSize: '14px', color: '#e0f7ff', marginTop: 4 }}>
|
||||
{taskPeriodText}成功率
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card title="任务状态占比" className="panel-card ocean-glass" size="small">
|
||||
<div className="chart-wrapper">
|
||||
<Pie {...taskStatusPieConfig} />
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card title="近7日巡检趋势" className="panel-card ocean-glass" size="small">
|
||||
<div className="chart-wrapper">
|
||||
<Line {...taskTrendConfig} />
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
<Card title="违规类型分析" className="panel-card ocean-glass flex-grow" size="small">
|
||||
<div className="chart-wrapper">
|
||||
<Rose {...roseConfig} />
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</Spin>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default MaritimeDashboard;
|
||||
@@ -52,8 +52,8 @@ const LoginPage: React.FC = () => {
|
||||
setTimeout(() => {
|
||||
const { query } = history.location as any;
|
||||
const { redirect } = query || {};
|
||||
// 跳转到大屏首页
|
||||
const targetPath = redirect || '/dashboard';
|
||||
// 跳转到首页(由路由配置决定默认页面)
|
||||
const targetPath = redirect || '/';
|
||||
history.push(targetPath);
|
||||
}, 1000);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user