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

8
.editorconfig Normal file
View File

@@ -0,0 +1,8 @@
[*.{js,jsx,mjs,cjs,ts,tsx,mts,cts,vue,css,scss,sass,less,styl}]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
end_of_line = lf
max_line_length = 100

25
.env Normal file
View File

@@ -0,0 +1,25 @@
# APP名称
VITE_APP_TITLE = 网络设备管理平台
# 轮询间隔
VITE_REQUEST_INTERVAL = 120
# 网管的appKey
VITE_NDM_APP_KEY = ndm
# clientId 和 clientSecret 用于生成 Authorization
VITE_LAMP_CLIENT_ID = cuedes_admin
VITE_LAMP_CLIENT_SECRET = cuedes_admin_secret
# 用于登录 LAMP 系统的用户名和密码
VITE_LAMP_USERNAME = lamp
VITE_LAMP_PASSWORD = fjoc(1KHP(Ls&Bje)C
# 如果 Authorization 已存在则会直接采用, 否则会根据 clientId 和 clientSecret 生成
VITE_LAMP_AUTHORIZATION = Y3VlZGVzX2FkbWluOmN1ZWRlc19hZG1pbl9zZWNyZXQ=
# 当需要重置localStorage时, 修改此变量
VITE_STORAGE_VERSION = 3
# 调试码
VITE_DEBUG_CODE = ndm_debug

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
* text=auto eol=lf

37
.gitignore vendored Normal file
View File

@@ -0,0 +1,37 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
node_modules
.DS_Store
dist
dist-ssr
coverage
*.local
# Editor directories and files
.vscode/*
!.vscode/extensions.json
!.vscode/settings.json
.idea
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
*.tsbuildinfo
.eslintcache
# Cypress
/cypress/videos/
/cypress/screenshots/
# Vitest
__screenshots__/

10
.prettierrc.json Normal file
View File

@@ -0,0 +1,10 @@
{
"$schema": "https://json.schemastore.org/prettierrc",
"endOfLine": "lf",
"printWidth": 200,
"semi": true,
"singleAttributePerLine": false,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all"
}

8
.vscode/extensions.json vendored Normal file
View File

@@ -0,0 +1,8 @@
{
"recommendations": [
"Vue.volar",
"dbaeumer.vscode-eslint",
"EditorConfig.EditorConfig",
"esbenp.prettier-vscode"
]
}

13
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,13 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"[vue]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[typescript]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
}
}

57
README.md Normal file
View File

@@ -0,0 +1,57 @@
# 网络设备管理平台
`ndm-web-client` 项目重构而来包含升级依赖库、目录结构调整、轮询机制优化、enum重构、持久化方案改进等大型变更因此重新命名为 `ndm-web-platform`
## 安装依赖
```bash
pnpm install
```
### `vite` 代理配置
`vite.config.ts`已经配置了4号线和10号线的代理并启用了10号线的 `/api``/minio` 请求代理。
需要注意 `ProxyItem` 类型中的 `rewrite` 字段,它用于配置请求路径的重写规则。
例如有这样一个 `ProxyItem` 配置:
```typescript
{ key: '/1001/api', target: 'http://10.18.129.10:18760', rewrite: ['/1001/api', '/api'] }
```
此时如果我们发送一个请求到路径为 `/1001/api/ndm/ndmCamera/page` 的接口,则会命中 `vite` 的代理配置,将请求代理到 `http://10.18.129.10:18760` 上。
`vite` 的默认行为会将 `target``key` 拼接起来,即完整的请求路径是 `http://10.18.129.10:18760/1001/api/ndm/ndmCamera/page`,但是我们配置了 `rewrite` 规则,那么 `vite` 会将请求路径中的 `/1001/api` 替换为 `/api`,即最终的请求路径是 `http://10.18.129.10:18760/api/ndm/ndmCamera/page`
因此,在克隆该项目后,需要根据实际情况修改 `vite.config.ts` 中的代理配置,并将 `target``key` 替换为实际的目标地址和路径前缀。
## 启动项目
```bash
pnpm dev
```
## 构建项目
```bash
pnpm build
```
在执行 `pnpm build` 之前,你可以在 `package.json` 中修改 `version` 字段,将其设置为你期望的版本号,构建完成后,项目的根目录中除了 `dist` 目录外,还会生成三个压缩包,文件名的格式统一为 `ndm-web-platform_v<version>_<datetime>`,文件格式则分别为 `zip``tar``tar.gz`
## 调试模式
在调试模式中,用户可以查看设备的原始诊断数据,也可以对轮询器进行控制,或者启用离线开发模式,系统不会自动调用一些主动触发的请求。
### 开启调试模式
在非登录页的任意页面中,使用键盘组合键 `Ctrl+Alt+D`,系统会弹出一个输入框,输入环境变量 `.env` 中的 `VITE_DEBUG_CODE` 对应的值即可开启调试模式,如需关闭调试模式,再次使用上述组合键并点击 `确认` 按钮即可。
注意调试模式与其内部的功能之间没有联动关系,例如在开启调试模式后可以关闭轮询或者启用离线开发模式,但是在关闭调试模式后,轮询不会重新被开启,离线开发模式也不会被关闭,因此在关闭离线开发模式前,请务必确保系统处于正确的运行状态下。
### 关于离线开发模式
由于离线开发模式涉及到登录操作,因此项目中将离线开发模式暴露到了全局变量 `window.$offlineDev` 中,允许在登录页中直接开启离线开发模式。
如果你第一次启动这个项目,系统在正常情况下会先跳转至登录页,此时如果希望开启离线模式,可以直接打开浏览器的开发者工具,在控制台输入 `window.$offlineDev.value = true` 即可,系统会直接跳转到首页。

16
build/post-build.ts Normal file
View File

@@ -0,0 +1,16 @@
import { tgz, zip } from 'compressing';
import dayjs from 'dayjs';
import packageJson from '../package.json';
const now = dayjs();
const fileName = `${packageJson.name}_v${packageJson.version}_${now.format('YYMMDD-HHmmss')}`;
try {
await zip.compressDir('./dist', `${fileName}.zip`);
await tgz.compressDir('./dist', `${fileName}.tar`);
await tgz.compressDir('./dist', `${fileName}.tar.gz`);
} catch (error) {
console.error('压缩失败:', error);
}

17
build/pre-build.ts Normal file
View File

@@ -0,0 +1,17 @@
import { writeFile } from 'fs/promises';
import dayjs from 'dayjs';
import packageJson from '../package.json';
const now = dayjs();
const versionInfo = {
version: packageJson.version,
buildTime: now.format('YYYY-MM-DD HH:mm:ss'),
};
try {
await writeFile('./public/manifest.json', JSON.stringify(versionInfo, null, 2));
} catch (error) {
console.error('写入manifest失败:', error);
}

1
env.d.ts vendored Normal file
View File

@@ -0,0 +1 @@
/// <reference types="vite/client" />

32
eslint.config.ts Normal file
View File

@@ -0,0 +1,32 @@
import { globalIgnores } from 'eslint/config';
import { defineConfigWithVueTs, vueTsConfigs } from '@vue/eslint-config-typescript';
import pluginVue from 'eslint-plugin-vue';
import skipFormatting from '@vue/eslint-config-prettier/skip-formatting';
// To allow more languages other than `ts` in `.vue` files, uncomment the following lines:
// import { configureVueProject } from '@vue/eslint-config-typescript'
// configureVueProject({ scriptLangs: ['ts', 'tsx'] })
// More info at https://github.com/vuejs/eslint-config-typescript/#advanced-setup
export default defineConfigWithVueTs(
{
name: 'app/files-to-lint',
files: ['**/*.{ts,mts,tsx,vue}'],
},
globalIgnores(['**/dist/**', '**/dist-ssr/**', '**/coverage/**']),
pluginVue.configs['flat/essential'],
vueTsConfigs.recommended,
skipFormatting,
{
rules: {
'@typescript-eslint/no-explicit-any': 'off',
'@typescript-eslint/no-empty-object-type': 'off',
'@typescript-eslint/no-unused-vars': 'warn',
'vue/valid-template-root': 'off',
'vue/multi-word-component-names': 'off',
},
},
);

13
index.html Normal file
View File

@@ -0,0 +1,13 @@
<!doctype html>
<html lang="">
<head>
<meta charset="UTF-8" />
<link rel="icon" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title></title>
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>
</body>
</html>

62
package.json Normal file
View File

@@ -0,0 +1,62 @@
{
"name": "ndm-web-platform",
"version": "0.0.0",
"private": true,
"type": "module",
"engines": {
"node": "^20.19.0 || >=22.12.0"
},
"scripts": {
"dev": "vite",
"build": "tsx build/pre-build.ts && vue-tsc --build && vite build && tsx build/post-build.ts",
"preview": "vite preview",
"build-only": "vite build",
"type-check": "vue-tsc --build",
"lint": "eslint . --fix --cache",
"format": "prettier --write src/"
},
"dependencies": {
"@stomp/stompjs": "^7.2.1",
"@tanstack/vue-query": "^5.91.0",
"@tanstack/vue-query-devtools": "^6.0.0",
"@vueuse/core": "^14.0.0",
"axios": "^1.13.2",
"compressing": "^2.0.0",
"crypto-js": "^4.2.0",
"dayjs": "^1.11.19",
"destr": "^2.0.5",
"echarts": "^6.0.0",
"es-toolkit": "^1.41.0",
"localforage": "^1.10.0",
"naive-ui": "^2.43.1",
"pinia": "^3.0.4",
"pinia-plugin-persistedstate": "^4.7.1",
"sass": "^1.94.0",
"vue": "^3.5.24",
"vue-router": "^4.6.3",
"ws": "^8.18.3"
},
"devDependencies": {
"@tsconfig/node22": "^22.0.2",
"@types/crypto-js": "^4.2.2",
"@types/node": "^22.18.11",
"@vicons/antd": "^0.13.0",
"@vicons/ionicons5": "^0.13.0",
"@vitejs/plugin-vue": "^6.0.1",
"@vitejs/plugin-vue-jsx": "^5.1.1",
"@vue/eslint-config-prettier": "^10.2.0",
"@vue/eslint-config-typescript": "^14.6.0",
"@vue/tsconfig": "^0.8.1",
"eslint": "^9.39.1",
"eslint-plugin-vue": "~10.5.1",
"jiti": "^2.6.1",
"npm-run-all2": "^8.0.4",
"prettier": "3.6.2",
"tsx": "^4.20.6",
"typescript": "~5.9.3",
"vite": "^7.2.2",
"vite-plugin-vue-devtools": "^8.0.3",
"vue-tsc": "^3.1.3"
},
"packageManager": "pnpm@10.20.0+sha512.cf9998222162dd85864d0a8102e7892e7ba4ceadebbf5a31f9c2fce48dfce317a9c53b9f6464d1ef9042cba2e02ae02a9f7c143a2b438cd93c91840f0192b9dd"
}

4273
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

4
pnpm-workspace.yaml Normal file
View File

@@ -0,0 +1,4 @@
onlyBuiltDependencies:
- '@parcel/watcher'
- esbuild
- vue-demi

BIN
public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

4
public/manifest.json Normal file
View File

@@ -0,0 +1,4 @@
{
"version": "",
"buildTime": ""
}

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

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