initial commit

This commit is contained in:
yangsy
2025-08-13 01:36:30 +08:00
commit 202f83d157
78 changed files with 5896 additions and 0 deletions

28
src/apis/client.ts Normal file
View File

@@ -0,0 +1,28 @@
import type { AxiosError } from 'axios';
import { Request } from '@/utils/request';
export const ndmClient = new Request({
requestInterceptor: (config) => {
return config;
},
responseInterceptor: (response) => {
return response;
},
responseErrorInterceptor: (error) => {
return Promise.reject(error);
},
});
export const userClient = new Request({
responseErrorInterceptor: (error) => {
const err = error as AxiosError;
if (err.response?.status === 401) {
// TODO: 处理 401 错误,例如跳转到登录页
}
if (err.response?.status === 404) {
// TODO: 处理 404 错误
}
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,23 @@
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;
};
}

View File

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

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-info';
export * from './station';

View File

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

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,33 @@
export interface BasicPageParams {
page: number
pageSize: number
}
export interface BasicFetchResult<T> {
items: T[]
total: number
}
export interface RemoteData {
key: string | number
data?: any
}
export interface PageParams<T> {
model: T
size: number
current: number
sort?: string
order?: string
extra?: any
}
export interface PageResult<T> {
records: T[]
// offset: number
pages: string
current: string
total: string
size: string
orders: any[]
}

View File

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

View File

@@ -0,0 +1,27 @@
import type { BaseModel } from '../../base/model';
import type { ReduceForPageQuery, ReduceForSaveVO, ReduceForUpdateVO } from '../../base/reduce';
export interface NdmDeviceAlarmLogVO 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;
}
export type NdmDeviceAlarmLogResultVO = Partial<NdmDeviceAlarmLogVO>;
export type NdmDeviceAlarmLogSaveVO = Partial<Omit<NdmDeviceAlarmLogVO, ReduceForSaveVO>>;
export type NdmDeviceAlarmLogUpdateVO = Partial<Omit<NdmDeviceAlarmLogVO, ReduceForUpdateVO>>;
export type NdmDeviceAlarmLogPageQuery = Partial<Omit<NdmDeviceAlarmLogVO, ReduceForPageQuery>>;

View File

@@ -0,0 +1,28 @@
import type { NdmSecurityBoxVO } from './other/ndm-security-box';
import type { NdmSwitchVO } from './other/ndm-switch';
import type { NdmNvrVO } from './storage/ndm-nvr';
import type { NdmCameraVO } from './video/ndm-camera';
import type { NdmDecoderVO } from './video/ndm-decoder';
import type { NdmKeyboardVO } from './video/ndm-keyboard';
import type { NdmMediaServerVO } from './video/ndm-media-server';
import type { NdmVideoServerVO } from './video/ndm-video-server';
export * from './alarm/ndm-device-alarm-log';
export * from './log/ndm-icmp-log';
export * from './log/ndm-snmp-log';
export * from './other/ndm-security-box';
export * from './other/ndm-switch';
export * from './storage/ndm-nvr';
export * from './video/ndm-camera';
export * from './video/ndm-decoder';
export * from './video/ndm-keyboard';
export * from './video/ndm-media-server';
export * from './video/ndm-video-server';
export type NdmDeviceVO = NdmSecurityBoxVO | NdmSwitchVO | NdmNvrVO | NdmCameraVO | NdmDecoderVO | NdmKeyboardVO | NdmMediaServerVO | NdmVideoServerVO;
export type NdmServerVO = NdmMediaServerVO | NdmVideoServerVO;

View File

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

View File

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

View File

@@ -0,0 +1,35 @@
import type { BaseModel } from '../../base/model';
import type { ReduceForPageQuery, ReduceForSaveVO, ReduceForUpdateVO } from '../../base/reduce';
export interface NdmSecurityBoxVO 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 = Partial<NdmSecurityBoxVO>;
export type NdmSecurityBoxSaveVO = Partial<Omit<NdmSecurityBoxVO, ReduceForSaveVO>>;
export type NdmSecurityBoxUpdateVO = Partial<Omit<NdmSecurityBoxVO, ReduceForUpdateVO>>;
export type NdmSecurityBoxPageQuery = Partial<Omit<NdmSecurityBoxVO, ReduceForPageQuery>>;

View File

@@ -0,0 +1,35 @@
import type { BaseModel } from '../../base/model';
import type { ReduceForPageQuery, ReduceForSaveVO, ReduceForUpdateVO } from '../../base/reduce';
export interface NdmSwitchVO 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 = Partial<NdmSwitchVO>;
export type NdmSwitchSaveVO = Partial<Omit<NdmSwitchVO, ReduceForSaveVO>>;
export type NdmSwitchUpdateVO = Partial<Omit<NdmSwitchVO, ReduceForUpdateVO>>;
export type NdmSwitchPageQuery = Partial<Omit<NdmSwitchVO, ReduceForPageQuery>>;

View File

@@ -0,0 +1,134 @@
import type { BaseModel } from '../../base/model';
import type { ReduceForPageQuery, ReduceForSaveVO, ReduceForUpdateVO } from '../../base/reduce';
export interface NdmNvrVO 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 = Partial<NdmNvrVO>;
export type NdmNvrSaveVO = Partial<Omit<NdmNvrVO, ReduceForSaveVO>>;
export type NdmNvrUpdateVO = Partial<Omit<NdmNvrVO, ReduceForUpdateVO>>;
export type NdmNvrPageQuery = Partial<Omit<NdmNvrVO, ReduceForPageQuery>>;
export interface RecordSum {
code: string;
recordList: NdmRecordCheck[];
channel: ClientChannel;
availableRecordList: UnixRecordItem[];
unavailableRecordList: UnixRecordItem[];
}
export interface NdmRecordCheck extends BaseModel {
gbCode: string;
parentGbCode: string;
name: string;
ipAddress: string;
diagInfo: string | RecordInfo;
checkDate: string;
}
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;
}
export interface RecordInfo {
deviceId: string;
channelId: string;
sn: string;
name: string;
sumNum: number;
count: number;
lastTime: number;
recordList: RecordItem[];
}
export interface RecordItem {
startTime: string;
endTime: string;
}
export interface UnixRecordItem {
startTime: number;
endTime: number;
}
export interface QueryGbRecordBody {
code: string;
start: string;
end: string;
}
export interface QueryGbDeviceBody {
code: string;
time: string;
}
export interface QueryRecordCheckBody {
parentId: string;
start: string;
end: string;
}
export interface QueryReloadCheckBody {
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;
dayOffset: number;
}

View File

@@ -0,0 +1,45 @@
import type { BaseModel } from '../../base/model';
import type { ReduceForPageQuery, ReduceForSaveVO, ReduceForUpdateVO } from '../../base/reduce';
export interface NdmCameraVO 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 = Partial<NdmCameraVO>;
export type NdmCameraSaveVO = Partial<Omit<NdmCameraVO, ReduceForSaveVO>>;
export type NdmCameraUpdateVO = Partial<Omit<NdmCameraVO, ReduceForUpdateVO>>;
export type NdmCameraPageQuery = Partial<Omit<NdmCameraVO, ReduceForPageQuery>>;

View File

@@ -0,0 +1,42 @@
import type { BaseModel } from '../../base/model';
import type { ReduceForPageQuery, ReduceForSaveVO, ReduceForUpdateVO } from '../../base/reduce';
export interface NdmDecoderVO 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 = Partial<NdmDecoderVO>;
export type NdmDecoderSaveVO = Partial<Omit<NdmDecoderVO, ReduceForSaveVO>>;
export type NdmDecoderUpdateVO = Partial<Omit<NdmDecoderVO, ReduceForUpdateVO>>;
export type NdmDecoderPageQuery = Partial<Omit<NdmDecoderVO, ReduceForPageQuery>>;

View File

@@ -0,0 +1,35 @@
import type { BaseModel } from '../../base/model';
import type { ReduceForPageQuery, ReduceForSaveVO, ReduceForUpdateVO } from '../../base/reduce';
export interface NdmKeyboardVO 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 = Partial<NdmKeyboardVO>;
export type NdmKeyboardSaveVO = Partial<Omit<NdmKeyboardVO, ReduceForSaveVO>>;
export type NdmKeyboardUpdateVO = Partial<Omit<NdmKeyboardVO, ReduceForUpdateVO>>;
export type NdmKeyboardPageQuery = Partial<Omit<NdmKeyboardVO, ReduceForPageQuery>>;

View File

@@ -0,0 +1,39 @@
import type { BaseModel } from '../../base/model';
import type { ReduceForPageQuery, ReduceForSaveVO, ReduceForUpdateVO } from '../../base/reduce';
export interface NdmMediaServerVO 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 = Partial<NdmMediaServerVO>;
export type NdmMediaServerSaveVO = Partial<Omit<NdmMediaServerVO, ReduceForSaveVO>>;
export type NdmMediaServerUpdateVO = Partial<Omit<NdmMediaServerVO, ReduceForUpdateVO>>;
export type NdmMediaServerPageQuery = Partial<Omit<NdmMediaServerVO, ReduceForPageQuery>>;

View File

@@ -0,0 +1,39 @@
import type { BaseModel } from '../../base/model';
import type { ReduceForPageQuery, ReduceForSaveVO, ReduceForUpdateVO } from '../../base/reduce';
export interface NdmVideoServerVO 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 = Partial<NdmVideoServerVO>;
export type NdmVideoServerSaveVO = Partial<Omit<NdmVideoServerVO, ReduceForSaveVO>>;
export type NdmVideoServerUpdateVO = Partial<Omit<NdmVideoServerVO, ReduceForUpdateVO>>;
export type NdmVideoServerPageQuery = Partial<Omit<NdmVideoServerVO, ReduceForPageQuery>>;

View File

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

View File

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

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,8 @@
export * from './ndm-camera';
export * from './ndm-decoder';
export * from './ndm-keyboard';
export * from './ndm-media-server';
export * from './ndm-nvr';
export * from './ndm-security-box';
export * from './ndm-switch';
export * from './ndm-video-server';

View File

@@ -0,0 +1,24 @@
import type { PageParams, PageResult } from '@/apis/models/base/page';
import type { NdmCameraPageQuery, NdmCameraResultVO, NdmCameraUpdateVO } from '@/apis/models/device';
import { ndmClient } from '@/apis/client';
export const postNdmCameraPage = async (stationCode: string, pageQuery: PageParams<NdmCameraPageQuery>) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<PageResult<NdmCameraResultVO>>(`${prefix}/api/ndm/ndmCamera/page`, pageQuery);
const [err, ndmCameraData] = resp;
if (err || !ndmCameraData) {
throw err;
}
return ndmCameraData;
};
export const putNdmCamera = async (stationCode: string, updateVO: NdmCameraUpdateVO) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.put<NdmCameraResultVO>(`${prefix}/api/ndm/ndmCamera`, updateVO);
const [err, ndmCamera] = resp;
if (err || !ndmCamera) {
throw err;
}
return ndmCamera;
};

View File

@@ -0,0 +1,24 @@
import type { PageParams, PageResult } from '@/apis/models/base/page';
import type { NdmDecoderPageQuery, NdmDecoderResultVO, NdmDecoderUpdateVO } from '@/apis/models/device';
import { ndmClient } from '@/apis/client';
export const postNdmDecoderPage = async (stationCode: string, pageQuery: PageParams<NdmDecoderPageQuery>) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<PageResult<NdmDecoderResultVO>>(`${prefix}/api/ndm/ndmDecoder/page`, pageQuery);
const [err, ndmDecoderData] = resp;
if (err || !ndmDecoderData) {
throw err;
}
return ndmDecoderData;
};
export const putNdmDecoder = async (stationCode: string, updateVO: NdmDecoderUpdateVO) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.put<NdmDecoderResultVO>(`${prefix}/api/ndm/ndmDecoder`, updateVO);
const [err, ndmDecoder] = resp;
if (err || !ndmDecoder) {
throw err;
}
return ndmDecoder;
};

View File

@@ -0,0 +1,24 @@
import type { PageParams, PageResult } from '@/apis/models/base/page';
import type { NdmKeyboardPageQuery, NdmKeyboardResultVO, NdmKeyboardUpdateVO } from '@/apis/models/device';
import { ndmClient } from '@/apis/client';
export const postNdmKeyboardPage = async (stationCode: string, pageQuery: PageParams<NdmKeyboardPageQuery>) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<PageResult<NdmKeyboardResultVO>>(`${prefix}/api/ndm/ndmKeyboard/page`, pageQuery);
const [err, ndmKeyboardData] = resp;
if (err || !ndmKeyboardData) {
throw err;
}
return ndmKeyboardData;
};
export const putNdmKeyboard = async (stationCode: string, updateVO: NdmKeyboardUpdateVO) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.put<NdmKeyboardResultVO>(`${prefix}/api/ndm/ndmKeyboard`, updateVO);
const [err, ndmKeyboard] = resp;
if (err || !ndmKeyboard) {
throw err;
}
return ndmKeyboard;
};

View File

@@ -0,0 +1,24 @@
import type { PageParams, PageResult } from '@/apis/models/base/page';
import type { NdmMediaServerPageQuery, NdmMediaServerResultVO, NdmMediaServerUpdateVO } from '@/apis/models/device';
import { ndmClient } from '@/apis/client';
export const postNdmMediaServerPage = async (stationCode: string, pageQuery: PageParams<NdmMediaServerPageQuery>) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<PageResult<NdmMediaServerResultVO>>(`${prefix}/api/ndm/ndmMediaServer/page`, pageQuery);
const [err, ndmMediaServerData] = resp;
if (err || !ndmMediaServerData) {
throw err;
}
return ndmMediaServerData;
};
export const putNdmMediaServer = async (stationCode: string, updateVO: NdmMediaServerUpdateVO) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.put<NdmMediaServerResultVO>(`${prefix}/api/ndm/ndmMediaServer`, updateVO);
const [err, ndmMediaServer] = resp;
if (err || !ndmMediaServer) {
throw err;
}
return ndmMediaServer;
};

View File

@@ -0,0 +1,10 @@
import { ndmClient } from '@/apis/client';
export const resetMonitorSchedule = async (stationCode: string) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.get<void>(`${prefix}/api/ndm/ndmConstant/anyTenant/resetMonitorSchedule`);
const [err] = resp;
if (err) {
throw err;
}
};

View File

@@ -0,0 +1,69 @@
import dayjs from 'dayjs';
import type { PageParams, PageResult } from '@/apis/models/base/page';
import type { ClientChannel, NdmNvrPageQuery, NdmNvrResultVO, NdmNvrUpdateVO, NdmNvrVO, NdmRecordCheck } from '@/apis/models/device';
import { ndmClient } from '@/apis/client';
export const postNdmNvrPage = async (stationCode: string, pageQuery: PageParams<NdmNvrPageQuery>) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<PageResult<NdmNvrResultVO>>(`${prefix}/api/ndm/ndmNvr/page`, pageQuery);
const [err, ndmNvrData] = resp;
if (err || !ndmNvrData) {
throw err;
}
return ndmNvrData;
};
export const putNdmNvr = async (stationCode: string, updateVO: NdmNvrUpdateVO) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.put<NdmNvrResultVO>(`${prefix}/api/ndm/ndmNvr`, updateVO);
const [err, ndmNvr] = resp;
if (err || !ndmNvr) {
throw err;
}
return ndmNvr;
};
export const getChannelList = async (stationCode: string, ndmNvr: NdmNvrVO) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<ClientChannel[]>(`${prefix}/api/ndm/ndmRecordCheck/getChannelList`, {
code: ndmNvr.gbCode,
time: '',
});
const [err, channelList] = resp;
if (err || !channelList) {
throw err;
}
return channelList;
};
export const getRecordCheckByParentId = async (stationCode: string, ndmNvr: NdmNvrVO, lastDays: number, gbCodeList: string[] = []) => {
const prefix = stationCode ? `/${stationCode}` : '';
const endDateTime = dayjs();
const startDateTime = endDateTime.subtract(lastDays, 'day');
const resp = await ndmClient.post<NdmRecordCheck[]>(`${prefix}/api/ndm/ndmRecordCheck/getRecordCheckByParentId`, {
start: startDateTime.format('YYYY-MM-DD'),
end: endDateTime.format('YYYY-MM-DD'),
parentId: ndmNvr.gbCode,
gbCodeList,
});
const [err, recordCheckList] = resp;
if (err || !recordCheckList) {
throw err;
}
return recordCheckList;
};
export const reloadRecordCheckByGbId = async (stationCode: string, channel: ClientChannel, dayOffset: number) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<boolean>(`${prefix}/api/ndm/ndmRecordCheck/reloadRecordCheckByGbId`, {
...channel,
dayOffset,
});
const [err, result] = resp;
if (err || !result) {
throw err;
}
return result;
};

View File

@@ -0,0 +1,39 @@
import type { PageParams, PageResult } from '@/apis/models/base/page';
import type { NdmSecurityBoxPageQuery, NdmSecurityBoxResultVO, NdmSecurityBoxUpdateVO } from '@/apis/models/device';
import { ndmClient } from '@/apis/client';
export const postNdmSecurityBoxPage = async (stationCode: string, pageQuery: PageParams<NdmSecurityBoxPageQuery>) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<PageResult<NdmSecurityBoxResultVO>>(`${prefix}/api/ndm/ndmSecurityBox/page`, pageQuery);
const [err, ndmSecurityBoxData] = resp;
if (err || !ndmSecurityBoxData) {
throw err;
}
return ndmSecurityBoxData;
};
export const putNdmSecurityBox = async (stationCode: string, updateVO: NdmSecurityBoxUpdateVO) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.put<NdmSecurityBoxResultVO>(`${prefix}/api/ndm/ndmSecurityBox`, updateVO);
const [err, ndmSecurityBox] = resp;
if (err || !ndmSecurityBox) {
throw err;
}
return ndmSecurityBox;
};
export const turnStatus = async (stationCode: string, ipAddress: string, circuitIndex: number, status: number) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<boolean>(`${prefix}/api/ndm/ndmSecurityBox/turnStatus`, {
community: 'public',
ipAddress,
circuit: `${circuitIndex}`,
status,
});
const [err, result] = resp;
if (err || !result) {
throw err;
}
return result;
};

View File

@@ -0,0 +1,24 @@
import type { PageParams, PageResult } from '@/apis/models/base/page';
import type { NdmSwitchPageQuery, NdmSwitchResultVO, NdmSwitchUpdateVO } from '@/apis/models/device';
import { ndmClient } from '@/apis/client';
export const postNdmSwitchPage = async (stationCode: string, pageQuery: PageParams<NdmSwitchPageQuery>) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<PageResult<NdmSwitchResultVO>>(`${prefix}/api/ndm/ndmSwitch/page`, pageQuery);
const [err, ndmSwitchData] = resp;
if (err || !ndmSwitchData) {
throw err;
}
return ndmSwitchData;
};
export const putNdmSwitch = async (stationCode: string, updateVO: NdmSwitchUpdateVO) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.put<NdmSwitchResultVO>(`${prefix}/api/ndm/ndmSwitch`, updateVO);
const [err, ndmSwitch] = resp;
if (err || !ndmSwitch) {
throw err;
}
return ndmSwitch;
};

View File

@@ -0,0 +1,24 @@
import type { PageParams, PageResult } from '@/apis/models/base/page';
import type { NdmVideoServerPageQuery, NdmVideoServerResultVO, NdmVideoServerUpdateVO } from '@/apis/models/device';
import { ndmClient } from '@/apis/client';
export const postNdmVideoServerPage = async (stationCode: string, pageQuery: PageParams<NdmVideoServerPageQuery>) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<PageResult<NdmVideoServerResultVO>>(`${prefix}/api/ndm/ndmVideoServer/page`, pageQuery);
const [err, ndmVideoServerData] = resp;
if (err || !ndmVideoServerData) {
throw err;
}
return ndmVideoServerData;
};
export const putNdmVideoServer = async (stationCode: string, updateVO: NdmVideoServerUpdateVO) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.put<NdmVideoServerResultVO>(`${prefix}/api/ndm/ndmVideoServer`, updateVO);
const [err, ndmVideoServer] = resp;
if (err || !ndmVideoServer) {
throw err;
}
return ndmVideoServer;
};

View File

@@ -0,0 +1,17 @@
export * from './device/ndm-camera';
export * from './device/ndm-decoder';
export * from './device/ndm-keyboard';
export * from './device/ndm-media-server';
export * from './device/ndm-monitor';
export * from './device/ndm-nvr';
export * from './device/ndm-security-box';
export * from './device/ndm-switch';
export * from './device/ndm-video-server';
export * from './log/ndm-device-alarm-log';
export * from './log/ndm-icmp-log';
export * from './log/ndm-snmp-log';
export * from './station/ndm-verify';
export * from './system/def-parameter';

View File

@@ -0,0 +1,10 @@
import type { PageParams, PageResult } from '@/apis/models/base/page';
import type { NdmDeviceAlarmLogPageQuery, NdmDeviceAlarmLogResultVO } from '@/apis/models/device/alarm/ndm-device-alarm-log';
import { ndmClient } from '@/apis/client';
export const postNdmDeviceAlarmLogPage = async (stationCode: string, pageQuery: PageParams<NdmDeviceAlarmLogPageQuery>) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<PageResult<NdmDeviceAlarmLogResultVO>>(`${prefix}/api/ndm/ndmDeviceAlarmLog/page`, pageQuery);
return resp;
};

View File

@@ -0,0 +1,10 @@
import type { PageParams, PageResult } from '@/apis/models/base/page';
import type { NdmIcmpLogPageQuery, NdmIcmpLogResultVO } from '@/apis/models/device';
import { ndmClient } from '@/apis/client';
export const postIcmpLogPage = async (stationCode: string, pageQuery: PageParams<NdmIcmpLogPageQuery>) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<PageResult<NdmIcmpLogResultVO>>(`${prefix}/api/ndm/ndmIcmpLog/page`, pageQuery);
return resp;
};

View File

@@ -0,0 +1,10 @@
import type { PageParams, PageResult } from '@/apis/models/base/page';
import type { NdmSnmpLogPageQuery, NdmSnmpLogResultVO } from '@/apis/models/device';
import { ndmClient } from '@/apis/client';
export const postSnmpLogPage = async (stationCode: string, pageQuery: PageParams<NdmSnmpLogPageQuery>) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<PageResult<NdmSnmpLogResultVO>>(`${prefix}/api/ndm/ndmSnmpLog/page`, pageQuery);
return resp;
};

View File

@@ -0,0 +1,10 @@
import { ndmClient } from '@/apis/client';
export const ndmVerify = async (stationCode: string) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<void>(`${prefix}/api/ndm/ndmKeepAlive/verify`, {}, { timeout: 5000 });
const [err] = resp;
if (err) {
throw err;
}
};

View File

@@ -0,0 +1,22 @@
import type { PageParams, PageResult } from '@/apis/models/base/page';
import type { Result } from '@/axios';
import type { DefParameterPageQuery, DefParameterResultVO, DefParameterUpdateVO } from '../../models/system';
import { ndmClient } from '../../client';
export const postDefParameterPage = async (stationCode: string, pageQuery: PageParams<DefParameterPageQuery>) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.post<PageResult<DefParameterResultVO>>(`${prefix}/api/system/defParameter/page`, pageQuery);
const [err, defParameterData] = resp;
if (err || !defParameterData) {
throw err;
}
return defParameterData;
};
export const putDefParameter = async (stationCode: string, updateVO: DefParameterUpdateVO) => {
const prefix = stationCode ? `/${stationCode}` : '';
const resp = await ndmClient.put<Result<DefParameterResultVO>>(`${prefix}/api/system/defParameter`, { ...updateVO });
return resp;
};