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

34
src/App.vue Normal file
View File

@@ -0,0 +1,34 @@
<script setup lang="ts">
import { useVersionCheckQuery } from './composables';
import { GlobalFeedback } from '@/components';
import { useSettingStore } from '@/stores';
import { VueQueryDevtools } from '@tanstack/vue-query-devtools';
import { dateZhCN, NConfigProvider, NDialogProvider, NLoadingBarProvider, NMessageProvider, NNotificationProvider, zhCN } from 'naive-ui';
import { storeToRefs } from 'pinia';
const settingStore = useSettingStore();
const { themeMode, offlineDev } = storeToRefs(settingStore);
// 允许通过控制台启用离线开发模式 (登录页适用)
window.$offlineDev = offlineDev;
useVersionCheckQuery();
</script>
<template>
<NConfigProvider :locale="zhCN" :date-locale="dateZhCN" :theme="themeMode">
<NDialogProvider>
<NLoadingBarProvider>
<NMessageProvider>
<NNotificationProvider>
<GlobalFeedback />
<RouterView />
<VueQueryDevtools />
</NNotificationProvider>
</NMessageProvider>
</NLoadingBarProvider>
</NDialogProvider>
</NConfigProvider>
</template>
<style scoped lang="scss"></style>

2
src/apis/client/index.ts Normal file
View File

@@ -0,0 +1,2 @@
export * from './ndm-client';
export * from './user-client';

View File

@@ -0,0 +1,32 @@
import { useUserStore } from '@/stores';
import { getAppEnvConfig, RequestClient } from '@/utils';
import type { AxiosError } from 'axios';
export const ndmClient = new RequestClient({
requestInterceptor: async (config) => {
const userStore = useUserStore();
const { lampAuthorization, lampClientId, lampClientSecret } = getAppEnvConfig();
const newAuthorization = window.btoa(`${lampClientId}:${lampClientSecret}`);
const authorization = lampAuthorization.trim() !== '' ? lampAuthorization : newAuthorization;
config.headers.set('accept-language', 'zh-CN,zh;q=0.9');
config.headers.set('accept', 'application/json, text/plain, */*');
config.headers.set('Applicationid', '');
config.headers.set('Tenantid', '1');
config.headers.set('Authorization', authorization);
const staticCode = config.url?.split('/api').at(0)?.split('/').at(-1) ?? '';
config.headers.set('token', userStore.lampLoginResultRecord?.[staticCode]?.token ?? '');
return config;
},
responseErrorInterceptor: async (error) => {
const err = error as AxiosError;
if (err.response?.status === 401) {
// 当车站请求由于token时效而失败时需要重新登录车站获取token然后重新请求
const stationCode = err.config?.url?.split('/api').at(0)?.split('/').at(-1) ?? '';
const userStore = useUserStore();
await userStore.lampLogin(stationCode);
error.config.headers.token = userStore.lampLoginResultRecord?.[stationCode]?.token ?? '';
return ndmClient.requestInstance(error.config);
}
return Promise.reject(error);
},
});

View File

@@ -0,0 +1,33 @@
import router from '@/router';
import { useUserStore } from '@/stores';
import { getAppEnvConfig, RequestClient } from '@/utils';
import type { AxiosError } from 'axios';
export const userClient = new RequestClient({
requestInterceptor: (config) => {
const userStore = useUserStore();
const { lampAuthorization, lampClientId, lampClientSecret } = getAppEnvConfig();
const newAuthorization = window.btoa(`${lampClientId}:${lampClientSecret}`);
const authorization = lampAuthorization.trim() !== '' ? lampAuthorization : newAuthorization;
config.headers.set('accept-language', 'zh-CN,zh;q=0.9');
config.headers.set('accept', 'application/json, text/plain, */*');
config.headers.set('Applicationid', '');
config.headers.set('Tenantid', '1');
config.headers.set('Authorization', authorization);
config.headers.set('token', userStore.userLoginResult?.token ?? '');
return config;
},
responseInterceptor: (response) => {
return response;
},
responseErrorInterceptor: (error) => {
const err = error as AxiosError;
if (err.response?.status === 401) {
window.$message.error('登录超时,请重新登录');
const userStore = useUserStore();
userStore.resetStore();
router.push({ path: '/login' });
}
return Promise.reject(error);
},
});

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;
}

3
src/apis/domain/index.ts Normal file
View File

@@ -0,0 +1,3 @@
export * from './biz';
export * from './user';
export * from './version';

View File

@@ -0,0 +1,2 @@
export * from './login-params';
export * from './login-result';

View File

@@ -0,0 +1,8 @@
export interface LoginParams {
username: string;
password: string;
code: string;
key: string;
grantType: 'PASSWORD' | 'CAPTCHA' | 'REFRESH_TOKEN';
refreshToken?: string;
}

View File

@@ -0,0 +1,8 @@
export interface LoginResult {
tenantId: string;
uuid: string;
token: string;
refreshToken: string;
expire: string;
expiration: string;
}

View File

@@ -0,0 +1 @@
export * from './version-info';

View File

@@ -0,0 +1,4 @@
export interface VersionInfo {
version: string;
buildTime: string;
}

4
src/apis/index.ts Normal file
View File

@@ -0,0 +1,4 @@
export * from './client';
export * from './domain';
export * from './model';
export * from './request';

View File

@@ -0,0 +1,3 @@
export * from './model';
export * from './page';
export * from './reduce';

View File

@@ -0,0 +1,18 @@
export interface SuperModel {
id: string;
createdBy: string;
createdTime: string;
echoMap?: any;
}
export interface BaseModel extends SuperModel {
updatedBy: string;
updatedTime: string;
}
export interface TreeModel extends BaseModel {
parentId: string;
sortValue: number;
treeGrade: number;
treePath: string;
}

View File

@@ -0,0 +1,43 @@
import type { BaseModel } from './model';
export interface BasicPageParams {
page: number;
pageSize: number;
}
export interface BasicFetchResult<T> {
items: T[];
total: number;
}
export interface RemoteData {
key: string | number;
data?: any;
}
export type PageQueryExtraKeyPrefix<T> = keyof T & string;
export type PageQueryExtraKeySuffix = 'in' | 'like' | 'likeLeft' | 'likeRight' | 'ge' | 'le' | 'precisest' | 'preciseed';
export type PageQueryExtraKey<T> = `${PageQueryExtraKeyPrefix<T>}_${PageQueryExtraKeySuffix}`;
// export type PageQueryExtra<T> = Partial<Record<PageQueryExtraKey<T>, any>>;
export type PageQueryExtra<T> = {
[K in PageQueryExtraKey<T>]?: any;
};
export interface PageParams<T> {
model: T;
size: number;
current: number;
sort?: keyof T & string;
order?: 'ascending' | 'descending';
extra?: PageQueryExtra<T & BaseModel>;
}
export interface PageResult<T> {
records: T[];
// offset: number
pages: string;
current: string;
total: string;
size: string;
orders: any[];
}

View File

@@ -0,0 +1,3 @@
export type ReduceForUpdateVO = 'createdTime' | 'createdBy' | 'updatedTime' | 'updatedBy' | 'echoMap';
export type ReduceForSaveVO = ReduceForUpdateVO | 'id';
export type ReduceForPageQuery = ReduceForUpdateVO;

View File

@@ -0,0 +1 @@
export * from './ndm-alarm-host';

View File

@@ -0,0 +1,39 @@
import type { BaseModel, ReduceForPageQuery, ReduceForSaveVO, ReduceForUpdateVO } from '@/apis';
import type { Nullable, Optional } from '@/types';
export interface NdmAlarmHost extends BaseModel {
deviceId: string;
name: string;
manufacturer: string;
state: boolean;
model: string;
ipAddress: string;
manageUrl: string;
manageUsername: string;
managePassword: string;
gbCode: string;
gbPort: number;
gbDomain: string;
gb28181Enabled: boolean;
diagFlag: string;
diagParam: string;
diagFormat: string;
lastDiagInfo: string;
lastDiagTime: string;
icmpEnabled: boolean;
description: string;
deviceStatus: string;
deviceType: string;
community: string;
frontendConfig: string;
linkDescription: string;
snmpEnabled: boolean;
}
export type NdmAlarmHostResultVO = Nullable<NdmAlarmHost>;
export type NdmAlarmHostSaveVO = Partial<Omit<NdmAlarmHost, ReduceForSaveVO>>;
export type NdmAlarmHostUpdateVO = Optional<Omit<NdmAlarmHost, ReduceForUpdateVO>>;
export type NdmAlarmHostPageQuery = Partial<Omit<NdmAlarmHost, ReduceForPageQuery>>;

View File

@@ -0,0 +1,11 @@
import type { IcmpEntity } from './icmp-entity';
export interface IcmpEntityResult {
name: string;
ipAddress: string;
stationCode: string;
url: string;
success: boolean;
icmpEntities: IcmpEntity[];
errorMessage: string;
}

View File

@@ -0,0 +1,9 @@
export interface IcmpEntityWithStation {
id: string;
deviceId: string;
name: string;
ipAddress: string;
deviceStatus: string;
deviceType: string;
stationName: string;
}

View File

@@ -0,0 +1,8 @@
export interface IcmpEntity {
id: string;
deviceId: string;
name: string;
ipAddress: string;
deviceStatus: string;
deviceType: string;
}

View File

@@ -0,0 +1,3 @@
export * from './icmp-entity';
export * from './icmp-entity-result';
export * from './icmp-entity-with-station';

View File

@@ -0,0 +1,37 @@
import type { Nullable } from '@/types';
import type { NdmAlarmHost } from './alarm';
import type { NdmSecurityBox, NdmSwitch } from './other';
import type { NdmNvr } from './storage';
import type {
NdmCamera,
NdmDecoder,
NdmKeyboard,
NdmMediaServer,
NdmMediaServerPageQuery,
NdmMediaServerResultVO,
NdmMediaServerSaveVO,
NdmMediaServerUpdateVO,
NdmVideoServer,
NdmVideoServerPageQuery,
NdmVideoServerResultVO,
NdmVideoServerSaveVO,
NdmVideoServerUpdateVO,
} from './video';
export type NdmDevice = NdmAlarmHost | NdmCamera | NdmDecoder | NdmKeyboard | NdmMediaServer | NdmNvr | NdmSecurityBox | NdmSwitch | NdmVideoServer;
export type NdmDeviceResultVO = Nullable<NdmDevice>;
export type NdmServer = NdmMediaServer | NdmVideoServer;
export type NdmServerResultVO = NdmMediaServerResultVO | NdmVideoServerResultVO;
export type NdmServerSaveVO = NdmMediaServerSaveVO | NdmVideoServerSaveVO;
export type NdmServerUpdateVO = NdmMediaServerUpdateVO | NdmVideoServerUpdateVO;
export type NdmServerPageQuery = NdmMediaServerPageQuery | NdmVideoServerPageQuery;
export * from './alarm';
export * from './icmp';
export * from './log';
export * from './other';
export * from './storage';
export * from './upper-ndm';
export * from './video';

View File

@@ -0,0 +1,6 @@
export * from './ndm-call-log';
export * from './ndm-device-alarm-log';
export * from './ndm-icmp-log';
export * from './ndm-record-check';
export * from './ndm-snmp-log';
export * from './ndm-vimp-log';

View File

@@ -0,0 +1,18 @@
import type { BaseModel, ReduceForPageQuery, ReduceForSaveVO, ReduceForUpdateVO } from '@/apis';
import type { Nullable } from '@/types';
export interface NdmCallLog extends BaseModel {
sourceGbId: string;
targetGbId: string;
method: string;
messageType: string;
cmdType: string;
}
export type NdmCallLogResultVO = Nullable<NdmCallLog>;
export type NdmCallLogSaveVO = Partial<Omit<NdmCallLog, ReduceForSaveVO>>;
export type NdmCallLogUpdateVO = Partial<Omit<NdmCallLog, ReduceForUpdateVO>>;
export type NdmCallLogPageQuery = Partial<Omit<NdmCallLog, ReduceForPageQuery>>;

View File

@@ -0,0 +1,28 @@
import type { BaseModel, ReduceForSaveVO, ReduceForUpdateVO, ReduceForPageQuery } from '@/apis';
import type { Nullable } from '@/types';
export interface NdmDeviceAlarmLog extends BaseModel {
alarmNo: string;
alarmDate: string;
faultLocation: string;
faultDescription: string;
faultLevel: string;
faultCode: string;
deviceId: string;
deviceName: string;
alarmCategory: string;
alarmConfirm: string;
alarmRepairSuggestion: string;
impactService: string;
alarmType: string;
deviceType: string;
stationCode: string;
}
export type NdmDeviceAlarmLogResultVO = Nullable<NdmDeviceAlarmLog>;
export type NdmDeviceAlarmLogSaveVO = Partial<Omit<NdmDeviceAlarmLog, ReduceForSaveVO>>;
export type NdmDeviceAlarmLogUpdateVO = Partial<Omit<NdmDeviceAlarmLog, ReduceForUpdateVO>>;
export type NdmDeviceAlarmLogPageQuery = Partial<Omit<NdmDeviceAlarmLog, ReduceForPageQuery>>;

View File

@@ -0,0 +1,17 @@
import type { BaseModel, ReduceForSaveVO, ReduceForUpdateVO, ReduceForPageQuery } from '@/apis';
import type { Nullable } from '@/types';
export interface NdmIcmpLog extends BaseModel {
deviceId: string;
name: string;
ipAddress: string;
deviceStatus: string;
}
export type NdmIcmpLogResultVO = Nullable<NdmIcmpLog>;
export type NdmIcmpLogSaveVO = Partial<Omit<NdmIcmpLog, ReduceForSaveVO>>;
export type NdmIcmpLogUpdateVO = Partial<Omit<NdmIcmpLog, ReduceForUpdateVO>>;
export type NdmIcmpLogPageQuery = Partial<Omit<NdmIcmpLog, ReduceForPageQuery>>;

View File

@@ -0,0 +1,8 @@
export interface NdmRecordCheck {
gbCode: string;
parentGbCode: string;
name: string;
ipAddress: string;
diagInfo: string;
checkDate: string;
}

View File

@@ -0,0 +1,18 @@
import type { BaseModel, ReduceForSaveVO, ReduceForUpdateVO, ReduceForPageQuery } from '@/apis';
import type { Nullable } from '@/types';
export interface NdmSnmpLog extends BaseModel {
deviceId: string;
name: string;
ipAddress: string;
diagInfo: string;
deviceType: string;
}
export type NdmSnmpLogResultVO = Nullable<NdmSnmpLog>;
export type NdmSnmpLogSaveVO = Partial<Omit<NdmSnmpLog, ReduceForSaveVO>>;
export type NdmSnmpLogUpdateVO = Partial<Omit<NdmSnmpLog, ReduceForUpdateVO>>;
export type NdmSnmpLogPageQuery = Partial<Omit<NdmSnmpLog, ReduceForPageQuery>>;

View File

@@ -0,0 +1,26 @@
import type { BaseModel, ReduceForSaveVO, ReduceForUpdateVO, ReduceForPageQuery } from '@/apis';
import type { Nullable } from '@/types';
export interface NdmVimpLog extends BaseModel {
requestIp: string;
description: string;
classPath: string;
methodName: string;
startTime: string;
endTime: string;
consumedTime: string;
params: string;
result: string;
httpMethod: string;
userId: string;
logType: number;
targetCode: string;
}
export type NdmVimpLogResultVO = Nullable<NdmVimpLog>;
export type NdmVimpLogSaveVO = Partial<Omit<NdmVimpLog, ReduceForSaveVO>>;
export type NdmVimpLogUpdateVO = Partial<Omit<NdmVimpLog, ReduceForUpdateVO>>;
export type NdmVimpLogPageQuery = Partial<Omit<NdmVimpLog, ReduceForPageQuery>>;

View File

@@ -0,0 +1,2 @@
export * from './ndm-security-box';
export * from './ndm-switch';

View File

@@ -0,0 +1,35 @@
import type { BaseModel, ReduceForSaveVO, ReduceForUpdateVO, ReduceForPageQuery } from '@/apis';
import type { Nullable, Optional } from '@/types';
export interface NdmSecurityBox extends BaseModel {
deviceId: string;
name: string;
manufacturer: string;
state: boolean;
model: string;
ipAddress: string;
manageUrl: string;
manageUsername: string;
managePassword: string;
diagFlag: string;
diagParam: string;
diagFormat: string;
lastDiagInfo: string;
lastDiagTime: string;
icmpEnabled: boolean;
description: string;
deviceStatus: string;
deviceType: string;
community: string;
frontendConfig: string;
linkDescription: string;
snmpEnabled: boolean;
}
export type NdmSecurityBoxResultVO = Nullable<NdmSecurityBox>;
export type NdmSecurityBoxSaveVO = Partial<Omit<NdmSecurityBox, ReduceForSaveVO>>;
export type NdmSecurityBoxUpdateVO = Optional<Omit<NdmSecurityBox, ReduceForUpdateVO>>;
export type NdmSecurityBoxPageQuery = Partial<Omit<NdmSecurityBox, ReduceForPageQuery>>;

View File

@@ -0,0 +1,35 @@
import type { BaseModel, ReduceForSaveVO, ReduceForUpdateVO, ReduceForPageQuery } from '@/apis';
import type { Nullable, Optional } from '@/types';
export interface NdmSwitch extends BaseModel {
deviceId: string;
name: string;
manufacturer: string;
state: boolean;
model: string;
ipAddress: string;
manageUrl: string;
manageUsername: string;
managePassword: string;
diagFlag: string;
diagParam: string;
diagFormat: string;
lastDiagInfo: string;
lastDiagTime: string;
icmpEnabled: boolean;
description: string;
deviceStatus: string;
deviceType: string;
community: string;
frontendConfig: string;
linkDescription: string;
snmpEnabled: boolean;
}
export type NdmSwitchResultVO = Nullable<NdmSwitch>;
export type NdmSwitchSaveVO = Partial<Omit<NdmSwitch, ReduceForSaveVO>>;
export type NdmSwitchUpdateVO = Optional<Omit<NdmSwitch, ReduceForUpdateVO>>;
export type NdmSwitchPageQuery = Partial<Omit<NdmSwitch, ReduceForPageQuery>>;

View File

@@ -0,0 +1 @@
export * from './ndm-nvr';

View File

@@ -0,0 +1,46 @@
import type { BaseModel, ReduceForSaveVO, ReduceForUpdateVO, ReduceForPageQuery } from '@/apis';
import type { Nullable, Optional } from '@/types';
export interface NdmNvr extends BaseModel {
deviceId: string;
name: string;
manufacturer: string;
state: boolean;
model: string;
ipAddress: string;
manageUrl: string;
manageUsername: string;
managePassword: string;
gbCode: string;
gbPort: number;
gbDomain: string;
gb28181Enabled: boolean;
onvifPort: number;
onvifUsername: string;
onvifPassword: string;
onvifMajorIndex: number;
onvifMinorIndex: number;
diagFlag: string;
diagParam: string;
diagFormat: string;
lastDiagInfo: string;
lastDiagTime: string;
icmpEnabled: boolean;
description: string;
deviceStatus: string;
deviceType: string;
community: string;
frontendConfig: string;
linkDescription: string;
snmpEnabled: boolean;
recordCheckEnabled: boolean;
clusterList: string;
}
export type NdmNvrResultVO = Nullable<NdmNvr>;
export type NdmNvrSaveVO = Partial<Omit<NdmNvr, ReduceForSaveVO>>;
export type NdmNvrUpdateVO = Optional<Omit<NdmNvr, ReduceForUpdateVO>>;
export type NdmNvrPageQuery = Partial<Omit<NdmNvr, ReduceForPageQuery>>;

View File

@@ -0,0 +1,2 @@
export * from './sync-camera-result';
export * from './sync-camera-result-detail';

View File

@@ -0,0 +1,6 @@
export interface SyncCameraResultDetail {
name: string;
deviceId: string;
ipAddress: string;
gbCode: string;
}

View File

@@ -0,0 +1,10 @@
import type { SyncCameraResultDetail } from './sync-camera-result-detail';
export interface SyncCameraResult {
stationCode: string;
startTime: string;
endTime: string;
insertList: SyncCameraResultDetail[];
updateList: SyncCameraResultDetail[];
deleteList: SyncCameraResultDetail[];
}

View File

@@ -0,0 +1,6 @@
export * from './ndm-camera';
export * from './ndm-camera-ignore';
export * from './ndm-decoder';
export * from './ndm-keyboard';
export * from './ndm-media-server';
export * from './ndm-video-server';

View File

@@ -0,0 +1,14 @@
import type { BaseModel, ReduceForPageQuery, ReduceForSaveVO, ReduceForUpdateVO } from '@/apis';
export interface NdmCameraIgnore extends BaseModel {
deviceId: string;
ignoreType: string;
}
export type NdmCameraIgnoreResultVO = Partial<NdmCameraIgnore>;
export type NdmCameraIgnoreSaveVO = Partial<Omit<NdmCameraIgnore, ReduceForSaveVO>>;
export type NdmCameraIgnoreUpdateVO = Partial<Omit<NdmCameraIgnore, ReduceForUpdateVO>>;
export type NdmCameraIgnorePageQuery = Partial<Omit<NdmCameraIgnore, ReduceForPageQuery>>;

View File

@@ -0,0 +1,45 @@
import type { BaseModel, ReduceForSaveVO, ReduceForUpdateVO, ReduceForPageQuery } from '@/apis';
import type { Nullable, Optional } from '@/types';
export interface NdmCamera extends BaseModel {
deviceId: string;
name: string;
manufacturer: string;
state: boolean;
model: string;
ipAddress: string;
manageUrl: string;
manageUsername: string;
managePassword: string;
gbCode: string;
gbPort: number;
gbDomain: string;
gb28181Enabled: boolean;
onvifPort: number;
onvifUsername: string;
onvifPassword: string;
onvifMajorIndex: number;
onvifMinorIndex: number;
diagFlag: string;
diagParam: string;
diagFormat: string;
lastDiagInfo: string;
lastDiagTime: string;
icmpEnabled: boolean;
description: string;
deviceStatus: string;
deviceType: string;
cameraType: string;
community: string;
frontendConfig: string;
linkDescription: string;
snmpEnabled: boolean;
}
export type NdmCameraResultVO = Nullable<NdmCamera>;
export type NdmCameraSaveVO = Partial<Omit<NdmCamera, ReduceForSaveVO>>;
export type NdmCameraUpdateVO = Optional<Omit<NdmCamera, ReduceForUpdateVO>>;
export type NdmCameraPageQuery = Partial<Omit<NdmCamera, ReduceForPageQuery>>;

View File

@@ -0,0 +1,42 @@
import type { BaseModel, ReduceForSaveVO, ReduceForUpdateVO, ReduceForPageQuery } from '@/apis';
import type { Nullable, Optional } from '@/types';
export interface NdmDecoder extends BaseModel {
deviceId: string;
name: string;
manufacturer: string;
state: boolean;
model: string;
ipAddress: string;
manageUrl: string;
manageUsername: string;
managePassword: string;
gbCode: string;
gbPort: number;
gbDomain: string;
gb28181Enabled: boolean;
onvifPort: number;
onvifUsername: string;
onvifPassword: string;
diagFlag: string;
diagParam: string;
diagFormat: string;
lastDiagInfo: string;
lastDiagTime: string;
icmpEnabled: boolean;
description: string;
deviceStatus: string;
deviceType: string;
community: string;
frontendConfig: string;
linkDescription: string;
snmpEnabled: boolean;
}
export type NdmDecoderResultVO = Nullable<NdmDecoder>;
export type NdmDecoderSaveVO = Partial<Omit<NdmDecoder, ReduceForSaveVO>>;
export type NdmDecoderUpdateVO = Optional<Omit<NdmDecoder, ReduceForUpdateVO>>;
export type NdmDecoderPageQuery = Partial<Omit<NdmDecoder, ReduceForPageQuery>>;

View File

@@ -0,0 +1,35 @@
import type { BaseModel, ReduceForSaveVO, ReduceForUpdateVO, ReduceForPageQuery } from '@/apis';
import type { Nullable, Optional } from '@/types';
export interface NdmKeyboard extends BaseModel {
deviceId: string;
name: string;
manufacturer: string;
state: boolean;
model: string;
ipAddress: string;
manageUrl: string;
manageUsername: string;
managePassword: string;
diagFlag: string;
diagParam: string;
diagFormat: string;
lastDiagInfo: string;
lastDiagTime: string;
icmpEnabled: boolean;
description: string;
deviceStatus: string;
deviceType: string;
community: string;
frontendConfig: string;
linkDescription: string;
snmpEnabled: boolean;
}
export type NdmKeyboardResultVO = Nullable<NdmKeyboard>;
export type NdmKeyboardSaveVO = Partial<Omit<NdmKeyboard, ReduceForSaveVO>>;
export type NdmKeyboardUpdateVO = Optional<Omit<NdmKeyboard, ReduceForUpdateVO>>;
export type NdmKeyboardPageQuery = Partial<Omit<NdmKeyboard, ReduceForPageQuery>>;

View File

@@ -0,0 +1,39 @@
import type { BaseModel, ReduceForSaveVO, ReduceForUpdateVO, ReduceForPageQuery } from '@/apis';
import type { Nullable, Optional } from '@/types';
export interface NdmMediaServer extends BaseModel {
deviceId: string;
name: string;
manufacturer: string;
state: boolean;
model: string;
ipAddress: string;
manageUrl: string;
manageUsername: string;
managePassword: string;
gbCode: string;
gbPort: number;
gbDomain: string;
gb28181Enabled: boolean;
diagFlag: string;
diagParam: string;
diagFormat: string;
lastDiagInfo: string;
lastDiagTime: string;
icmpEnabled: boolean;
description: string;
deviceStatus: string;
deviceType: string;
community: string;
frontendConfig: string;
linkDescription: string;
snmpEnabled: boolean;
}
export type NdmMediaServerResultVO = Nullable<NdmMediaServer>;
export type NdmMediaServerSaveVO = Partial<Omit<NdmMediaServer, ReduceForSaveVO>>;
export type NdmMediaServerUpdateVO = Optional<Omit<NdmMediaServer, ReduceForUpdateVO>>;
export type NdmMediaServerPageQuery = Partial<Omit<NdmMediaServer, ReduceForPageQuery>>;

View File

@@ -0,0 +1,39 @@
import type { BaseModel, ReduceForSaveVO, ReduceForUpdateVO, ReduceForPageQuery } from '@/apis';
import type { Nullable, Optional } from '@/types';
export interface NdmVideoServer extends BaseModel {
deviceId: string;
name: string;
manufacturer: string;
state: boolean;
model: string;
ipAddress: string;
manageUrl: string;
manageUsername: string;
managePassword: string;
gbCode: string;
gbPort: number;
gbDomain: string;
gb28181Enabled: boolean;
diagFlag: string;
diagParam: string;
diagFormat: string;
lastDiagInfo: string;
lastDiagTime: string;
icmpEnabled: boolean;
description: string;
deviceStatus: string;
deviceType: string;
community: string;
frontendConfig: string;
linkDescription: string;
snmpEnabled: boolean;
}
export type NdmVideoServerResultVO = Nullable<NdmVideoServer>;
export type NdmVideoServerSaveVO = Partial<Omit<NdmVideoServer, ReduceForSaveVO>>;
export type NdmVideoServerUpdateVO = Optional<Omit<NdmVideoServer, ReduceForUpdateVO>>;
export type NdmVideoServerPageQuery = Partial<Omit<NdmVideoServer, ReduceForPageQuery>>;

View File

@@ -0,0 +1,4 @@
export * from './entity';
export * from './nvr';
export * from './verify';
export * from './vimp';

View File

@@ -0,0 +1,15 @@
export interface ClientChannel {
code: string;
name: string;
manufacture: string;
model: string;
owner: string;
civilCode: string;
block: string;
address: string;
parental: number;
parentId: string;
status: number;
longitude: number;
latitude: number;
}

View File

@@ -0,0 +1,3 @@
export * from './client-channel';
export * from './record-info';
export * from './record-item';

View File

@@ -0,0 +1,12 @@
import type { RecordItem } from './record-item';
export interface RecordInfo {
deviceId: string;
channelId: string;
sn: string;
name: string;
sumNum: number;
count: number;
lastTime: number;
recordList: RecordItem[];
}

View File

@@ -0,0 +1,4 @@
export interface RecordItem {
startTime: string;
endTime: string;
}

View File

@@ -0,0 +1 @@
export * from './verify-server';

View File

@@ -0,0 +1,7 @@
export interface VerifyServer {
name: string;
ipAddress: string;
stationCode: string;
verifyUrl: string;
onlineState: boolean;
}

View File

@@ -0,0 +1 @@
export * from './snap-result';

View File

@@ -0,0 +1,5 @@
export interface SnapResult {
absoluteFilePath: string;
path: string;
url: string;
}

3
src/apis/model/index.ts Normal file
View File

@@ -0,0 +1,3 @@
export * from './base';
export * from './biz';
export * from './system';

View File

@@ -0,0 +1,18 @@
import type { BaseModel, ReduceForSaveVO, ReduceForUpdateVO, ReduceForPageQuery } from '@/apis';
import type { Nullable } from '@/types';
export interface DefParameter extends BaseModel {
key: string;
value: string;
name: string;
remarks: string;
paramType: string;
}
export type DefParameterResultVO = Nullable<DefParameter>;
export type DefParameterSaveVO = Partial<Omit<DefParameter, ReduceForSaveVO>>;
export type DefParameterUpdateVO = Partial<Omit<DefParameter, ReduceForUpdateVO>>;
export type DefParameterPageQuery = Partial<Omit<DefParameter, ReduceForPageQuery>>;

View File

@@ -0,0 +1 @@
export * from './def-parameter';

View File

View File

@@ -0,0 +1,71 @@
import {
ndmClient,
userClient,
type NdmAlarmHostPageQuery,
type NdmAlarmHostResultVO,
type NdmAlarmHostSaveVO,
type NdmAlarmHostUpdateVO,
type PageParams,
type PageResult,
type Station,
} from '@/apis';
export const pageAlarmHostApi = async (pageQuery: PageParams<NdmAlarmHostPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmAlarmHost/page`;
const resp = await client.post<PageResult<NdmAlarmHostResultVO>>(endpoint, pageQuery, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const detailAlarmHostApi = async (id: string, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmAlarmHost/detail`;
const resp = await client.get<NdmAlarmHostResultVO>(endpoint, { params: { id }, signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const saveAlarmHostApi = async (saveVO: NdmAlarmHostSaveVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmAlarmHost`;
const resp = await client.post<NdmAlarmHostResultVO>(endpoint, saveVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const updateAlarmHostApi = async (updateVO: NdmAlarmHostUpdateVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmAlarmHost`;
const resp = await client.put<NdmAlarmHostResultVO>(endpoint, updateVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const deleteAlarmHostApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmAlarmHost`;
const resp = await client.delete<boolean>(endpoint, ids, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};

View File

@@ -0,0 +1 @@
export * from './ndm-devices';

View File

@@ -0,0 +1,13 @@
import { ndmClient, userClient, type StationDevices } from '@/apis';
export const getAllDevicesApi = async (options?: { stationCode?: string; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmDevices/all`;
const resp = await client.get<StationDevices>(endpoint, { retRaw: true, signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};

View File

@@ -0,0 +1,59 @@
import {
detailCameraApi,
detailDecoderApi,
detailKeyboardApi,
detailMediaServerApi,
detailNvrApi,
detailSecurityBoxApi,
detailSwitchApi,
detailVideoServerApi,
type NdmDeviceResultVO,
type Station,
} from '@/apis';
import { DEVICE_TYPE_LITERALS, tryGetDeviceType } from '@/enums';
import { detailAlarmHostApi } from '../alarm/ndm-alarm-host';
export const detailDeviceApi = async (device: NdmDeviceResultVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }): Promise<NdmDeviceResultVO | undefined> => {
const { stationCode, signal } = options ?? {};
const { id, deviceType: deviceTypeCode } = device;
if (!id || !deviceTypeCode) throw new Error('未知的设备');
const deviceType = tryGetDeviceType(deviceTypeCode);
if (!deviceType) throw new Error('未知的设备');
if (deviceType === DEVICE_TYPE_LITERALS.ndmAlarmHost) {
await detailAlarmHostApi(id, { stationCode, signal });
return;
}
if (deviceType === DEVICE_TYPE_LITERALS.ndmCamera) {
await detailCameraApi(id, { stationCode, signal });
return;
}
if (deviceType === DEVICE_TYPE_LITERALS.ndmDecoder) {
await detailDecoderApi(id, { stationCode, signal });
return;
}
if (deviceType === DEVICE_TYPE_LITERALS.ndmKeyboard) {
await detailKeyboardApi(id, { stationCode, signal });
return;
}
if (deviceType === DEVICE_TYPE_LITERALS.ndmMediaServer) {
await detailMediaServerApi(id, { stationCode, signal });
return;
}
if (deviceType === DEVICE_TYPE_LITERALS.ndmNvr) {
await detailNvrApi(id, { stationCode, signal });
return;
}
if (deviceType === DEVICE_TYPE_LITERALS.ndmSecurityBox) {
await detailSecurityBoxApi(id, { stationCode, signal });
return;
}
if (deviceType === DEVICE_TYPE_LITERALS.ndmSwitch) {
await detailSwitchApi(id, { stationCode, signal });
return;
}
if (deviceType === DEVICE_TYPE_LITERALS.ndmVideoServer) {
await detailVideoServerApi(id, { stationCode, signal });
return;
}
return undefined;
};

View File

@@ -0,0 +1,2 @@
export * from './detail-device';
export * from './probe-device';

View File

@@ -0,0 +1,33 @@
import { probeDecoderApi, probeMediaServerApi, probeNvrApi, probeSecurityBoxApi, probeSwitchApi, probeVideoServerApi, type NdmDeviceResultVO, type Station } from '@/apis';
import { DEVICE_TYPE_LITERALS, tryGetDeviceType } from '@/enums';
export const probeDeviceApi = async (device: NdmDeviceResultVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const deviceType = tryGetDeviceType(device.deviceType);
const deviceDbId = device.id;
if (!deviceType || !deviceDbId) throw new Error('未知的设备');
if (deviceType === DEVICE_TYPE_LITERALS.ndmDecoder) {
await probeDecoderApi([deviceDbId], { stationCode, signal });
return;
}
if (deviceType === DEVICE_TYPE_LITERALS.ndmNvr) {
await probeNvrApi([deviceDbId], { stationCode, signal });
return;
}
if (deviceType === DEVICE_TYPE_LITERALS.ndmSecurityBox) {
await probeSecurityBoxApi([deviceDbId], { stationCode, signal });
return;
}
if (deviceType === DEVICE_TYPE_LITERALS.ndmMediaServer) {
await probeMediaServerApi([deviceDbId], { stationCode, signal });
return;
}
if (deviceType === DEVICE_TYPE_LITERALS.ndmSwitch) {
await probeSwitchApi([deviceDbId], { stationCode, signal });
return;
}
if (deviceType === DEVICE_TYPE_LITERALS.ndmVideoServer) {
await probeVideoServerApi([deviceDbId], { stationCode, signal });
return;
}
};

View File

@@ -0,0 +1 @@
export * from './reset-monitor-shedule';

View File

@@ -0,0 +1,11 @@
import { ndmClient, userClient, type Station } from '@/apis';
export const resetMonitorScheduleApi = async (options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmConstant/anyTenant/resetMonitorSchedule`;
const resp = await client.get<void>(endpoint, { signal });
const [err] = resp;
if (err) throw err;
};

View File

@@ -0,0 +1,11 @@
import { userClient, type VerifyServer } from '@/apis';
export const batchVerifyApi = async (options?: { signal?: AbortSignal }) => {
const { signal } = options ?? {};
const endpoint = `/api/ndm/ndmKeepAlive/batchVerify`;
const resp = await userClient.post<VerifyServer[]>(endpoint, {}, { retRaw: true, timeout: 5000, signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};

View File

@@ -0,0 +1,3 @@
export * from './batch-verify';
export * from './ndm-icmp-export';
export * from './verify';

View File

@@ -0,0 +1,55 @@
import { ndmClient, userClient, type IcmpEntity, type Station } from '@/apis';
export const exportIcmpApi = async (status?: string, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmIcmpExport/exportByTemplate`;
const body = new URLSearchParams();
body.append('status', status ?? '');
const resp = await client.post<Blob>(endpoint, body, {
responseType: 'blob',
retRaw: true,
headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
signal,
});
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const exportIcmpByStationApi = async (stationCodes: Station['code'][], status: string, options?: { signal?: AbortSignal }) => {
const { signal } = options ?? {};
const client = ndmClient;
const prefix = '';
const endpoint = `${prefix}/api/ndm/ndmIcmpExport/exportByTemplateByStation`;
const resp = await client.post<Blob>(
endpoint,
{
stationCode: stationCodes,
status,
},
{
responseType: 'blob',
retRaw: true,
signal,
},
);
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const icmpEntityByDeviceId = async (deviceId: string, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmIcmpExport/icmpEntityByDeviceId`;
const resp = await client.get<IcmpEntity[]>(endpoint, { params: { deviceId }, signal, retRaw: true });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};

View File

@@ -0,0 +1,11 @@
import { ndmClient, userClient, type Station } from '@/apis';
export const verifyApi = async (options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmKeepAlive/verify`;
const resp = await client.post<void>(endpoint, {}, { timeout: 5000, signal });
const [err] = resp;
if (err) throw err;
};

View File

@@ -0,0 +1,9 @@
export * from './alarm';
export * from './all';
export * from './composed';
export * from './constant';
export * from './icmp';
export * from './log';
export * from './storage';
export * from './other';
export * from './video';

View File

@@ -0,0 +1,6 @@
export * from './ndm-call-log';
export * from './ndm-device-alarm-log';
export * from './ndm-icmp-log';
export * from './ndm-snmp-log';
export * from './ndm-record-check';
export * from './ndm-vimp-log';

View File

@@ -0,0 +1,25 @@
import { ndmClient, userClient, type NdmCallLogPageQuery, type NdmCallLogResultVO, type PageParams, type PageResult, type Station } from '@/apis';
export const pageCallLogApi = async (pageQuery: PageParams<NdmCallLogPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmCallLog/page`;
const resp = await client.post<PageResult<NdmCallLogResultVO>>(endpoint, pageQuery, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const exportCallLogApi = async (pageQuery: PageParams<NdmCallLogPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmCallLog/defaultExportByTemplate`;
const resp = await client.post<Blob>(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};

View File

@@ -0,0 +1,37 @@
import { ndmClient, userClient, type NdmDeviceAlarmLogPageQuery, type NdmDeviceAlarmLogResultVO, type NdmDeviceAlarmLogUpdateVO, type PageParams, type PageResult, type Station } from '@/apis';
export const pageDeviceAlarmLogApi = async (pageQuery: PageParams<NdmDeviceAlarmLogPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmDeviceAlarmLog/page`;
const resp = await client.post<PageResult<NdmDeviceAlarmLogResultVO>>(endpoint, pageQuery, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const updateDeviceAlarmLogApi = async (updateVO: NdmDeviceAlarmLogUpdateVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmDeviceAlarmLog`;
const resp = await client.put<NdmDeviceAlarmLogResultVO>(endpoint, updateVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const exportDeviceAlarmLogApi = async (pageQuery: PageParams<NdmDeviceAlarmLogPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmDeviceAlarmLog/defaultExportByTemplate`;
const resp = await client.post<BlobPart>(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};

View File

@@ -0,0 +1,13 @@
import { ndmClient, userClient, type NdmIcmpLogPageQuery, type NdmIcmpLogResultVO, type PageParams, type PageResult, type Station } from '@/apis';
export const pageIcmpLogApi = async (pageQuery: PageParams<NdmIcmpLogPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmIcmpLog/page`;
const resp = await client.post<PageResult<NdmIcmpLogResultVO>>(endpoint, pageQuery, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};

View File

@@ -0,0 +1,55 @@
import { ndmClient, userClient, type ClientChannel, type NdmNvrResultVO, type NdmRecordCheck } from '@/apis';
import dayjs from 'dayjs';
export const getChannelListApi = async (ndmNvr: NdmNvrResultVO, options?: { stationCode?: string; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmRecordCheck/getChannelList`;
const resp = await client.post<ClientChannel[]>(endpoint, { code: ndmNvr.gbCode, time: '' }, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const getRecordCheckApi = async (ndmNvr: NdmNvrResultVO, lastDays: number, gbCodeList: string[], options?: { stationCode?: string; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmRecordCheck/getRecordCheckByParentId`;
const endDateTime = dayjs();
const startDateTime = endDateTime.subtract(lastDays, 'day');
const start = startDateTime.format('YYYY-MM-DD');
const end = endDateTime.format('YYYY-MM-DD');
const parentId = ndmNvr.gbCode;
const resp = await client.post<NdmRecordCheck[]>(endpoint, { start, end, parentId, gbCodeList }, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const reloadRecordCheckApi = async (channel: ClientChannel, dayOffset: number, options?: { stationCode?: string; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmRecordCheck/reloadRecordCheckByGbId`;
const resp = await client.post<boolean>(endpoint, { ...channel, dayOffset }, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const reloadAllRecordCheckApi = async (dayOffset: number, options?: { stationCode?: string; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmRecordCheck/reloadAllRecordCheck`;
const resp = await client.post<boolean>(endpoint, dayOffset, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};

View File

@@ -0,0 +1,13 @@
import { ndmClient, userClient, type NdmSnmpLogPageQuery, type NdmSnmpLogResultVO, type PageParams, type PageResult, type Station } from '@/apis';
export const pageSnmpLogApi = async (pageQuery: PageParams<NdmSnmpLogPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmSnmpLog/page`;
const resp = await client.post<PageResult<NdmSnmpLogResultVO>>(endpoint, pageQuery, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};

View File

@@ -0,0 +1,25 @@
import { ndmClient, userClient, type NdmVimpLogPageQuery, type NdmVimpLogResultVO, type PageParams, type PageResult, type Station } from '@/apis';
export const pageVimpLogApi = async (pageQuery: PageParams<NdmVimpLogPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmVimpLog/page`;
const resp = await client.post<PageResult<NdmVimpLogResultVO>>(endpoint, pageQuery, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const exportVimpLogApi = async (pageQuery: PageParams<NdmVimpLogPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmVimpLog/defaultExportByTemplate`;
const resp = await client.post<Blob>(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};

View File

@@ -0,0 +1,2 @@
export * from './ndm-security-box';
export * from './ndm-switch';

View File

@@ -0,0 +1,105 @@
import {
ndmClient,
userClient,
type NdmSecurityBoxPageQuery,
type NdmSecurityBoxResultVO,
type NdmSecurityBoxSaveVO,
type NdmSecurityBoxUpdateVO,
type PageParams,
type PageResult,
type Station,
} from '@/apis';
export const pageSecurityBoxApi = async (pageQuery: PageParams<NdmSecurityBoxPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmSecurityBox/page`;
const resp = await client.post<PageResult<NdmSecurityBoxResultVO>>(endpoint, pageQuery, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const detailSecurityBoxApi = async (id: string, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmSecurityBox/detail`;
const resp = await client.get<NdmSecurityBoxResultVO>(endpoint, { params: { id }, signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const saveSecurityBoxApi = async (saveVO: NdmSecurityBoxSaveVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmSecurityBox`;
const resp = await client.post<NdmSecurityBoxResultVO>(endpoint, saveVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const updateSecurityBoxApi = async (updateVO: NdmSecurityBoxUpdateVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmSecurityBox`;
const resp = await client.put<NdmSecurityBoxResultVO>(endpoint, updateVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const deleteSecurityBoxApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmSecurityBox`;
const resp = await client.delete<boolean>(endpoint, ids, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const probeSecurityBoxApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmSecurityBox/probeByIds`;
const resp = await client.post<void>(endpoint, ids, { signal });
const [err] = resp;
if (err) throw err;
};
export const turnCitcuitStatusApi = async (ipAddress: string, circuitIndex: number, status: number, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmSecurityBox/turnStatus`;
const resp = await client.post<boolean>(endpoint, { community: 'public', ipAddress, circuit: `${circuitIndex}`, status }, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const rebootSecurityBoxApi = async (ipAddress: string, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmSecurityBox/reboot`;
const resp = await client.post<boolean>(endpoint, { community: 'public', ipAddress }, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};

View File

@@ -0,0 +1,71 @@
import { ndmClient, type NdmSwitchPageQuery, type NdmSwitchResultVO, type NdmSwitchSaveVO, type NdmSwitchUpdateVO, type PageParams, type PageResult, type Station } from '@/apis';
export const pageSwitchApi = async (pageQuery: PageParams<NdmSwitchPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : ndmClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmSwitch/page`;
const resp = await client.post<PageResult<NdmSwitchResultVO>>(endpoint, pageQuery, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const detailSwitchApi = async (id: string, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : ndmClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmSwitch/detail`;
const resp = await client.get<NdmSwitchResultVO>(endpoint, { params: { id }, signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const saveSwitchApi = async (saveVO: NdmSwitchSaveVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : ndmClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmSwitch`;
const resp = await client.post<NdmSwitchResultVO>(endpoint, saveVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const updateSwitchApi = async (updateVO: NdmSwitchUpdateVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : ndmClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmSwitch`;
const resp = await client.put<NdmSwitchResultVO>(endpoint, updateVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const deleteSwitchApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : ndmClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmSwitch`;
const resp = await client.delete<boolean>(endpoint, ids, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const probeSwitchApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : ndmClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmSwitch/probeByIds`;
const resp = await client.post<void>(endpoint, ids, { signal });
const [err] = resp;
if (err) throw err;
};

View File

@@ -0,0 +1 @@
export * from './ndm-nvr';

View File

@@ -0,0 +1,81 @@
import { ndmClient, userClient, type NdmNvrPageQuery, type NdmNvrResultVO, type NdmNvrSaveVO, type NdmNvrUpdateVO, type PageParams, type PageResult, type Station } from '@/apis';
export const pageNvrPageApi = async (pageQuery: PageParams<NdmNvrPageQuery>, options?: { stationCode: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmNvr/page`;
const resp = await client.post<PageResult<NdmNvrResultVO>>(endpoint, pageQuery, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const detailNvrApi = async (id: string, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmNvr/detail`;
const resp = await client.get<NdmNvrResultVO>(endpoint, { params: { id }, signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const saveNvrApi = async (saveVO: NdmNvrSaveVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmNvr`;
const resp = await client.post<NdmNvrResultVO>(endpoint, saveVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const updateNvrApi = async (updateVO: NdmNvrUpdateVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmNvr`;
const resp = await client.put<NdmNvrResultVO>(endpoint, updateVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const deleteNvrApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmNvr`;
const resp = await client.delete<boolean>(endpoint, ids, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const probeNvrApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmNvr/probeByIds`;
const resp = await client.post<void>(endpoint, ids, { signal });
const [err] = resp;
if (err) throw err;
};
export const syncNvrChannelsApi = async (options?: { stationCode?: string; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmNvr/syncNvrChannels`;
const resp = await client.get<void>(endpoint, { signal });
const [err] = resp;
if (err) throw err;
};

View File

@@ -0,0 +1,6 @@
export * from './ndm-camera';
export * from './ndm-camera-ignore';
export * from './ndm-decoder';
export * from './ndm-keyboard';
export * from './ndm-media-server';
export * from './ndm-video-server';

View File

@@ -0,0 +1,61 @@
import { ndmClient, userClient, type NdmCameraIgnorePageQuery, type NdmCameraIgnoreResultVO, type NdmCameraIgnoreSaveVO, type NdmCameraIgnoreUpdateVO, type PageParams, type PageResult } from '@/apis';
export const pageCameraIgnoreApi = async (pageQuery: PageParams<NdmCameraIgnorePageQuery>, options?: { stationCode?: string; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmCameraIgnore/page`;
const resp = await client.post<PageResult<NdmCameraIgnoreResultVO>>(endpoint, pageQuery, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const detailCameraIgnoreApi = async (id: string, options?: { stationCode?: string; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmCameraIgnore/detail`;
const resp = await client.get<NdmCameraIgnoreResultVO>(endpoint, { params: { id }, signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const saveCameraIgnoreApi = async (saveVO: NdmCameraIgnoreSaveVO, options?: { stationCode?: string; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmCameraIgnore`;
const resp = await client.post<NdmCameraIgnoreResultVO>(endpoint, saveVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const updateCameraIgnoreApi = async (updateVO: NdmCameraIgnoreUpdateVO, options?: { stationCode?: string; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmCameraIgnore`;
const resp = await client.put<NdmCameraIgnoreResultVO>(endpoint, updateVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const deleteCameraIgnoreApi = async (ids: string[], options?: { stationCode?: string; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmCameraIgnore`;
const resp = await client.delete<boolean>(endpoint, ids, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};

View File

@@ -0,0 +1,94 @@
import {
ndmClient,
userClient,
type NdmCameraPageQuery,
type NdmCameraResultVO,
type NdmCameraSaveVO,
type NdmCameraUpdateVO,
type PageParams,
type PageResult,
type SnapResult,
type Station,
} from '@/apis';
export const pageCameraApi = async (pageQuery: PageParams<NdmCameraPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmCamera/page`;
const resp = await client.post<PageResult<NdmCameraResultVO>>(endpoint, pageQuery, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const detailCameraApi = async (id: string, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmCamera/detail`;
const resp = await client.get<NdmCameraResultVO>(endpoint, { params: { id }, signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const saveCameraApi = async (saveVO: NdmCameraSaveVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmCamera`;
const resp = await client.post<NdmCameraResultVO>(endpoint, saveVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const updateCameraApi = async (updateVO: NdmCameraUpdateVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmCamera`;
const resp = await client.put<NdmCameraResultVO>(endpoint, updateVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const deleteCameraApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmCamera`;
const resp = await client.delete<boolean>(endpoint, ids, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const getCameraSnapApi = async (deviceId: string, options?: { signal?: AbortSignal }) => {
const { signal } = options ?? {};
const endpoint = `/api/ndm/ndmCamera/getSnapByDeviceId`;
const resp = await ndmClient.get<SnapResult>(endpoint, { params: { deviceId }, signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const syncCameraApi = async (options?: { stationCode?: string; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmCamera/syncCamera`;
const resp = await client.get<boolean>(endpoint, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};

View File

@@ -0,0 +1,71 @@
import { ndmClient, userClient, type NdmDecoderPageQuery, type NdmDecoderResultVO, type NdmDecoderSaveVO, type NdmDecoderUpdateVO, type PageParams, type PageResult, type Station } from '@/apis';
export const pageDecoderApi = async (pageQuery: PageParams<NdmDecoderPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmDecoder/page`;
const resp = await client.post<PageResult<NdmDecoderResultVO>>(endpoint, pageQuery, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const detailDecoderApi = async (id: string, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmDecoder/detail`;
const resp = await client.get<NdmDecoderResultVO>(endpoint, { params: { id }, signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const saveDecoderApi = async (saveVO: NdmDecoderSaveVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmDecoder`;
const resp = await client.post<NdmDecoderResultVO>(endpoint, saveVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const updateDecoderApi = async (updateVO: NdmDecoderUpdateVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmDecoder`;
const resp = await client.put<NdmDecoderResultVO>(endpoint, updateVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const deleteDecoderApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmDecoder`;
const resp = await client.delete<boolean>(endpoint, ids, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const probeDecoderApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmDecoder/probeByIds`;
const resp = await client.post<void>(endpoint, ids, { signal });
const [err] = resp;
if (err) throw err;
};

View File

@@ -0,0 +1,61 @@
import { ndmClient, userClient, type NdmKeyboardPageQuery, type NdmKeyboardResultVO, type NdmKeyboardSaveVO, type NdmKeyboardUpdateVO, type PageParams, type PageResult, type Station } from '@/apis';
export const pageKeyboardApi = async (pageQuery: PageParams<NdmKeyboardPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmKeyboard/page`;
const resp = await client.post<PageResult<NdmKeyboardResultVO>>(endpoint, pageQuery, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const detailKeyboardApi = async (id: string, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmKeyboard/detail`;
const resp = await client.get<NdmKeyboardResultVO>(endpoint, { params: { id }, signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const saveKeyboardApi = async (saveVO: NdmKeyboardSaveVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmKeyboard`;
const resp = await client.post<NdmKeyboardResultVO>(endpoint, saveVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const updateKeyboardApi = async (updateVO: NdmKeyboardUpdateVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmKeyboard`;
const resp = await client.put<NdmKeyboardResultVO>(endpoint, updateVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const deleteKeyboardApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmKeyboard`;
const resp = await client.delete<boolean>(endpoint, ids, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};

View File

@@ -0,0 +1,81 @@
import {
ndmClient,
userClient,
type NdmMediaServerPageQuery,
type NdmMediaServerResultVO,
type NdmMediaServerSaveVO,
type NdmMediaServerUpdateVO,
type PageParams,
type PageResult,
type Station,
} from '@/apis';
export const postNdmMediaServerPage = async (pageQuery: PageParams<NdmMediaServerPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmMediaServer/page`;
const resp = await client.post<PageResult<NdmMediaServerResultVO>>(endpoint, pageQuery, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const detailMediaServerApi = async (id: string, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmMediaServer/detail`;
const resp = await client.get<NdmMediaServerResultVO>(endpoint, { params: { id }, signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const saveMediaServerApi = async (saveVO: NdmMediaServerSaveVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmMediaServer`;
const resp = await client.post<NdmMediaServerResultVO>(endpoint, saveVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const updateMediaServerApi = async (updateVO: NdmMediaServerUpdateVO, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmMediaServer`;
const resp = await client.put<NdmMediaServerResultVO>(endpoint, updateVO, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const deleteMediaServerApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmMediaServer`;
const resp = await client.delete<boolean>(endpoint, ids, { signal });
const [err, data] = resp;
if (err) throw err;
if (!data) throw new Error(`${data}`);
return data;
};
export const probeMediaServerApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
const { stationCode, signal } = options ?? {};
const client = stationCode ? ndmClient : userClient;
const prefix = stationCode ? `/${stationCode}` : '';
const endpoint = `${prefix}/api/ndm/ndmMediaServer/probeByIds`;
const resp = await client.post<void>(endpoint, ids, { signal });
const [err] = resp;
if (err) throw err;
};

Some files were not shown because too many files have changed in this diff Show More