feat: 根据租户获取景区二维码内容
This commit is contained in:
@@ -31,10 +31,10 @@ interface Platform {
|
||||
const platforms: Platform[] = [
|
||||
{
|
||||
key: 'dashboard',
|
||||
label: '通用监控大屏',
|
||||
label: '无人机智慧城市',
|
||||
path: '/dashboard',
|
||||
icon: <DashboardIcon />,
|
||||
description: '设备监控与任务管理',
|
||||
description: '城市态势与空地协同',
|
||||
theme: 'cyan',
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,6 +1,20 @@
|
||||
.blank-layout {
|
||||
min-height: 100vh;
|
||||
background: var(--bg-primary);
|
||||
/* Dashboard 高度自适应:同一份变量同时驱动 Header 与 Content,避免“减去固定像素”导致不同屏幕被遮挡 */
|
||||
--dashboard-header-h: 80px;
|
||||
}
|
||||
|
||||
@media (max-height: 900px) {
|
||||
.blank-layout {
|
||||
--dashboard-header-h: 64px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-height: 760px) {
|
||||
.blank-layout {
|
||||
--dashboard-header-h: 56px;
|
||||
}
|
||||
}
|
||||
|
||||
.blank-header {
|
||||
@@ -87,13 +101,36 @@
|
||||
|
||||
.blank-content {
|
||||
height: calc(100vh - 56px);
|
||||
height: calc(100dvh - 56px);
|
||||
overflow: auto;
|
||||
background: var(--bg-primary);
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
.blank-content--dashboard {
|
||||
height: calc(100vh - 80px);
|
||||
height: calc(100vh - var(--dashboard-header-h));
|
||||
height: calc(100dvh - var(--dashboard-header-h));
|
||||
overflow: hidden;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
> * {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-height: 900px) {
|
||||
.blank-content--dashboard {
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1280px) {
|
||||
.blank-content--dashboard {
|
||||
overflow: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
.blank-content--map3d {
|
||||
@@ -172,8 +209,8 @@
|
||||
}
|
||||
|
||||
.blank-header--dashboard {
|
||||
height: 80px;
|
||||
line-height: 80px;
|
||||
height: var(--dashboard-header-h);
|
||||
line-height: var(--dashboard-header-h);
|
||||
padding: 0 22px;
|
||||
background: linear-gradient(180deg, rgba(7, 10, 26, 0.92) 0%, rgba(7, 10, 26, 0.66) 100%) !important;
|
||||
border-bottom: none;
|
||||
|
||||
@@ -101,7 +101,7 @@ const BlankLayout: React.FC<{ children?: React.ReactNode }> = ({ children }) =>
|
||||
<div className="header-center">
|
||||
{isDashboard ? (
|
||||
<div className="dashboard-title">
|
||||
<span className="dashboard-title__text">鹰眼管控平台 - 运营总览</span>
|
||||
<span className="dashboard-title__text">无人机智慧城市管控平台</span>
|
||||
<span className="dashboard-title__deco" />
|
||||
</div>
|
||||
) : isMaritime ? (
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -50,6 +50,23 @@ export interface AlertItem {
|
||||
timestamp: string;
|
||||
}
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备统计
|
||||
*/
|
||||
@@ -193,17 +210,25 @@ export async function getTrendData(days: number = 7): Promise<{ taskTrend: Trend
|
||||
date.setDate(date.getDate() - i);
|
||||
const dateStr = date.toISOString().split('T')[0];
|
||||
|
||||
const rng = createRng(`trend:${dateStr}`);
|
||||
const created = Math.floor(8 + rng() * 18);
|
||||
const completed = Math.floor(created * (0.68 + rng() * 0.22));
|
||||
const failed = Math.max(0, Math.floor(created * (0.03 + rng() * 0.08)));
|
||||
|
||||
taskTrend.push({
|
||||
date: dateStr,
|
||||
created: Math.floor(Math.random() * 20) + 5,
|
||||
completed: Math.floor(Math.random() * 15) + 3,
|
||||
failed: Math.floor(Math.random() * 3),
|
||||
created,
|
||||
completed,
|
||||
failed,
|
||||
});
|
||||
|
||||
const online = Math.floor(72 + rng() * 24);
|
||||
const total = 100;
|
||||
|
||||
deviceTrend.push({
|
||||
date: dateStr,
|
||||
online: Math.floor(Math.random() * 30) + 70,
|
||||
total: 100,
|
||||
online,
|
||||
total,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -214,24 +239,83 @@ export async function getTrendData(days: number = 7): Promise<{ taskTrend: Trend
|
||||
* 模拟告警数据
|
||||
*/
|
||||
export function getMockAlerts(): AlertItem[] {
|
||||
return [
|
||||
const now = dayjs();
|
||||
const dayKey = now.format('YYYY-MM-DD');
|
||||
const rng = createRng(`alerts:${dayKey}:${now.format('HH')}`);
|
||||
const pick = <T,>(arr: T[]) => arr[Math.floor(rng() * arr.length)];
|
||||
|
||||
const devices = [
|
||||
{ sn: 'DRONE-A01', name: '城市巡检无人机A' },
|
||||
{ sn: 'DRONE-B02', name: '河道巡检无人机B' },
|
||||
{ sn: 'DOCK-01', name: '城北机库01' },
|
||||
{ sn: 'CAM-07', name: '高新大道摄像头07' },
|
||||
];
|
||||
|
||||
const baseAlerts: AlertItem[] = [
|
||||
{
|
||||
id: '1',
|
||||
id: `a-${dayKey}-1`,
|
||||
type: 'device_offline',
|
||||
deviceSn: 'DRONE001',
|
||||
deviceName: '巡检无人机A',
|
||||
message: '设备离线超过5分钟',
|
||||
deviceSn: 'CAM-07',
|
||||
deviceName: '高新大道摄像头07',
|
||||
message: '关键点位离线超过 5 分钟',
|
||||
level: 'warning',
|
||||
timestamp: new Date().toISOString(),
|
||||
timestamp: now.subtract(3, 'minute').toISOString(),
|
||||
},
|
||||
{
|
||||
id: '2',
|
||||
id: `a-${dayKey}-2`,
|
||||
type: 'low_battery',
|
||||
deviceSn: 'DRONE002',
|
||||
deviceName: '巡检无人机B',
|
||||
message: '电池电量低于20%',
|
||||
deviceSn: 'DRONE-B02',
|
||||
deviceName: '河道巡检无人机B',
|
||||
message: '电池电量低于 20%,建议返航或更换任务资源',
|
||||
level: 'warning',
|
||||
timestamp: new Date(Date.now() - 300000).toISOString(),
|
||||
timestamp: now.subtract(9, 'minute').toISOString(),
|
||||
},
|
||||
{
|
||||
id: `a-${dayKey}-3`,
|
||||
type: 'device_fault',
|
||||
deviceSn: 'DOCK-01',
|
||||
deviceName: '城北机库01',
|
||||
message: '舱门状态异常,请核对机库自检结果',
|
||||
level: 'error',
|
||||
timestamp: now.subtract(18, 'minute').toISOString(),
|
||||
},
|
||||
{
|
||||
id: `a-${dayKey}-4`,
|
||||
type: 'task_failed',
|
||||
taskId: 10086,
|
||||
taskName: '主干道早高峰巡检',
|
||||
message: '任务中断:链路波动导致视频回传丢包',
|
||||
level: 'error',
|
||||
timestamp: now.subtract(26, 'minute').toISOString(),
|
||||
},
|
||||
{
|
||||
id: `a-${dayKey}-5`,
|
||||
type: 'device_offline',
|
||||
deviceSn: 'DRONE-A01',
|
||||
deviceName: '城市巡检无人机A',
|
||||
message: '回传信号弱,定位数据更新异常',
|
||||
level: 'critical',
|
||||
timestamp: now.subtract(37, 'minute').toISOString(),
|
||||
},
|
||||
];
|
||||
|
||||
const extraCount = 1 + Math.floor(rng() * 2);
|
||||
for (let i = 0; i < extraCount; i++) {
|
||||
const d = pick(devices);
|
||||
baseAlerts.push({
|
||||
id: `a-${dayKey}-x${i}`,
|
||||
type: pick(['device_offline', 'low_battery', 'device_fault'] as AlertItem['type'][]),
|
||||
deviceSn: d.sn,
|
||||
deviceName: d.name,
|
||||
message: pick([
|
||||
'状态波动:请关注在线率与告警趋势',
|
||||
'链路质量下降:可能影响实时回传',
|
||||
'边缘算力占用较高:建议分流任务',
|
||||
]),
|
||||
level: pick(['warning', 'error'] as AlertItem['level'][]),
|
||||
timestamp: now.subtract(45 + Math.floor(rng() * 25), 'minute').toISOString(),
|
||||
});
|
||||
}
|
||||
|
||||
return baseAlerts.slice(0, 8);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user