refactor: reorganize files
This commit is contained in:
2
src/apis/clients/index.ts
Normal file
2
src/apis/clients/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './ndm-client';
|
||||
export * from './user-client';
|
||||
@@ -1,44 +1,8 @@
|
||||
import { useUserStore } from '@/stores';
|
||||
import { getAppEnvConfig, RequestClient } from '@/utils';
|
||||
import type { AxiosError } from 'axios';
|
||||
|
||||
import { Request } from '@/utils/request';
|
||||
import { useUserStore } from '@/stores/user';
|
||||
import { getAppEnvConfig } from '@/utils/env';
|
||||
|
||||
import router from '@/router';
|
||||
|
||||
export const userClient = new Request({
|
||||
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('/login');
|
||||
}
|
||||
if (err.response?.status === 404) {
|
||||
router.push('/404');
|
||||
}
|
||||
return Promise.reject(error);
|
||||
},
|
||||
});
|
||||
|
||||
export const ndmClient = new Request({
|
||||
export const ndmClient = new RequestClient({
|
||||
requestInterceptor: async (config) => {
|
||||
const userStore = useUserStore();
|
||||
const { lampAuthorization, lampClientId, lampClientSecret } = getAppEnvConfig();
|
||||
36
src/apis/clients/user-client.ts
Normal file
36
src/apis/clients/user-client.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
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('/login');
|
||||
}
|
||||
if (err.response?.status === 404) {
|
||||
router.push('/404');
|
||||
}
|
||||
return Promise.reject(error);
|
||||
},
|
||||
});
|
||||
6
src/apis/domains/device/diag/index.ts
Normal file
6
src/apis/domains/device/diag/index.ts
Normal 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';
|
||||
@@ -1,6 +1 @@
|
||||
export * from './diag-info/ndm-camera-diag-info';
|
||||
export * from './diag-info/ndm-decoder-diag-info';
|
||||
export * from './diag-info/ndm-nvr-diag-info';
|
||||
export * from './diag-info/ndm-security-box-diag-info';
|
||||
export * from './diag-info/ndm-server-diag-info';
|
||||
export * from './diag-info/ndm-switch-diag-info';
|
||||
export * from './diag';
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
export * from './device';
|
||||
export * from './station';
|
||||
export * from './version';
|
||||
|
||||
17
src/apis/domains/station/alarm.ts
Normal file
17
src/apis/domains/station/alarm.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import type { DeviceType } from '@/enums';
|
||||
|
||||
export interface StationAlarmCounts {
|
||||
[DeviceType.Camera]: number;
|
||||
[DeviceType.Decoder]: number;
|
||||
[DeviceType.Keyboard]: number;
|
||||
[DeviceType.MediaServer]: number;
|
||||
[DeviceType.Nvr]: number;
|
||||
[DeviceType.SecurityBox]: number;
|
||||
[DeviceType.Switch]: number;
|
||||
[DeviceType.VideoServer]: number;
|
||||
unclassified: number;
|
||||
}
|
||||
|
||||
export interface LineAlarmCounts {
|
||||
[stationCode: string]: StationAlarmCounts;
|
||||
}
|
||||
@@ -1,14 +1,5 @@
|
||||
import type {
|
||||
NdmCameraResultVO,
|
||||
NdmDecoderResultVO,
|
||||
NdmKeyboardResultVO,
|
||||
NdmMediaServerResultVO,
|
||||
NdmNvrResultVO,
|
||||
NdmSecurityBoxResultVO,
|
||||
NdmSwitchResultVO,
|
||||
NdmVideoServerResultVO,
|
||||
} from '@/apis/models';
|
||||
import type { DeviceType } from '@/enums/device-type';
|
||||
import type { NdmCameraResultVO, NdmDecoderResultVO, NdmKeyboardResultVO, NdmMediaServerResultVO, NdmNvrResultVO, NdmSecurityBoxResultVO, NdmSwitchResultVO, NdmVideoServerResultVO } from '@/apis';
|
||||
import type { DeviceType } from '@/enums';
|
||||
|
||||
export interface StationDevices {
|
||||
[DeviceType.Camera]: NdmCameraResultVO[];
|
||||
3
src/apis/domains/station/index.ts
Normal file
3
src/apis/domains/station/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './alarm';
|
||||
export * from './device';
|
||||
export * from './station';
|
||||
4
src/apis/index.ts
Normal file
4
src/apis/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from './clients';
|
||||
export * from './domains';
|
||||
export * from './models';
|
||||
export * from './requests';
|
||||
@@ -7,22 +7,10 @@ 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 './log/ndm-call-log';
|
||||
export * from './log/ndm-device-alarm-log';
|
||||
export * from './log/ndm-icmp-log';
|
||||
export * from './log/ndm-snmp-log';
|
||||
export * from './log/ndm-vimp-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 * from './log';
|
||||
export * from './other';
|
||||
export * from './storage';
|
||||
export * from './video';
|
||||
|
||||
export type NdmDeviceVO = NdmSecurityBoxVO | NdmSwitchVO | NdmNvrVO | NdmCameraVO | NdmDecoderVO | NdmKeyboardVO | NdmMediaServerVO | NdmVideoServerVO;
|
||||
export type NdmDeviceResultVO = Partial<NdmDeviceVO>;
|
||||
|
||||
5
src/apis/models/device/log/index.ts
Normal file
5
src/apis/models/device/log/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from './ndm-call-log';
|
||||
export * from './ndm-device-alarm-log';
|
||||
export * from './ndm-icmp-log';
|
||||
export * from './ndm-snmp-log';
|
||||
export * from './ndm-vimp-log';
|
||||
2
src/apis/models/device/other/index.ts
Normal file
2
src/apis/models/device/other/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './ndm-security-box';
|
||||
export * from './ndm-switch';
|
||||
1
src/apis/models/device/storage/index.ts
Normal file
1
src/apis/models/device/storage/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './ndm-nvr';
|
||||
5
src/apis/models/device/video/index.ts
Normal file
5
src/apis/models/device/video/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from './ndm-camera';
|
||||
export * from './ndm-decoder';
|
||||
export * from './ndm-keyboard';
|
||||
export * from './ndm-media-server';
|
||||
export * from './ndm-video-server';
|
||||
42
src/apis/requests/device/composed/get-device-detail.ts
Normal file
42
src/apis/requests/device/composed/get-device-detail.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import {
|
||||
getNdmDecoderDetail,
|
||||
getNdmKeyboardDetail,
|
||||
getNdmMediaServerDetail,
|
||||
getNdmNvrDetail,
|
||||
getNdmSecurityBoxDetail,
|
||||
getNdmSwitchDetail,
|
||||
getNdmVideoServerDetail,
|
||||
type NdmDeviceResultVO,
|
||||
} from '@/apis';
|
||||
import { DeviceType } from '@/enums';
|
||||
|
||||
export const getDeviceDetailApi = async (stationCode: string, id?: string, deviceType?: string): Promise<NdmDeviceResultVO | undefined> => {
|
||||
if (!id || !deviceType) {
|
||||
throw new Error('未知的设备');
|
||||
}
|
||||
if (deviceType === DeviceType.Camera) {
|
||||
return await getNdmVideoServerDetail(stationCode, id);
|
||||
}
|
||||
if (deviceType === DeviceType.Decoder) {
|
||||
return await getNdmDecoderDetail(stationCode, id);
|
||||
}
|
||||
if (deviceType === DeviceType.Keyboard) {
|
||||
return await getNdmKeyboardDetail(stationCode, id);
|
||||
}
|
||||
if (deviceType === DeviceType.MediaServer) {
|
||||
return await getNdmMediaServerDetail(stationCode, id);
|
||||
}
|
||||
if (deviceType === DeviceType.Nvr) {
|
||||
return await getNdmNvrDetail(stationCode, id);
|
||||
}
|
||||
if (deviceType === DeviceType.SecurityBox) {
|
||||
return await getNdmSecurityBoxDetail(stationCode, id);
|
||||
}
|
||||
if (deviceType === DeviceType.Switch) {
|
||||
return await getNdmSwitchDetail(stationCode, id);
|
||||
}
|
||||
if (deviceType === DeviceType.VideoServer) {
|
||||
return await getNdmVideoServerDetail(stationCode, id);
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
2
src/apis/requests/device/composed/index.ts
Normal file
2
src/apis/requests/device/composed/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './get-device-detail';
|
||||
export * from './probe-device';
|
||||
34
src/apis/requests/device/composed/probe-device.ts
Normal file
34
src/apis/requests/device/composed/probe-device.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { probeNdmDecoderByIds, probeNdmMediaServerByIds, probeNdmNvrByIds, probeNdmSecurityBoxByIds, probeNdmSwitchByIds, probeNdmVideoServerByIds, type NdmDeviceResultVO } from '@/apis';
|
||||
import { DeviceType, tryGetDeviceTypeVal } from '@/enums';
|
||||
|
||||
export const probeDeviceApi = async (stationCode: string, device: NdmDeviceResultVO) => {
|
||||
const deviceType = tryGetDeviceTypeVal(device.deviceType);
|
||||
const deviceDbId = device.id;
|
||||
if (!deviceType || !deviceDbId) {
|
||||
throw new Error('未知的设备');
|
||||
}
|
||||
if (deviceType === DeviceType.Decoder) {
|
||||
await probeNdmDecoderByIds(stationCode, [deviceDbId]);
|
||||
return;
|
||||
}
|
||||
if (deviceType === DeviceType.Nvr) {
|
||||
await probeNdmNvrByIds(stationCode, [deviceDbId]);
|
||||
return;
|
||||
}
|
||||
if (deviceType === DeviceType.SecurityBox) {
|
||||
await probeNdmSecurityBoxByIds(stationCode, [deviceDbId]);
|
||||
return;
|
||||
}
|
||||
if (deviceType === DeviceType.MediaServer) {
|
||||
await probeNdmMediaServerByIds(stationCode, [deviceDbId]);
|
||||
return;
|
||||
}
|
||||
if (deviceType === DeviceType.Switch) {
|
||||
await probeNdmSwitchByIds(stationCode, [deviceDbId]);
|
||||
return;
|
||||
}
|
||||
if (deviceType === DeviceType.VideoServer) {
|
||||
await probeNdmVideoServerByIds(stationCode, [deviceDbId]);
|
||||
return;
|
||||
}
|
||||
};
|
||||
1
src/apis/requests/device/constant/index.ts
Normal file
1
src/apis/requests/device/constant/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './reset-monitor-shedule';
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import { ndmClient } from '@/apis';
|
||||
|
||||
export const resetMonitorSchedule = async (stationCode: string) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
1
src/apis/requests/device/icmp/index.ts
Normal file
1
src/apis/requests/device/icmp/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './ndm-icmp-export';
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import { ndmClient } from '@/apis';
|
||||
|
||||
export const ndmExportDevices = async (status?: string) => {
|
||||
const endpoint = '/api/ndm/ndmIcmpExport/exportByTemplate';
|
||||
@@ -1,20 +1,7 @@
|
||||
export * from './export/ndm-icmp-export';
|
||||
|
||||
export * from './log/ndm-call-log';
|
||||
export * from './log/ndm-device-alarm-log';
|
||||
export * from './log/ndm-icmp-log';
|
||||
export * from './log/ndm-snmp-log';
|
||||
export * from './log/ndm-vimp-log';
|
||||
|
||||
export * from './storage/ndm-nvr';
|
||||
|
||||
export * from './other/ndm-security-box';
|
||||
export * from './other/ndm-switch';
|
||||
|
||||
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 * from './ndm-probe';
|
||||
export * from './composed';
|
||||
export * from './constant';
|
||||
export * from './icmp';
|
||||
export * from './log';
|
||||
export * from './storage';
|
||||
export * from './other';
|
||||
export * from './video';
|
||||
|
||||
5
src/apis/requests/device/log/index.ts
Normal file
5
src/apis/requests/device/log/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from './ndm-call-log';
|
||||
export * from './ndm-device-alarm-log';
|
||||
export * from './ndm-icmp-log';
|
||||
export * from './ndm-snmp-log';
|
||||
export * from './ndm-vimp-log';
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import type { NdmCallLogPageQuery, NdmCallLogResultVO, PageParams, PageResult } from '@/apis/models';
|
||||
import { ndmClient, type NdmCallLogPageQuery, type NdmCallLogResultVO, type PageParams, type PageResult } from '@/apis';
|
||||
|
||||
export const postNdmCallLogPage = async (stationCode: string, pageQuery: PageParams<NdmCallLogPageQuery>) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { userClient, ndmClient } from '@/apis/client';
|
||||
import type { PageParams, NdmDeviceAlarmLogPageQuery, PageResult, NdmDeviceAlarmLogResultVO, NdmDeviceAlarmLogUpdateVO } from '@/apis/models';
|
||||
import { ndmClient, userClient, type NdmDeviceAlarmLogPageQuery, type NdmDeviceAlarmLogResultVO, type NdmDeviceAlarmLogUpdateVO, type PageParams, type PageResult } from '@/apis';
|
||||
|
||||
export const postNdmDeviceAlarmLogPage = async (stationCode: string, pageQuery: PageParams<NdmDeviceAlarmLogPageQuery>, signal?: AbortSignal) => {
|
||||
const endpoint = '/api/ndm/ndmDeviceAlarmLog/page';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import type { PageParams, NdmIcmpLogPageQuery, PageResult, NdmIcmpLogResultVO } from '@/apis/models';
|
||||
import { ndmClient, type NdmIcmpLogPageQuery, type NdmIcmpLogResultVO, type PageParams, type PageResult } from '@/apis';
|
||||
|
||||
export const postIcmpLogPage = async (stationCode: string, pageQuery: PageParams<NdmIcmpLogPageQuery>) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import type { PageParams, NdmSnmpLogPageQuery, PageResult, NdmSnmpLogResultVO } from '@/apis/models';
|
||||
import { ndmClient, type NdmSnmpLogPageQuery, type NdmSnmpLogResultVO, type PageParams, type PageResult } from '@/apis';
|
||||
|
||||
export const postSnmpLogPage = async (stationCode: string, pageQuery: PageParams<NdmSnmpLogPageQuery>) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import type { PageParams, NdmVimpLogPageQuery, PageResult, NdmVimpLogResultVO } from '@/apis/models';
|
||||
import { ndmClient, type NdmVimpLogPageQuery, type NdmVimpLogResultVO, type PageParams, type PageResult } from '@/apis';
|
||||
|
||||
export const postNdmVimpLogPage = async (stationCode: string, pageQuery: PageParams<NdmVimpLogPageQuery>) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import type { NdmDeviceResultVO } from '@/apis/models';
|
||||
import { getNdmDecoderDetail, getNdmKeyboardDetail, getNdmMediaServerDetail, getNdmNvrDetail, getNdmSecurityBoxDetail, getNdmSwitchDetail, getNdmVideoServerDetail } from '@/apis/requests';
|
||||
import { DeviceType, tryGetDeviceTypeVal } from '@/enums/device-type';
|
||||
|
||||
export const probeNdmDecoderByIds = async (stationCode: string, ids: string[]) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<void>(`${prefix}/api/ndm/ndmDecoder/probeByIds`, ids);
|
||||
const [err] = resp;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
export const probeNdmNvrByIds = async (stationCode: string, ids: string[]) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<void>(`${prefix}/api/ndm/ndmNvr/probeByIds`, ids);
|
||||
const [err] = resp;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
export const probeNdmSecurityBoxByIds = async (stationCode: string, ids: string[]) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<void>(`${prefix}/api/ndm/ndmSecurityBox/probeByIds`, ids);
|
||||
const [err] = resp;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
export const probeNdmMediaServerByIds = async (stationCode: string, ids: string[]) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<void>(`${prefix}/api/ndm/ndmMediaServer/probeByIds`, ids);
|
||||
const [err] = resp;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
export const probeNdmSwitchByIds = async (stationCode: string, ids: string[]) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<void>(`${prefix}/api/ndm/ndmSwitch/probeByIds`, ids);
|
||||
const [err] = resp;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
export const probeNdmVideoServerByIds = async (stationCode: string, ids: string[]) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<void>(`${prefix}/api/ndm/ndmVideoServer/probeByIds`, ids);
|
||||
const [err] = resp;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
export const probeDeviceApi = async (stationCode: string, device: NdmDeviceResultVO) => {
|
||||
const deviceType = tryGetDeviceTypeVal(device.deviceType);
|
||||
const deviceDbId = device.id;
|
||||
if (!deviceType || !deviceDbId) {
|
||||
throw new Error('未知的设备');
|
||||
}
|
||||
if (deviceType === DeviceType.Decoder) {
|
||||
await probeNdmDecoderByIds(stationCode, [deviceDbId]);
|
||||
return;
|
||||
}
|
||||
if (deviceType === DeviceType.Nvr) {
|
||||
await probeNdmNvrByIds(stationCode, [deviceDbId]);
|
||||
return;
|
||||
}
|
||||
if (deviceType === DeviceType.SecurityBox) {
|
||||
await probeNdmSecurityBoxByIds(stationCode, [deviceDbId]);
|
||||
return;
|
||||
}
|
||||
if (deviceType === DeviceType.MediaServer) {
|
||||
await probeNdmMediaServerByIds(stationCode, [deviceDbId]);
|
||||
return;
|
||||
}
|
||||
if (deviceType === DeviceType.Switch) {
|
||||
await probeNdmSwitchByIds(stationCode, [deviceDbId]);
|
||||
return;
|
||||
}
|
||||
if (deviceType === DeviceType.VideoServer) {
|
||||
await probeNdmVideoServerByIds(stationCode, [deviceDbId]);
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
export const getDeviceDetailApi = async (stationCode: string, id?: string, deviceType?: string): Promise<NdmDeviceResultVO | undefined> => {
|
||||
if (!id || !deviceType) {
|
||||
throw new Error('未知的设备');
|
||||
}
|
||||
if (deviceType === DeviceType.Camera) {
|
||||
return await getNdmVideoServerDetail(stationCode, id);
|
||||
}
|
||||
if (deviceType === DeviceType.Decoder) {
|
||||
return await getNdmDecoderDetail(stationCode, id);
|
||||
}
|
||||
if (deviceType === DeviceType.Keyboard) {
|
||||
return await getNdmKeyboardDetail(stationCode, id);
|
||||
}
|
||||
if (deviceType === DeviceType.MediaServer) {
|
||||
return await getNdmMediaServerDetail(stationCode, id);
|
||||
}
|
||||
if (deviceType === DeviceType.Nvr) {
|
||||
return await getNdmNvrDetail(stationCode, id);
|
||||
}
|
||||
if (deviceType === DeviceType.SecurityBox) {
|
||||
return await getNdmSecurityBoxDetail(stationCode, id);
|
||||
}
|
||||
if (deviceType === DeviceType.Switch) {
|
||||
return await getNdmSwitchDetail(stationCode, id);
|
||||
}
|
||||
if (deviceType === DeviceType.VideoServer) {
|
||||
return await getNdmVideoServerDetail(stationCode, id);
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
2
src/apis/requests/device/other/index.ts
Normal file
2
src/apis/requests/device/other/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './ndm-security-box';
|
||||
export * from './ndm-switch';
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import type { PageParams, NdmSecurityBoxPageQuery, PageResult, NdmSecurityBoxResultVO, NdmSecurityBoxUpdateVO } from '@/apis/models';
|
||||
import { ndmClient, type NdmSecurityBoxPageQuery, type NdmSecurityBoxResultVO, type NdmSecurityBoxUpdateVO, type PageParams, type PageResult } from '@/apis';
|
||||
|
||||
export const postNdmSecurityBoxPage = async (stationCode: string, pageQuery: PageParams<NdmSecurityBoxPageQuery>, signal?: AbortSignal) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
@@ -31,6 +30,15 @@ export const putNdmSecurityBox = async (stationCode: string, updateVO: NdmSecuri
|
||||
return await getNdmSecurityBoxDetail(stationCode, ndmSecurityBox.id ?? '');
|
||||
};
|
||||
|
||||
export const probeNdmSecurityBoxByIds = async (stationCode: string, ids: string[]) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<void>(`${prefix}/api/ndm/ndmSecurityBox/probeByIds`, ids);
|
||||
const [err] = resp;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
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`, {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import type { PageParams, NdmSwitchPageQuery, PageResult, NdmSwitchResultVO, NdmSwitchUpdateVO } from '@/apis/models';
|
||||
import { ndmClient, type NdmSwitchPageQuery, type NdmSwitchResultVO, type NdmSwitchUpdateVO, type PageParams, type PageResult } from '@/apis';
|
||||
|
||||
export const postNdmSwitchPage = async (stationCode: string, pageQuery: PageParams<NdmSwitchPageQuery>, signal?: AbortSignal) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
@@ -30,3 +29,12 @@ export const putNdmSwitch = async (stationCode: string, updateVO: NdmSwitchUpdat
|
||||
}
|
||||
return await getNdmSwitchDetail(stationCode, ndmSwitch.id ?? '');
|
||||
};
|
||||
|
||||
export const probeNdmSwitchByIds = async (stationCode: string, ids: string[]) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<void>(`${prefix}/api/ndm/ndmSwitch/probeByIds`, ids);
|
||||
const [err] = resp;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
1
src/apis/requests/device/storage/index.ts
Normal file
1
src/apis/requests/device/storage/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './ndm-nvr';
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import type { PageParams, NdmNvrPageQuery, PageResult, NdmNvrResultVO, NdmNvrUpdateVO, ClientChannel, NdmRecordCheck } from '@/apis/models';
|
||||
import { ndmClient, type ClientChannel, type NdmNvrPageQuery, type NdmNvrResultVO, type NdmNvrUpdateVO, type NdmRecordCheck, type PageParams, type PageResult } from '@/apis';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
export const postNdmNvrPage = async (stationCode: string, pageQuery: PageParams<NdmNvrPageQuery>, signal?: AbortSignal) => {
|
||||
@@ -32,6 +31,15 @@ export const putNdmNvr = async (stationCode: string, updateVO: NdmNvrUpdateVO) =
|
||||
return await getNdmNvrDetail(stationCode, ndmNvr.id ?? '');
|
||||
};
|
||||
|
||||
export const probeNdmNvrByIds = async (stationCode: string, ids: string[]) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<void>(`${prefix}/api/ndm/ndmNvr/probeByIds`, ids);
|
||||
const [err] = resp;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
export const getChannelList = async (stationCode: string, ndmNvr: NdmNvrResultVO) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<ClientChannel[]>(`${prefix}/api/ndm/ndmRecordCheck/getChannelList`, {
|
||||
|
||||
5
src/apis/requests/device/video/index.ts
Normal file
5
src/apis/requests/device/video/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from './ndm-camera';
|
||||
export * from './ndm-decoder';
|
||||
export * from './ndm-keyboard';
|
||||
export * from './ndm-media-server';
|
||||
export * from './ndm-video-server';
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import type { PageParams, NdmCameraPageQuery, PageResult, NdmCameraResultVO, NdmCameraUpdateVO } from '@/apis/models';
|
||||
import { ndmClient, type NdmCameraPageQuery, type NdmCameraResultVO, type NdmCameraUpdateVO, type PageParams, type PageResult } from '@/apis';
|
||||
|
||||
export const postNdmCameraPage = async (stationCode: string, pageQuery: PageParams<NdmCameraPageQuery>, signal?: AbortSignal) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import type { PageParams, NdmDecoderPageQuery, PageResult, NdmDecoderResultVO, NdmDecoderUpdateVO } from '@/apis/models';
|
||||
import { ndmClient, type NdmDecoderPageQuery, type NdmDecoderResultVO, type NdmDecoderUpdateVO, type PageParams, type PageResult } from '@/apis';
|
||||
|
||||
export const postNdmDecoderPage = async (stationCode: string, pageQuery: PageParams<NdmDecoderPageQuery>, signal?: AbortSignal) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
@@ -30,3 +29,12 @@ export const putNdmDecoder = async (stationCode: string, updateVO: NdmDecoderUpd
|
||||
}
|
||||
return await getNdmDecoderDetail(stationCode, ndmDecoder.id ?? '');
|
||||
};
|
||||
|
||||
export const probeNdmDecoderByIds = async (stationCode: string, ids: string[]) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<void>(`${prefix}/api/ndm/ndmDecoder/probeByIds`, ids);
|
||||
const [err] = resp;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import type { PageParams, NdmKeyboardPageQuery, PageResult, NdmKeyboardResultVO, NdmKeyboardUpdateVO } from '@/apis/models';
|
||||
import { ndmClient, type NdmKeyboardPageQuery, type NdmKeyboardResultVO, type NdmKeyboardUpdateVO, type PageParams, type PageResult } from '@/apis';
|
||||
|
||||
export const postNdmKeyboardPage = async (stationCode: string, pageQuery: PageParams<NdmKeyboardPageQuery>, signal?: AbortSignal) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import type { PageParams, NdmMediaServerPageQuery, PageResult, NdmMediaServerResultVO, NdmMediaServerUpdateVO } from '@/apis/models';
|
||||
import { ndmClient, type NdmMediaServerPageQuery, type NdmMediaServerResultVO, type NdmMediaServerUpdateVO, type PageParams, type PageResult } from '@/apis';
|
||||
|
||||
export const postNdmMediaServerPage = async (stationCode: string, pageQuery: PageParams<NdmMediaServerPageQuery>, signal?: AbortSignal) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
@@ -30,3 +29,12 @@ export const putNdmMediaServer = async (stationCode: string, updateVO: NdmMediaS
|
||||
}
|
||||
return await getNdmMediaServerDetail(stationCode, ndmMediaServer.id ?? '');
|
||||
};
|
||||
|
||||
export const probeNdmMediaServerByIds = async (stationCode: string, ids: string[]) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<void>(`${prefix}/api/ndm/ndmMediaServer/probeByIds`, ids);
|
||||
const [err] = resp;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import type { PageParams, NdmVideoServerPageQuery, PageResult, NdmVideoServerResultVO, NdmVideoServerUpdateVO } from '@/apis/models';
|
||||
import { ndmClient, type NdmVideoServerPageQuery, type NdmVideoServerResultVO, type NdmVideoServerUpdateVO, type PageParams, type PageResult } from '@/apis';
|
||||
|
||||
export const postNdmVideoServerPage = async (stationCode: string, pageQuery: PageParams<NdmVideoServerPageQuery>, signal?: AbortSignal) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
@@ -30,3 +29,12 @@ export const putNdmVideoServer = async (stationCode: string, updateVO: NdmVideoS
|
||||
}
|
||||
return await getNdmVideoServerDetail(stationCode, ndmVideoServer.id ?? '');
|
||||
};
|
||||
|
||||
export const probeNdmVideoServerByIds = async (stationCode: string, ids: string[]) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const resp = await ndmClient.post<void>(`${prefix}/api/ndm/ndmVideoServer/probeByIds`, ids);
|
||||
const [err] = resp;
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
export * from './device';
|
||||
|
||||
export * from './station';
|
||||
|
||||
export * from './system';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import { ndmClient } from '@/apis';
|
||||
|
||||
export const ndmVerify = async (stationCode: string, signal?: AbortSignal) => {
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { ndmClient } from '@/apis/client';
|
||||
import type { PageParams, DefParameterPageQuery, PageResult, DefParameterResultVO, DefParameterUpdateVO } from '@/apis/models';
|
||||
import { ndmClient, type DefParameterPageQuery, type DefParameterResultVO, type DefParameterUpdateVO, type PageParams, type PageResult } from '@/apis';
|
||||
import type { Result } from '@/axios';
|
||||
|
||||
export const postDefParameterPage = async (stationCode: string, pageQuery: PageParams<DefParameterPageQuery>) => {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import type { Station } from '@/apis/domains';
|
||||
import type { LineDevices } from '@/composables/query';
|
||||
import { DeviceType } from '@/enums/device-type';
|
||||
import { computed, toRefs } from 'vue';
|
||||
import type { LineDevices, Station } from '@/apis';
|
||||
import { DeviceType } from '@/enums';
|
||||
import { NCard, NGrid, NGi, NStatistic, NSpace, NButton } from 'naive-ui';
|
||||
import { computed, toRefs } from 'vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationList: Station[];
|
||||
@@ -25,7 +24,7 @@ const onlineDeviceCount = computed(() => {
|
||||
if (station.online) {
|
||||
const stationDevices = lineDevices.value[station.code];
|
||||
Object.values(DeviceType).forEach((deviceType) => {
|
||||
const onlineDeviceList = stationDevices?.[deviceType].filter((device) => device.deviceStatus === '10') ?? [];
|
||||
const onlineDeviceList = stationDevices?.[deviceType]?.filter((device) => device.deviceStatus === '10') ?? [];
|
||||
count += onlineDeviceList.length;
|
||||
});
|
||||
}
|
||||
@@ -39,7 +38,7 @@ const offlineDeviceCount = computed(() => {
|
||||
if (station.online) {
|
||||
const stationDevices = lineDevices.value[station.code];
|
||||
Object.values(DeviceType).forEach((deviceType) => {
|
||||
const offlineDeviceList = stationDevices?.[deviceType].filter((device) => device.deviceStatus === '20') ?? [];
|
||||
const offlineDeviceList = stationDevices?.[deviceType]?.filter((device) => device.deviceStatus === '20') ?? [];
|
||||
count += offlineDeviceList.length;
|
||||
});
|
||||
}
|
||||
|
||||
1
src/components/dashboard-page/index.ts
Normal file
1
src/components/dashboard-page/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export { default as DeviceStatisticCard } from './device-statistic-card.vue';
|
||||
@@ -1,17 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmNvrResultVO, NdmRecordCheck, RecordInfo, RecordItem } from '@/apis/models';
|
||||
import { getRecordCheckByParentId as getRecordCheckByParentIdApi, reloadAllRecordCheck as reloadAllRecordCheckApi } from '@/apis/requests';
|
||||
import { getRecordCheckByParentId, reloadAllRecordCheck, type NdmNvrResultVO, type NdmRecordCheck, type RecordInfo, type RecordItem } from '@/apis';
|
||||
import { useStationStore } from '@/stores';
|
||||
import { downloadByData, formatDuration } from '@/utils';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import { formatDuration } from '@/utils/format-duration';
|
||||
import { VideocamOutline, TimeOutline, WarningOutline, CheckmarkCircleOutline, RefreshOutline } from '@vicons/ionicons5';
|
||||
import dayjs from 'dayjs';
|
||||
import { destr } from 'destr';
|
||||
import destr from 'destr';
|
||||
import { groupBy } from 'es-toolkit';
|
||||
import { NCard, NFlex, NText, NTag, NTimeline, NTimelineItem, NIcon, NEmpty, NStatistic, NGrid, NGridItem, NCollapse, NCollapseItem, NButton, NPopconfirm, NScrollbar } from 'naive-ui';
|
||||
import { computed, onMounted, ref, toRefs } from 'vue';
|
||||
import { downloadByData } from '@/utils/download';
|
||||
import { DownloadOutlined } from '@vicons/antd';
|
||||
import { useStationStore } from '@/stores/station';
|
||||
|
||||
type NvrRecordDiag = {
|
||||
gbCode: string;
|
||||
@@ -121,9 +116,9 @@ const recordDiagStatistics = computed(() => {
|
||||
};
|
||||
});
|
||||
|
||||
const { mutate: getRecordCheckByParentId, isPending: loading } = useMutation({
|
||||
const { mutate: getRecordChecks, isPending: loading } = useMutation({
|
||||
mutationFn: async () => {
|
||||
const recordCheckList = await getRecordCheckByParentIdApi(stationCode.value, ndmNvr.value, 90);
|
||||
const recordCheckList = await getRecordCheckByParentId(stationCode.value, ndmNvr.value, 90);
|
||||
return recordCheckList;
|
||||
},
|
||||
onSuccess: (checkList) => {
|
||||
@@ -135,9 +130,9 @@ const { mutate: getRecordCheckByParentId, isPending: loading } = useMutation({
|
||||
},
|
||||
});
|
||||
|
||||
const { mutate: reloadAllRecordCheck, isPending: reloading } = useMutation({
|
||||
const { mutate: reloadAllRecordChecks, isPending: reloading } = useMutation({
|
||||
mutationFn: async () => {
|
||||
await reloadAllRecordCheckApi(stationCode.value, 90);
|
||||
await reloadAllRecordCheck(stationCode.value, 90);
|
||||
},
|
||||
onSuccess: () => {
|
||||
window.$message.success('正在逐步刷新中,请稍后点击刷新按钮查看');
|
||||
@@ -149,7 +144,7 @@ const { mutate: reloadAllRecordCheck, isPending: reloading } = useMutation({
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
getRecordCheckByParentId();
|
||||
getRecordChecks();
|
||||
});
|
||||
|
||||
const onClickExportRecordCheck = () => {
|
||||
@@ -180,7 +175,7 @@ const onClickExportRecordCheck = () => {
|
||||
<template #header>
|
||||
<NFlex :align="'center'" :size="24">
|
||||
<div>录像诊断</div>
|
||||
<NPopconfirm @positive-click="() => reloadAllRecordCheck()">
|
||||
<NPopconfirm @positive-click="() => reloadAllRecordChecks()">
|
||||
<template #trigger>
|
||||
<NButton secondary size="small" :loading="reloading">
|
||||
<span>点击更新所有通道录像诊断</span>
|
||||
@@ -193,7 +188,7 @@ const onClickExportRecordCheck = () => {
|
||||
</NFlex>
|
||||
</template>
|
||||
<template #header-extra>
|
||||
<NButton size="small" quaternary circle :loading="loading" @click="() => getRecordCheckByParentId()">
|
||||
<NButton size="small" quaternary circle :loading="loading" @click="() => getRecordChecks()">
|
||||
<template #icon>
|
||||
<NIcon>
|
||||
<RefreshOutline />
|
||||
@@ -1,14 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmCameraResultVO } from '@/apis/models';
|
||||
import { useDebugModeStore } from '@/stores/debug-mode';
|
||||
import { destr } from 'destr';
|
||||
import type { NdmCameraDiagInfo, NdmCameraResultVO } from '@/apis';
|
||||
import { useDebugModeStore } from '@/stores';
|
||||
import destr from 'destr';
|
||||
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
||||
import { computed, ref, toRefs } from 'vue';
|
||||
|
||||
import DeviceHeaderCard from './current-diag-card/device-header-card.vue';
|
||||
import CameraHistoryDiagCard from './history-diag-card/camera-history-diag-card.vue';
|
||||
import DeviceCommonCard from './current-diag-card/device-common-card.vue';
|
||||
import type { NdmCameraDiagInfo } from '@/apis/domains';
|
||||
import { DeviceCommonCard, DeviceHeaderCard } from './current-diag-card';
|
||||
import { CameraHistoryDiagCard } from './history-diag-card';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmDeviceResultVO } from '@/apis/models';
|
||||
import { getDeviceDetailApi, probeDeviceApi } from '@/apis/requests';
|
||||
import { DeviceType, DeviceTypeName, tryGetDeviceTypeVal, type DeviceTypeVal } from '@/enums/device-type';
|
||||
import { useLineDevicesStore } from '@/stores/line-devices';
|
||||
import { getDeviceDetailApi, probeDeviceApi, type NdmDeviceResultVO } from '@/apis';
|
||||
import { DeviceType, DeviceTypeName, tryGetDeviceTypeVal, type DeviceTypeVal } from '@/enums';
|
||||
import { useLineDevicesStore } from '@/stores';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import { ApiOutlined, ReloadOutlined } from '@vicons/antd';
|
||||
import { NButton, NCard, NFlex, NIcon, NTag, NTooltip } from 'naive-ui';
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
export { default as DeviceCommonCard } from './device-common-card.vue';
|
||||
export { default as DeviceHardwareCard } from './device-hardware-card.vue';
|
||||
export { default as DeviceHeaderCard } from './device-header-card.vue';
|
||||
export { default as NvrDiskCard } from './nvr-disk-card.vue';
|
||||
export { default as NvrRecordDiagCard } from './nvr-record-diag-card.vue';
|
||||
export { default as SecurityBoxCircuitCard } from './security-box-circuit-card.vue';
|
||||
export { default as SecurityBoxInfoCard } from './security-box-info-card.vue';
|
||||
export { default as SwitchPortCard } from './switch-port-card.vue';
|
||||
@@ -1,12 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmNvrDiagInfo } from '@/apis/domains';
|
||||
import type { NdmNvrDiagInfo } from '@/apis';
|
||||
import { HardwareChipOutline, CheckmarkCircleOutline, CloseCircleOutline, WarningOutline } from '@vicons/ionicons5';
|
||||
import { NCard, NFlex, NProgress, NText, NIcon, NPopover, NGrid, NGridItem } from 'naive-ui';
|
||||
import { computed, toRefs } from 'vue';
|
||||
|
||||
const props = defineProps<{
|
||||
diskHealth?: NdmNvrDiagInfo['info']['diskHealth'];
|
||||
groupInfoList?: NdmNvrDiagInfo['info']['groupInfoList'];
|
||||
diskHealth?: NonNullable<NdmNvrDiagInfo['info']>['diskHealth'];
|
||||
groupInfoList?: NonNullable<NdmNvrDiagInfo['info']>['groupInfoList'];
|
||||
}>();
|
||||
|
||||
const { diskHealth, groupInfoList } = toRefs(props);
|
||||
@@ -153,8 +153,8 @@ const getUsageStatus = (percent: number) => {
|
||||
<!-- 存储使用率 -->
|
||||
<NFlex :align="'center'" :size="12">
|
||||
<NText style="width: 80px; font-size: 14px">存储使用率</NText>
|
||||
<NProgress :percentage="getUsagePercent(group.freeSize, group.totalSize)" :status="getUsageStatus(getUsagePercent(group.freeSize, group.totalSize))" style="flex: 1">
|
||||
<div>{{ getUsagePercent(group.freeSize, group.totalSize) }}%</div>
|
||||
<NProgress :percentage="getUsagePercent(group.freeSize ?? 0, group.totalSize ?? 0)" :status="getUsageStatus(getUsagePercent(group.freeSize ?? 0, group.totalSize ?? 0))" style="flex: 1">
|
||||
<div>{{ getUsagePercent(group.freeSize ?? 0, group.totalSize ?? 0) }}%</div>
|
||||
</NProgress>
|
||||
</NFlex>
|
||||
|
||||
@@ -162,15 +162,15 @@ const getUsageStatus = (percent: number) => {
|
||||
<div class="storage-details">
|
||||
<div class="storage-item">
|
||||
<span class="storage-label">总容量:</span>
|
||||
<span class="storage-value">{{ formatSize(group.totalSize) }}</span>
|
||||
<span class="storage-value">{{ formatSize(group.totalSize ?? 0) }}</span>
|
||||
</div>
|
||||
<div class="storage-item">
|
||||
<span class="storage-label">已用:</span>
|
||||
<span class="storage-value">{{ formatSize(group.totalSize - group.freeSize) }}</span>
|
||||
<span class="storage-value">{{ formatSize((group.totalSize ?? 0) - (group.freeSize ?? 0)) }}</span>
|
||||
</div>
|
||||
<div class="storage-item">
|
||||
<span class="storage-label">可用:</span>
|
||||
<span class="storage-value">{{ formatSize(group.freeSize) }}</span>
|
||||
<span class="storage-value">{{ formatSize(group.freeSize ?? 0) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</NFlex>
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import type { Station } from '@/apis/domains';
|
||||
import type { NdmNvrResultVO, NdmRecordCheck, RecordInfo, RecordItem } from '@/apis/models';
|
||||
import type { NdmNvrResultVO, NdmRecordCheck, RecordInfo, RecordItem, Station } from '@/apis';
|
||||
import {
|
||||
getChannelList,
|
||||
getRecordCheckByParentId as getRecordCheckByParentIdApi,
|
||||
reloadAllRecordCheck as reloadAllRecordCheckApi,
|
||||
reloadRecordCheckByGbId as reloadRecordCheckByGbIdApi,
|
||||
} from '@/apis/requests';
|
||||
import { useStationStore } from '@/stores/station';
|
||||
import { downloadByData } from '@/utils/download';
|
||||
import { formatDuration } from '@/utils/format-duration';
|
||||
} from '@/apis';
|
||||
import { useStationStore } from '@/stores';
|
||||
import { downloadByData, formatDuration } from '@/utils';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import { DownloadOutlined } from '@vicons/antd';
|
||||
import { RefreshOutline } from '@vicons/ionicons5';
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmSecurityBoxCircuit } from '@/apis/domains';
|
||||
import type { NdmSecurityBoxResultVO } from '@/apis/models';
|
||||
import { probeDeviceApi, rebootSecurityBox as rebootSecurityBoxApi, turnStatus as turnStatusApi } from '@/apis/requests';
|
||||
import { probeDeviceApi, rebootSecurityBox as rebootSecurityBoxApi, turnStatus as turnStatusApi, type NdmSecurityBoxCircuit, type NdmSecurityBoxResultVO } from '@/apis';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import { PowerOutline, FlashOutline } from '@vicons/ionicons5';
|
||||
import { NCard, NGrid, NGridItem, NPopover, NSwitch, NIcon, NFlex, NPopconfirm, NButton } from 'naive-ui';
|
||||
|
||||
@@ -15,8 +15,8 @@
|
||||
* - 响应式数据处理和布局
|
||||
*/
|
||||
|
||||
import type { NdmSwitchPortInfo } from '@/apis/domains';
|
||||
import { getPortStatusVal, transformPortSpeed } from '@/components/helper';
|
||||
import type { NdmSwitchPortInfo } from '@/apis';
|
||||
import { getPortStatusVal, transformPortSpeed } from '@/components';
|
||||
import { NCard, NGrid, NGridItem, NPopover } from 'naive-ui';
|
||||
import { computed, toRefs } from 'vue';
|
||||
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmDecoderDiagInfo } from '@/apis/domains';
|
||||
import type { NdmDecoderResultVO } from '@/apis/models';
|
||||
import { useDebugModeStore } from '@/stores/debug-mode';
|
||||
import type { NdmDecoderDiagInfo, NdmDecoderResultVO } from '@/apis';
|
||||
import { DecoderHistoryDiagCard, DeviceCommonCard, DeviceHardwareCard, DeviceHeaderCard } from '@/components';
|
||||
import { useDebugModeStore } from '@/stores';
|
||||
import { destr } from 'destr';
|
||||
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
||||
import { computed, ref, toRefs } from 'vue';
|
||||
|
||||
import DeviceHeaderCard from './current-diag-card/device-header-card.vue';
|
||||
import DeviceCommonCard from './current-diag-card/device-common-card.vue';
|
||||
import DeviceHardwareCard from './current-diag-card/device-hardware-card.vue';
|
||||
import DecoderHistoryDiagCard from './history-diag-card/decoder-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmDecoder: NdmDecoderResultVO;
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmCameraResultVO } from '@/apis/models';
|
||||
import { DeviceAlarmHistoryDiagCard, DeviceStatusHistoryDiagCard } from '@/components';
|
||||
import dayjs from 'dayjs';
|
||||
import { NButton, NCard, NDatePicker, NFlex, NGi, NGrid, NSelect, type DatePickerProps, type SelectOption } from 'naive-ui';
|
||||
import { computed, onMounted, reactive, ref, toRefs, useTemplateRef } from 'vue';
|
||||
|
||||
import DeviceStatusHistoryDiagCard from './device-status-history-diag-card.vue';
|
||||
import DeviceAlarmHistoryDiagCard from './device-alarm-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmCamera: NdmCameraResultVO;
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmDecoderResultVO } from '@/apis/models';
|
||||
import type { NdmDecoderResultVO } from '@/apis';
|
||||
import { DeviceAlarmHistoryDiagCard, DeviceStatusHistoryDiagCard, DeviceUsageHistoryDiagCard } from '@/components';
|
||||
import dayjs from 'dayjs';
|
||||
import { NButton, NCard, NDatePicker, NFlex, NGi, NGrid, NSelect, type DatePickerProps, type SelectOption } from 'naive-ui';
|
||||
import { computed, onMounted, reactive, ref, toRefs, useTemplateRef } from 'vue';
|
||||
|
||||
import DeviceStatusHistoryDiagCard from './device-status-history-diag-card.vue';
|
||||
import DeviceAlarmHistoryDiagCard from './device-alarm-history-diag-card.vue';
|
||||
import DeviceUsageHistoryDiagCard from './device-usage-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmDecoder: NdmDecoderResultVO;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmDeviceAlarmLogResultVO, NdmDeviceResultVO, PageParams } from '@/apis/models';
|
||||
import { postNdmDeviceAlarmLogPage } from '@/apis/requests';
|
||||
import { renderAlarmDateCell, renderAlarmTypeCell, renderFaultDescriptionCell, renderFaultLevelCell } from '@/components/helper';
|
||||
import { postNdmDeviceAlarmLogPage, type NdmDeviceAlarmLogResultVO, type NdmDeviceResultVO, type PageParams } from '@/apis';
|
||||
import { renderAlarmDateCell, renderAlarmTypeCell, renderFaultDescriptionCell, renderFaultLevelCell } from '@/components';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import { NCard, NDataTable, type DataTableColumns, type DataTableRowData, type DatePickerProps, type PaginationProps } from 'naive-ui';
|
||||
import { h } from 'vue';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmDeviceResultVO, NdmIcmpLogResultVO, NdmIcmpLogVO, PageParams, PageResult } from '@/apis/models';
|
||||
import { postIcmpLogPage } from '@/apis/requests';
|
||||
import { formatDuration } from '@/utils/format-duration';
|
||||
import { postIcmpLogPage, type NdmDeviceResultVO, type NdmIcmpLogResultVO, type NdmIcmpLogVO, type PageParams, type PageResult } from '@/apis';
|
||||
import { formatDuration } from '@/utils';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import dayjs from 'dayjs';
|
||||
import { NCard, NPagination, NScrollbar, NTimeline, NTimelineItem, type DatePickerProps, type PaginationProps, type TimelineItemProps } from 'naive-ui';
|
||||
|
||||
@@ -6,8 +6,8 @@ function getValueByFieldPath(record: Record<string, any>, fieldPath?: string) {
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { NdmDeviceResultVO, NdmSnmpLogResultVO, PageParams } from '@/apis/models';
|
||||
import { postSnmpLogPage } from '@/apis/requests';
|
||||
import type { NdmDeviceResultVO, NdmSnmpLogResultVO, PageParams } from '@/apis';
|
||||
import { postSnmpLogPage } from '@/apis';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import dayjs from 'dayjs';
|
||||
import { destr } from 'destr';
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
export { default as CameraHistoryDiagCard } from './camera-history-diag-card.vue';
|
||||
export { default as DecoderHistoryDiagCard } from './decoder-history-diag-card.vue';
|
||||
export { default as DeviceAlarmHistoryDiagCard } from './device-alarm-history-diag-card.vue';
|
||||
export { default as DeviceStatusHistoryDiagCard } from './device-status-history-diag-card.vue';
|
||||
export { default as DeviceUsageHistoryDiagCard } from './device-usage-history-diag-card.vue';
|
||||
export { default as KeyboardHistoryDiagCard } from './keyboard-history-diag-card.vue';
|
||||
export { default as NvrDiskHealthHistoryDiagCard } from './nvr-disk-health-history-diag-card.vue';
|
||||
export { default as NvrHistoryDiagCard } from './nvr-history-diag-card.vue';
|
||||
export { default as SecurityBoxHistoryDiagCard } from './security-box-history-diag-card.vue';
|
||||
export { default as SecurityBoxRuntimeHistoryDiagCard } from './security-box-runtime-history-diag-card.vue';
|
||||
export { default as ServerHistoryDiagCard } from './server-history-diag-card.vue';
|
||||
export { default as SwitchHistoryDiagCard } from './switch-history-diag-card.vue';
|
||||
export { default as SwitchPortHistoryDiagCard } from './switch-port-history-diag-card.vue';
|
||||
@@ -1,11 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmKeyboardResultVO } from '@/apis/models';
|
||||
import type { NdmKeyboardResultVO } from '@/apis';
|
||||
import { DeviceStatusHistoryDiagCard } from '@/components';
|
||||
import dayjs from 'dayjs';
|
||||
import { NButton, NCard, NDatePicker, NFlex, NGi, NGrid, NSelect, type DatePickerProps, type SelectOption } from 'naive-ui';
|
||||
import { computed, onMounted, reactive, ref, toRefs, useTemplateRef } from 'vue';
|
||||
|
||||
import DeviceStatusHistoryDiagCard from './device-status-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmKeyboard: NdmKeyboardResultVO;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmNvrDiagInfo } from '@/apis/domains';
|
||||
import type { NdmNvrResultVO, PageParams } from '@/apis/models';
|
||||
import { postSnmpLogPage } from '@/apis/requests';
|
||||
import { postSnmpLogPage, type NdmNvrDiagInfo, type NdmNvrResultVO, type PageParams } from '@/apis';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import dayjs from 'dayjs';
|
||||
import { destr } from 'destr';
|
||||
@@ -90,12 +88,12 @@ const { mutate: getDeviceSnmpLogList, isPending } = useMutation({
|
||||
const diagInfo = destr<NdmNvrDiagInfo>(diagInfoJsonString);
|
||||
if (!diagInfo) return {};
|
||||
if (typeof diagInfo !== 'object') return {};
|
||||
const healthDiskCount = diagInfo.info.diskHealth.filter((health) => health === 0).length;
|
||||
const totalDiskCount = diagInfo.info.diskHealth.length;
|
||||
const healthDiskCount = diagInfo.info?.diskHealth?.filter((health) => health === 0).length ?? 0;
|
||||
const totalDiskCount = diagInfo.info?.diskHealth?.length ?? 0;
|
||||
return {
|
||||
createdTime: record.createdTime,
|
||||
diskHealthRatio: `${healthDiskCount}/${totalDiskCount}`,
|
||||
diskHealth: diagInfo.info.diskHealth,
|
||||
diskHealth: diagInfo.info?.diskHealth ?? [],
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmNvrResultVO } from '@/apis/models';
|
||||
import { isNvrCluster } from '@/components/helper';
|
||||
import type { NdmNvrResultVO } from '@/apis';
|
||||
import { DeviceAlarmHistoryDiagCard, DeviceStatusHistoryDiagCard, DeviceUsageHistoryDiagCard, isNvrCluster, NvrDiskHealthHistoryDiagCard } from '@/components';
|
||||
import dayjs from 'dayjs';
|
||||
import { NButton, NCard, NDatePicker, NFlex, NGi, NGrid, NSelect, type DatePickerProps, type SelectOption } from 'naive-ui';
|
||||
import { computed, onMounted, reactive, ref, toRefs, useTemplateRef } from 'vue';
|
||||
|
||||
import DeviceStatusHistoryDiagCard from './device-status-history-diag-card.vue';
|
||||
import DeviceAlarmHistoryDiagCard from './device-alarm-history-diag-card.vue';
|
||||
import DeviceUsageHistoryDiagCard from './device-usage-history-diag-card.vue';
|
||||
import NvrDiskHealthHistoryDiagCard from './nvr-disk-health-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmNvr: NdmNvrResultVO;
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmSecurityBoxResultVO } from '@/apis/models';
|
||||
import type { NdmSecurityBoxResultVO } from '@/apis';
|
||||
import { DeviceAlarmHistoryDiagCard, DeviceStatusHistoryDiagCard, DeviceUsageHistoryDiagCard, SecurityBoxRuntimeHistoryDiagCard } from '@/components';
|
||||
import dayjs from 'dayjs';
|
||||
import { NButton, NCard, NDatePicker, NFlex, NGi, NGrid, NSelect, type DatePickerProps, type SelectOption } from 'naive-ui';
|
||||
import { computed, onMounted, reactive, ref, toRefs, useTemplateRef } from 'vue';
|
||||
|
||||
import DeviceStatusHistoryDiagCard from './device-status-history-diag-card.vue';
|
||||
import DeviceAlarmHistoryDiagCard from './device-alarm-history-diag-card.vue';
|
||||
import DeviceUsageHistoryDiagCard from './device-usage-history-diag-card.vue';
|
||||
import SecurityBoxRuntimeHistoryDiagCard from './security-box-runtime-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmSecurityBox: NdmSecurityBoxResultVO;
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmSecurityBoxCircuit, NdmSecurityBoxDiagInfo } from '@/apis/domains';
|
||||
import type { NdmSecurityBoxResultVO, PageParams } from '@/apis/models';
|
||||
import { postSnmpLogPage } from '@/apis/requests';
|
||||
import { postSnmpLogPage, type NdmSecurityBoxCircuit, type NdmSecurityBoxDiagInfo, type NdmSecurityBoxResultVO, type PageParams } from '@/apis';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import dayjs from 'dayjs';
|
||||
import destr from 'destr';
|
||||
@@ -63,7 +61,7 @@ const tableColumns: DataTableColumns<SecurityBoxRuntimeRowData> = [
|
||||
key: 'temperature',
|
||||
render(rowData) {
|
||||
const { info } = rowData.diagInfo;
|
||||
const boxInfo = info.at(0);
|
||||
const boxInfo = info?.at(0);
|
||||
if (!boxInfo) return '';
|
||||
return boxInfo.temperature;
|
||||
},
|
||||
@@ -73,7 +71,7 @@ const tableColumns: DataTableColumns<SecurityBoxRuntimeRowData> = [
|
||||
key: 'humidity',
|
||||
render(rowData) {
|
||||
const { info } = rowData.diagInfo;
|
||||
const boxInfo = info.at(0);
|
||||
const boxInfo = info?.at(0);
|
||||
if (!boxInfo) return '';
|
||||
return boxInfo.humidity;
|
||||
},
|
||||
@@ -83,9 +81,9 @@ const tableColumns: DataTableColumns<SecurityBoxRuntimeRowData> = [
|
||||
key: 'fanSpeeds',
|
||||
render(rowData) {
|
||||
const { info } = rowData.diagInfo;
|
||||
const boxInfo = info.at(0);
|
||||
const boxInfo = info?.at(0);
|
||||
if (!boxInfo) return '';
|
||||
return h('pre', {}, { default: () => boxInfo.fanSpeeds.join('\n') });
|
||||
return h('pre', {}, { default: () => boxInfo.fanSpeeds?.join('\n') ?? '' });
|
||||
},
|
||||
},
|
||||
// { title: '开关状态', key: 'switches' },
|
||||
@@ -94,7 +92,7 @@ const tableColumns: DataTableColumns<SecurityBoxRuntimeRowData> = [
|
||||
key: 'circuits',
|
||||
render(rowData) {
|
||||
const { info } = rowData.diagInfo;
|
||||
const boxInfo = info.at(0);
|
||||
const boxInfo = info?.at(0);
|
||||
if (!boxInfo) return '';
|
||||
return h(
|
||||
NButton,
|
||||
@@ -103,7 +101,7 @@ const tableColumns: DataTableColumns<SecurityBoxRuntimeRowData> = [
|
||||
type: 'info',
|
||||
size: 'small',
|
||||
onClick: () => {
|
||||
modalTableData.value = boxInfo.circuits.map((circuit, index) => ({ ...circuit, number: index + 1 }));
|
||||
modalTableData.value = boxInfo.circuits?.map((circuit, index) => ({ ...circuit, number: index + 1 })) ?? [];
|
||||
modalShow.value = true;
|
||||
},
|
||||
},
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmServerResultVO } from '@/apis/models';
|
||||
import type { NdmServerResultVO } from '@/apis';
|
||||
import { DeviceAlarmHistoryDiagCard, DeviceStatusHistoryDiagCard, DeviceUsageHistoryDiagCard } from '@/components';
|
||||
import dayjs from 'dayjs';
|
||||
import { NButton, NCard, NDatePicker, NFlex, NGi, NGrid, NSelect, type DatePickerProps, type SelectOption } from 'naive-ui';
|
||||
import { computed, onMounted, reactive, ref, toRefs, useTemplateRef } from 'vue';
|
||||
|
||||
import DeviceStatusHistoryDiagCard from './device-status-history-diag-card.vue';
|
||||
import DeviceAlarmHistoryDiagCard from './device-alarm-history-diag-card.vue';
|
||||
import DeviceUsageHistoryDiagCard from './device-usage-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmServer: NdmServerResultVO;
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmSwitchResultVO } from '@/apis/models';
|
||||
import type { NdmSwitchResultVO } from '@/apis';
|
||||
import { DeviceAlarmHistoryDiagCard, DeviceStatusHistoryDiagCard, DeviceUsageHistoryDiagCard, SwitchPortHistoryDiagCard } from '@/components';
|
||||
import dayjs from 'dayjs';
|
||||
import { NButton, NCard, NDatePicker, NFlex, NGi, NGrid, NSelect, type DatePickerProps, type SelectOption } from 'naive-ui';
|
||||
import { computed, onMounted, reactive, ref, toRefs, useTemplateRef } from 'vue';
|
||||
|
||||
import DeviceStatusHistoryDiagCard from './device-status-history-diag-card.vue';
|
||||
import DeviceAlarmHistoryDiagCard from './device-alarm-history-diag-card.vue';
|
||||
import DeviceUsageHistoryDiagCard from './device-usage-history-diag-card.vue';
|
||||
import SwitchPortHistoryDiagCard from './switch-port-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmSwitch: NdmSwitchResultVO;
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmSwitchDiagInfo, NdmSwitchPortInfo } from '@/apis/domains';
|
||||
import type { NdmSwitchResultVO, PageParams } from '@/apis/models';
|
||||
import { postSnmpLogPage } from '@/apis/requests';
|
||||
import { getPortStatusVal, transformPortSpeed } from '@/components/helper';
|
||||
import { postSnmpLogPage, type NdmSwitchDiagInfo, type NdmSwitchPortInfo, type NdmSwitchResultVO, type PageParams } from '@/apis';
|
||||
import { getPortStatusVal, transformPortSpeed } from '@/components';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import dayjs from 'dayjs';
|
||||
import destr from 'destr';
|
||||
@@ -66,8 +64,8 @@ const tableColumns: DataTableColumns<SwitchPortRowData> = [
|
||||
render(rowData) {
|
||||
const { diagInfo } = rowData;
|
||||
const { info } = diagInfo;
|
||||
const { overFlowPorts } = info;
|
||||
return h('pre', {}, { default: () => overFlowPorts.join('\n') });
|
||||
const { overFlowPorts } = info ?? {};
|
||||
return h('pre', {}, { default: () => overFlowPorts?.join('\n') ?? '' });
|
||||
},
|
||||
},
|
||||
{
|
||||
@@ -84,7 +82,7 @@ const tableColumns: DataTableColumns<SwitchPortRowData> = [
|
||||
if (!diagInfo) return;
|
||||
modalShow.value = true;
|
||||
console.log('查看', diagInfo);
|
||||
modalTableData.value = diagInfo.info.portInfoList;
|
||||
modalTableData.value = diagInfo.info?.portInfoList ?? [];
|
||||
},
|
||||
},
|
||||
{ default: () => '查看' },
|
||||
|
||||
10
src/components/device-page/device-card/index.ts
Normal file
10
src/components/device-page/device-card/index.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export { default as CameraCard } from './camera-card.vue';
|
||||
export { default as DecoderCard } from './decoder-card.vue';
|
||||
export { default as KeyboardCard } from './keyboard-card.vue';
|
||||
export { default as NvrCard } from './nvr-card.vue';
|
||||
export { default as SecurityBoxCard } from './security-box-card.vue';
|
||||
export { default as ServerCard } from './server-card.vue';
|
||||
export { default as SwitchCard } from './switch-card.vue';
|
||||
|
||||
export * from './current-diag-card';
|
||||
export * from './history-diag-card';
|
||||
@@ -1,12 +1,10 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmKeyboardResultVO } from '@/apis/models';
|
||||
import { useDebugModeStore } from '@/stores/debug-mode';
|
||||
import type { NdmKeyboardResultVO } from '@/apis';
|
||||
import { DeviceHeaderCard, KeyboardHistoryDiagCard } from '@/components';
|
||||
import { useDebugModeStore } from '@/stores';
|
||||
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
||||
import { ref, toRefs } from 'vue';
|
||||
|
||||
import DeviceHeaderCard from './current-diag-card/device-header-card.vue';
|
||||
import KeyboardHistoryDiagCard from './history-diag-card/keyboard-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmKeyboard: NdmKeyboardResultVO;
|
||||
|
||||
@@ -1,19 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmNvrDiagInfo } from '@/apis/domains';
|
||||
import type { NdmNvrResultVO } from '@/apis/models';
|
||||
import { isNvrCluster } from '@/components/helper';
|
||||
import { useDebugModeStore } from '@/stores/debug-mode';
|
||||
import type { NdmNvrDiagInfo, NdmNvrResultVO } from '@/apis';
|
||||
import { DeviceCommonCard, DeviceHardwareCard, DeviceHeaderCard, isNvrCluster, NvrDiskCard, NvrHistoryDiagCard, NvrRecordDiagCard } from '@/components';
|
||||
import { useDebugModeStore } from '@/stores';
|
||||
import { destr } from 'destr';
|
||||
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
||||
import { computed, ref, toRefs } from 'vue';
|
||||
|
||||
import DeviceHeaderCard from './current-diag-card/device-header-card.vue';
|
||||
import DeviceCommonCard from './current-diag-card/device-common-card.vue';
|
||||
import DeviceHardwareCard from './current-diag-card/device-hardware-card.vue';
|
||||
import NvrDiskCard from './current-diag-card/nvr-disk-card.vue';
|
||||
import NvrRecordDiagCard from './current-diag-card/nvr-record-diag-card.vue';
|
||||
import NvrHistoryDiagCard from './history-diag-card/nvr-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmNvr: NdmNvrResultVO;
|
||||
|
||||
@@ -1,18 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmSecurityBoxDiagInfo } from '@/apis/domains';
|
||||
import type { NdmSecurityBoxResultVO } from '@/apis/models';
|
||||
import { useDebugModeStore } from '@/stores/debug-mode';
|
||||
import type { NdmSecurityBoxDiagInfo, NdmSecurityBoxResultVO } from '@/apis';
|
||||
import { DeviceCommonCard, DeviceHardwareCard, DeviceHeaderCard, SecurityBoxCircuitCard, SecurityBoxHistoryDiagCard, SecurityBoxInfoCard } from '@/components';
|
||||
import { useDebugModeStore } from '@/stores';
|
||||
import { destr } from 'destr';
|
||||
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
||||
import { computed, ref, toRefs } from 'vue';
|
||||
|
||||
import DeviceHeaderCard from './current-diag-card/device-header-card.vue';
|
||||
import DeviceCommonCard from './current-diag-card/device-common-card.vue';
|
||||
import DeviceHardwareCard from './current-diag-card/device-hardware-card.vue';
|
||||
import SecurityBoxInfoCard from './current-diag-card/security-box-info-card.vue';
|
||||
import SecurityBoxCircuitCard from './current-diag-card/security-box-circuit-card.vue';
|
||||
import SecurityBoxHistoryDiagCard from './history-diag-card/security-box-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmSecurityBox: NdmSecurityBoxResultVO;
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmServerDiagInfo } from '@/apis/domains';
|
||||
import type { NdmServerResultVO } from '@/apis/models';
|
||||
import { useDebugModeStore } from '@/stores/debug-mode';
|
||||
import type { NdmServerDiagInfo, NdmServerResultVO } from '@/apis';
|
||||
import { DeviceHardwareCard, DeviceHeaderCard, ServerHistoryDiagCard } from '@/components';
|
||||
import { useDebugModeStore } from '@/stores';
|
||||
import { destr } from 'destr';
|
||||
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
||||
import { computed, ref, toRefs } from 'vue';
|
||||
|
||||
import DeviceHeaderCard from './current-diag-card/device-header-card.vue';
|
||||
import DeviceHardwareCard from './current-diag-card/device-hardware-card.vue';
|
||||
import ServerHistoryDiagCard from './history-diag-card/server-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmServer: NdmServerResultVO;
|
||||
|
||||
@@ -1,16 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import type { NdmSwitchDiagInfo } from '@/apis/domains';
|
||||
import type { NdmSwitchResultVO } from '@/apis/models';
|
||||
import { useDebugModeStore } from '@/stores/debug-mode';
|
||||
import type { NdmSwitchDiagInfo, NdmSwitchResultVO } from '@/apis';
|
||||
import { DeviceHardwareCard, DeviceHeaderCard, SwitchHistoryDiagCard, SwitchPortCard } from '@/components';
|
||||
import { useDebugModeStore } from '@/stores';
|
||||
import { destr } from 'destr';
|
||||
import { NCard, NFlex, NTabPane, NTabs } from 'naive-ui';
|
||||
import { computed, ref, toRefs } from 'vue';
|
||||
|
||||
import DeviceHeaderCard from './current-diag-card/device-header-card.vue';
|
||||
import DeviceHardwareCard from './current-diag-card/device-hardware-card.vue';
|
||||
import SwitchPortCard from './current-diag-card/switch-port-card.vue';
|
||||
import SwitchHistoryDiagCard from './history-diag-card/switch-history-diag-card.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
stationCode: string;
|
||||
ndmSwitch: NdmSwitchResultVO;
|
||||
|
||||
@@ -9,11 +9,9 @@ const deviceTabPanes = Object.keys(DeviceType).map((key) => {
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Station } from '@/apis/domains';
|
||||
import type { NdmDeviceResultVO, NdmNvrResultVO } from '@/apis/models';
|
||||
import { isNvrCluster } from '@/components/helper';
|
||||
import type { LineDevices } from '@/composables/query';
|
||||
import { DeviceType, DeviceTypeName, tryGetDeviceTypeVal, type DeviceTypeKey, type DeviceTypeVal } from '@/enums/device-type';
|
||||
import type { LineDevices, NdmDeviceResultVO, NdmNvrResultVO, Station } from '@/apis';
|
||||
import { isNvrCluster } from '@/components';
|
||||
import { DeviceType, DeviceTypeName, tryGetDeviceTypeVal, type DeviceTypeKey, type DeviceTypeVal } from '@/enums';
|
||||
import { destr } from 'destr';
|
||||
import {
|
||||
NButton,
|
||||
|
||||
4
src/components/device-page/index.ts
Normal file
4
src/components/device-page/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from './device-card';
|
||||
|
||||
export { default as DeviceRenderer } from './device-renderer.vue';
|
||||
export { default as DeviceTree } from './device-tree.vue';
|
||||
2
src/components/global/index.ts
Normal file
2
src/components/global/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export { default as SettingsDrawer } from './settings-drawer.vue';
|
||||
export { default as ThemeSwitch } from './theme-switch.vue';
|
||||
@@ -1,20 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
import type { VersionInfo } from '@/apis';
|
||||
import { ThemeSwitch } from '@/components';
|
||||
import { STATION_LIST_QUERY_KEY } from '@/constants';
|
||||
import { useDebugModeStore, useLayoutStore, useQueryControlStore } from '@/stores';
|
||||
import { getAppEnvConfig } from '@/utils';
|
||||
import { useQueryClient } from '@tanstack/vue-query';
|
||||
import { useEventListener } from '@vueuse/core';
|
||||
import axios from 'axios';
|
||||
import { NButton, NDivider, NDrawer, NDrawerContent, NFlex, NFormItem, NInput, NInputNumber, NModal, NRadio, NRadioGroup, NText } from 'naive-ui';
|
||||
import { useLayoutStore } from '@/stores/layout';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { onMounted, ref, watch } from 'vue';
|
||||
import axios from 'axios';
|
||||
import type { VersionInfo } from '@/apis/domains/version-info';
|
||||
import { useQueryControlStore } from '@/stores/query-control';
|
||||
import { useQueryClient } from '@tanstack/vue-query';
|
||||
import { STATION_LIST_QUERY_KEY } from '@/constants';
|
||||
import { useDebugModeStore } from '@/stores/debug-mode';
|
||||
import { getAppEnvConfig } from '@/utils/env';
|
||||
import { useEventListener } from '@vueuse/core';
|
||||
import { useRoute } from 'vue-router';
|
||||
|
||||
import ThemeSwitch from './theme-switch.vue';
|
||||
|
||||
const route = useRoute();
|
||||
|
||||
const show = defineModel<boolean>('show');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { useThemeStore } from '@/stores/theme';
|
||||
import { useThemeStore } from '@/stores';
|
||||
import { MoonOutline, SunnyOutline } from '@vicons/ionicons5';
|
||||
import { NIcon, NSwitch } from 'naive-ui';
|
||||
import { storeToRefs } from 'pinia';
|
||||
|
||||
5
src/components/index.ts
Normal file
5
src/components/index.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export * from './dashboard-page';
|
||||
export * from './device-page';
|
||||
export * from './global';
|
||||
export * from './helper';
|
||||
export * from './station-page';
|
||||
@@ -1,18 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
import type { Station } from '@/apis/domains';
|
||||
import type { NdmDeviceAlarmLogPageQuery, NdmDeviceAlarmLogResultVO, NdmDeviceAlarmLogVO, PageQueryExtra } from '@/apis/models';
|
||||
import { ndmDeviceAlarmLogDefaultExportByTemplate, postNdmDeviceAlarmLogPage } from '@/apis/requests';
|
||||
import { renderAlarmDateCell, renderAlarmTypeCell, renderDeviceTypeCell, renderFaultLevelCell } from '@/components/helper';
|
||||
import type { StationAlarmCounts } from '@/composables/query';
|
||||
import { FaultLevel } from '@/enums/fault-level';
|
||||
import { AlarmType } from '@/enums/alarm-type';
|
||||
import { DeviceType, DeviceTypeCode, DeviceTypeName, type DeviceTypeVal } from '@/enums/device-type';
|
||||
import { useQueryControlStore } from '@/stores/query-control';
|
||||
import { downloadByData } from '@/utils/download';
|
||||
import {
|
||||
ndmDeviceAlarmLogDefaultExportByTemplate,
|
||||
postNdmDeviceAlarmLogPage,
|
||||
type NdmDeviceAlarmLogPageQuery,
|
||||
type NdmDeviceAlarmLogResultVO,
|
||||
type NdmDeviceAlarmLogVO,
|
||||
type PageQueryExtra,
|
||||
type Station,
|
||||
type StationAlarmCounts,
|
||||
} from '@/apis';
|
||||
import { AlarmType, DeviceType, DeviceTypeCode, DeviceTypeName, FaultLevel, type DeviceTypeVal } from '@/enums';
|
||||
import { useQueryControlStore } from '@/stores';
|
||||
import { downloadByData } from '@/utils';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import dayjs from 'dayjs';
|
||||
import { NButton, NCol, NDataTable, NModal, NRow, NSpace, NStatistic, NTag, type DataTableColumns, type DataTableProps, type DataTableRowData, type PaginationProps } from 'naive-ui';
|
||||
import { computed, h, reactive, ref, toRefs, watch } from 'vue';
|
||||
import { renderAlarmDateCell, renderDeviceTypeCell, renderAlarmTypeCell, renderFaultLevelCell } from '../helper';
|
||||
|
||||
interface Props {
|
||||
station?: Station;
|
||||
@@ -68,9 +68,8 @@ const getItemSuffix = (name: string) => {
|
||||
</script>
|
||||
|
||||
<script setup lang="ts">
|
||||
import type { Station } from '@/apis/domains';
|
||||
import { postDefParameterPage, putDefParameter } from '@/apis/requests';
|
||||
import { useQueryControlStore } from '@/stores/query-control';
|
||||
import { postDefParameterPage, putDefParameter, type Station } from '@/apis';
|
||||
import { useQueryControlStore } from '@/stores';
|
||||
import { useMutation } from '@tanstack/vue-query';
|
||||
import { NForm, NFormItemGi, NGrid, NInputNumber, NModal, NTabPane, NTabs, NTimePicker, NSpin, NFlex } from 'naive-ui';
|
||||
import { ref, toRefs, watch } from 'vue';
|
||||
4
src/components/station-page/index.ts
Normal file
4
src/components/station-page/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
export { default as DeviceAlarmDetailModal } from './device-alarm-detail-modal.vue';
|
||||
export { default as DeviceParamsConfigModal } from './device-params-config-modal.vue';
|
||||
export { default as OfflineDeviceDetailModal } from './offline-device-detail-modal.vue';
|
||||
export { default as StationCard } from './station-card.vue';
|
||||
@@ -1,11 +1,8 @@
|
||||
<script setup lang="ts">
|
||||
import type { Station } from '@/apis/domains';
|
||||
import type { NdmDeviceVO } from '@/apis/models';
|
||||
import type { StationDevices } from '@/composables/query';
|
||||
import { DeviceType, DeviceTypeName, tryGetDeviceTypeVal } from '@/enums/device-type';
|
||||
import { useQueryControlStore } from '@/stores/query-control';
|
||||
import { NButton, NCol, NInput, NModal, NRow, NStatistic, NTree } from 'naive-ui';
|
||||
import type { TreeOption, TreeOverrideNodeClickBehavior, TreeProps } from 'naive-ui';
|
||||
import type { NdmDeviceVO, Station, StationDevices } from '@/apis';
|
||||
import { DeviceType, DeviceTypeName, tryGetDeviceTypeVal } from '@/enums';
|
||||
import { useQueryControlStore } from '@/stores';
|
||||
import { NButton, NCol, NInput, NModal, NRow, NStatistic, NTree, type TreeOption, type TreeOverrideNodeClickBehavior, type TreeProps } from 'naive-ui';
|
||||
import { computed, h, ref, toRefs, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import type { Station } from '@/apis/domains';
|
||||
import { DeviceType } from '@/enums/device-type';
|
||||
import { type StationAlarmCounts, type StationDevices } from '@/composables/query';
|
||||
import type { Station, StationAlarmCounts, StationDevices } from '@/apis';
|
||||
import { DeviceType } from '@/enums';
|
||||
import { MoreOutlined, EllipsisOutlined } from '@vicons/antd';
|
||||
import axios from 'axios';
|
||||
import { NCard, NTag, NButton, NIcon, useThemeVars, NFlex, NText, NTooltip, NDropdown, type DropdownOption } from 'naive-ui';
|
||||
@@ -24,7 +23,7 @@ const { station, stationDevices, stationAlarmCounts } = toRefs(props);
|
||||
const onlineDeviceCount = computed(() => {
|
||||
let count = 0;
|
||||
Object.values(DeviceType).forEach((deviceType) => {
|
||||
const onlineDeviceList = stationDevices.value?.[deviceType].filter((device) => device.deviceStatus === '10') ?? [];
|
||||
const onlineDeviceList = stationDevices.value?.[deviceType]?.filter((device) => device.deviceStatus === '10') ?? [];
|
||||
count += onlineDeviceList.length;
|
||||
});
|
||||
return count;
|
||||
@@ -32,7 +31,7 @@ const onlineDeviceCount = computed(() => {
|
||||
const offlineDeviceCount = computed(() => {
|
||||
let count = 0;
|
||||
Object.values(DeviceType).forEach((deviceType) => {
|
||||
const offlineDeviceList = stationDevices.value?.[deviceType].filter((device) => device.deviceStatus === '20') ?? [];
|
||||
const offlineDeviceList = stationDevices.value?.[deviceType]?.filter((device) => device.deviceStatus === '20') ?? [];
|
||||
count += offlineDeviceList.length;
|
||||
});
|
||||
return count;
|
||||
@@ -40,7 +39,7 @@ const offlineDeviceCount = computed(() => {
|
||||
const deviceCount = computed(() => {
|
||||
let count = 0;
|
||||
Object.values(DeviceType).forEach((deviceType) => {
|
||||
count += stationDevices.value?.[deviceType].length ?? 0;
|
||||
count += stationDevices.value?.[deviceType]?.length ?? 0;
|
||||
});
|
||||
return count;
|
||||
});
|
||||
@@ -1,8 +1,7 @@
|
||||
import type { NdmDeviceResultVO } from '@/apis/models';
|
||||
import { DeviceType, tryGetDeviceTypeVal, type DeviceTypeVal } from '@/enums/device-type';
|
||||
import type { LineDevices, NdmDeviceResultVO } from '@/apis';
|
||||
import { DeviceType, tryGetDeviceTypeVal, type DeviceTypeVal } from '@/enums';
|
||||
import { ref, watch } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import type { LineDevices } from '../query';
|
||||
|
||||
export function useDeviceSelection() {
|
||||
const route = useRoute();
|
||||
|
||||
3
src/composables/index.ts
Normal file
3
src/composables/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './device';
|
||||
export * from './query';
|
||||
export * from './stomp';
|
||||
@@ -1,34 +0,0 @@
|
||||
import type { NdmDeviceAlarmLogResultVO } from '@/apis/models';
|
||||
import type { DeviceType } from '@/enums/device-type';
|
||||
|
||||
export interface StationAlarms {
|
||||
[DeviceType.Camera]: NdmDeviceAlarmLogResultVO[];
|
||||
[DeviceType.Decoder]: NdmDeviceAlarmLogResultVO[];
|
||||
[DeviceType.Keyboard]: NdmDeviceAlarmLogResultVO[];
|
||||
[DeviceType.MediaServer]: NdmDeviceAlarmLogResultVO[];
|
||||
[DeviceType.Nvr]: NdmDeviceAlarmLogResultVO[];
|
||||
[DeviceType.SecurityBox]: NdmDeviceAlarmLogResultVO[];
|
||||
[DeviceType.Switch]: NdmDeviceAlarmLogResultVO[];
|
||||
[DeviceType.VideoServer]: NdmDeviceAlarmLogResultVO[];
|
||||
unclassified: NdmDeviceAlarmLogResultVO[];
|
||||
}
|
||||
|
||||
export interface LineAlarms {
|
||||
[stationCode: string]: StationAlarms;
|
||||
}
|
||||
|
||||
export interface StationAlarmCounts {
|
||||
[DeviceType.Camera]: number;
|
||||
[DeviceType.Decoder]: number;
|
||||
[DeviceType.Keyboard]: number;
|
||||
[DeviceType.MediaServer]: number;
|
||||
[DeviceType.Nvr]: number;
|
||||
[DeviceType.SecurityBox]: number;
|
||||
[DeviceType.Switch]: number;
|
||||
[DeviceType.VideoServer]: number;
|
||||
unclassified: number;
|
||||
}
|
||||
|
||||
export interface LineAlarmCounts {
|
||||
[stationCode: string]: StationAlarmCounts;
|
||||
}
|
||||
@@ -1,3 +1 @@
|
||||
export * from './domains';
|
||||
|
||||
export * from './use-line-alarms-query';
|
||||
|
||||
@@ -1,16 +1,12 @@
|
||||
import type { StationAlarmCounts } from './domains';
|
||||
import type { Station } from '@/apis/domains';
|
||||
import { postNdmDeviceAlarmLogPage } from '@/apis/requests';
|
||||
import { postNdmDeviceAlarmLogPage, type Station, type StationAlarmCounts } from '@/apis';
|
||||
import { LINE_ALARMS_QUERY_KEY } from '@/constants';
|
||||
import { DeviceType, tryGetDeviceTypeVal } from '@/enums/device-type';
|
||||
import { useLineAlarmsStore } from '@/stores/line-alarms';
|
||||
import { useQueryControlStore } from '@/stores/query-control';
|
||||
import { useStationStore } from '@/stores/station';
|
||||
import { DeviceType, tryGetDeviceTypeVal } from '@/enums';
|
||||
import { useLineAlarmsStore, useQueryControlStore, useStationStore } from '@/stores';
|
||||
import { runTask } from '@/utils';
|
||||
import { isCancelledError, useMutation, useQuery } from '@tanstack/vue-query';
|
||||
import { runTask } from '@/utils/run-task';
|
||||
import dayjs from 'dayjs';
|
||||
import { storeToRefs } from 'pinia';
|
||||
import { computed } from 'vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
const createEmptyStationAlarmCounts = () => {
|
||||
return {
|
||||
|
||||
@@ -1,3 +1 @@
|
||||
export * from './domains';
|
||||
|
||||
export * from './use-line-devices-query';
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user