refactor: 重构项目结构

- 优化 `车站-设备-告警`  轮询机制
- 改进设备卡片的布局
- 支持修改设备
- 告警轮询中获取完整告警数据
- 车站告警详情支持导出完整的 `今日告警列表`
- 支持将状态持久化到 `IndexedDB`
- 新增轮询控制 (调试模式)
- 新增离线开发模式 (调试模式)
- 新增 `IndexedDB` 数据控制 (调试模式)
This commit is contained in:
yangsy
2025-12-11 13:42:22 +08:00
commit 37781216b2
278 changed files with 17988 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
export * from './ndm-camera-diag-info';
export * from './ndm-decoder-diag-info';
export * from './ndm-nvr-diag-info';
export * from './ndm-security-box-diag-info';
export * from './ndm-server-diag-info';
export * from './ndm-switch-diag-info';

View File

@@ -0,0 +1,5 @@
export interface NdmCameraDiagInfo {
[key: string]: any;
logTime?: string;
info?: string;
}

View File

@@ -0,0 +1,14 @@
export interface NdmDecoderDiagInfo {
[key: string]: any;
logTime?: string;
stCommonInfo?: {
设备ID?: string;
软件版本?: string;
设备厂商?: string;
设备别名?: string;
设备型号?: string;
硬件版本?: string;
内存使用率?: string;
CPU使用率?: string;
};
}

View File

@@ -0,0 +1,31 @@
export interface NdmNvrDiagInfo {
[key: string]: any;
logTime?: string;
info?: {
diskHealth?: number[];
groupInfoList?: {
freeSize?: number;
state?: number;
stateValue?: string;
totalSize?: number;
}[];
};
stCommonInfo?: {
设备ID?: string;
软件版本?: string;
生产厂商?: string;
设备别名?: string;
设备型号?: string;
硬件版本?: string;
内存使用率?: string;
CPU使用率?: string;
};
cdFanInfo?: {
索引号?: string;
'风扇转速(rpm)'?: string;
}[];
cdPowerSupplyInfo?: {
索引号?: string;
电源状态?: string;
}[];
}

View File

@@ -0,0 +1,24 @@
export interface NdmSecurityBoxDiagInfo {
[key: string]: any;
info?: [
{
addrCode?: number;
circuits?: NdmSecurityBoxCircuit[];
fanSpeeds?: number[];
humidity?: number;
switches?: [number, number, number, number];
temperature?: number;
},
];
stCommonInfo?: {
[key: string]: any;
内存使用率?: string;
CPU使用率?: string;
};
}
export interface NdmSecurityBoxCircuit {
current: number;
status: number;
voltage: number;
}

View File

@@ -0,0 +1,9 @@
export interface NdmServerDiagInfo {
[key: string]: any;
commInfo?: {
CPU使用率?: string;
内存使用率?: string;
磁盘使用率?: string;
系统运行时间?: string;
};
}

View File

@@ -0,0 +1,22 @@
export interface NdmSwitchDiagInfo {
[key: string]: any;
cpuRatio?: string; // 因环境不同可能不存在
memoryRatio?: string; // 因环境不同可能不存在
logTime?: string;
info?: {
overFlowPorts?: string[];
portInfoList?: NdmSwitchPortInfo[];
};
}
export interface NdmSwitchPortInfo {
flow: number;
inBytes: number;
inFlow: number;
lastInBytes: number;
lastOutBytes: number;
outBytes: number;
outFlow: number;
portName: string;
upDown: number;
}

View File

@@ -0,0 +1,2 @@
export * from './diag';
export * from './station';

View File

@@ -0,0 +1,35 @@
import type { NdmDeviceAlarmLogResultVO } from '@/apis/model';
import { DEVICE_TYPE_LITERALS } from '@/enums';
import type { Station } from './station';
export interface StationAlarms {
[DEVICE_TYPE_LITERALS.ndmAlarmHost]: NdmDeviceAlarmLogResultVO[];
[DEVICE_TYPE_LITERALS.ndmCamera]: NdmDeviceAlarmLogResultVO[];
[DEVICE_TYPE_LITERALS.ndmDecoder]: NdmDeviceAlarmLogResultVO[];
[DEVICE_TYPE_LITERALS.ndmKeyboard]: NdmDeviceAlarmLogResultVO[];
[DEVICE_TYPE_LITERALS.ndmMediaServer]: NdmDeviceAlarmLogResultVO[];
[DEVICE_TYPE_LITERALS.ndmNvr]: NdmDeviceAlarmLogResultVO[];
[DEVICE_TYPE_LITERALS.ndmSecurityBox]: NdmDeviceAlarmLogResultVO[];
[DEVICE_TYPE_LITERALS.ndmSwitch]: NdmDeviceAlarmLogResultVO[];
[DEVICE_TYPE_LITERALS.ndmVideoServer]: NdmDeviceAlarmLogResultVO[];
unclassified: NdmDeviceAlarmLogResultVO[];
}
export interface LineAlarms {
[stationCode: Station['code']]: StationAlarms;
}
export const initStationAlarms = (): StationAlarms => {
return {
[DEVICE_TYPE_LITERALS.ndmAlarmHost]: [],
[DEVICE_TYPE_LITERALS.ndmCamera]: [],
[DEVICE_TYPE_LITERALS.ndmDecoder]: [],
[DEVICE_TYPE_LITERALS.ndmKeyboard]: [],
[DEVICE_TYPE_LITERALS.ndmMediaServer]: [],
[DEVICE_TYPE_LITERALS.ndmNvr]: [],
[DEVICE_TYPE_LITERALS.ndmSecurityBox]: [],
[DEVICE_TYPE_LITERALS.ndmSwitch]: [],
[DEVICE_TYPE_LITERALS.ndmVideoServer]: [],
unclassified: [],
};
};

View File

@@ -0,0 +1,43 @@
import type {
NdmAlarmHostResultVO,
NdmCameraResultVO,
NdmDecoderResultVO,
NdmKeyboardResultVO,
NdmMediaServerResultVO,
NdmNvrResultVO,
NdmSecurityBoxResultVO,
NdmSwitchResultVO,
NdmVideoServerResultVO,
Station,
} from '@/apis';
import { DEVICE_TYPE_LITERALS } from '@/enums';
export interface StationDevices {
[DEVICE_TYPE_LITERALS.ndmAlarmHost]: NdmAlarmHostResultVO[];
[DEVICE_TYPE_LITERALS.ndmCamera]: NdmCameraResultVO[];
[DEVICE_TYPE_LITERALS.ndmDecoder]: NdmDecoderResultVO[];
[DEVICE_TYPE_LITERALS.ndmKeyboard]: NdmKeyboardResultVO[];
[DEVICE_TYPE_LITERALS.ndmMediaServer]: NdmMediaServerResultVO[];
[DEVICE_TYPE_LITERALS.ndmNvr]: NdmNvrResultVO[];
[DEVICE_TYPE_LITERALS.ndmSecurityBox]: NdmSecurityBoxResultVO[];
[DEVICE_TYPE_LITERALS.ndmSwitch]: NdmSwitchResultVO[];
[DEVICE_TYPE_LITERALS.ndmVideoServer]: NdmVideoServerResultVO[];
}
export interface LineDevices {
[stationCode: Station['code']]: StationDevices;
}
export const initStationDevices = (): StationDevices => {
return {
[DEVICE_TYPE_LITERALS.ndmAlarmHost]: [],
[DEVICE_TYPE_LITERALS.ndmCamera]: [],
[DEVICE_TYPE_LITERALS.ndmDecoder]: [],
[DEVICE_TYPE_LITERALS.ndmKeyboard]: [],
[DEVICE_TYPE_LITERALS.ndmMediaServer]: [],
[DEVICE_TYPE_LITERALS.ndmNvr]: [],
[DEVICE_TYPE_LITERALS.ndmSecurityBox]: [],
[DEVICE_TYPE_LITERALS.ndmSwitch]: [],
[DEVICE_TYPE_LITERALS.ndmVideoServer]: [],
};
};

View File

@@ -0,0 +1,3 @@
export * from './alarm';
export * from './device';
export * from './station';

View File

@@ -0,0 +1,6 @@
export interface Station {
code: string;
name: string;
online: boolean;
ip: string;
}