refactor: reorganize files

This commit is contained in:
yangsy
2025-11-20 10:58:19 +08:00
parent cbb51aa501
commit c5c363d32c
120 changed files with 606 additions and 690 deletions

View File

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

View File

@@ -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();

View 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);
},
});

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

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

View File

@@ -1,2 +1,3 @@
export * from './device';
export * from './station';
export * from './version';

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

View File

@@ -0,0 +1,17 @@
import type { NdmCameraResultVO, NdmDecoderResultVO, NdmKeyboardResultVO, NdmMediaServerResultVO, NdmNvrResultVO, NdmSecurityBoxResultVO, NdmSwitchResultVO, NdmVideoServerResultVO } from '@/apis';
import type { DeviceType } from '@/enums';
export interface StationDevices {
[DeviceType.Camera]: NdmCameraResultVO[];
[DeviceType.Decoder]: NdmDecoderResultVO[];
[DeviceType.Keyboard]: NdmKeyboardResultVO[];
[DeviceType.MediaServer]: NdmMediaServerResultVO[];
[DeviceType.Nvr]: NdmNvrResultVO[];
[DeviceType.SecurityBox]: NdmSecurityBoxResultVO[];
[DeviceType.Switch]: NdmSwitchResultVO[];
[DeviceType.VideoServer]: NdmVideoServerResultVO[];
}
export interface LineDevices {
[stationCode: string]: StationDevices;
}

View File

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

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

@@ -0,0 +1,4 @@
export * from './clients';
export * from './domains';
export * from './models';
export * from './requests';

View File

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

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

View File

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

View File

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

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

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

View File

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

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

View File

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

View File

@@ -1,4 +1,4 @@
import { ndmClient } from '@/apis/client';
import { ndmClient } from '@/apis';
export const resetMonitorSchedule = async (stationCode: string) => {
const prefix = stationCode ? `/${stationCode}` : '';

View File

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

View File

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

View File

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

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

View File

@@ -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}` : '';

View File

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

View File

@@ -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}` : '';

View File

@@ -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}` : '';

View File

@@ -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}` : '';

View File

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

View File

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

View File

@@ -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`, {

View File

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

View File

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

View File

@@ -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`, {

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

View File

@@ -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}` : '';

View File

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

View File

@@ -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}` : '';

View File

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

View File

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

View File

@@ -1,5 +1,3 @@
export * from './device';
export * from './station';
export * from './system';

View File

@@ -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}` : '';

View File

@@ -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>) => {