feat: 新增设备导入导出API
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
ndmClient,
|
||||
userClient,
|
||||
type ImportMsg,
|
||||
type NdmCameraPageQuery,
|
||||
type NdmCameraResultVO,
|
||||
type NdmCameraSaveVO,
|
||||
@@ -71,6 +72,32 @@ export const deleteCameraApi = async (ids: string[], options?: { stationCode?: S
|
||||
return data;
|
||||
};
|
||||
|
||||
export const exportCameraApi = async (pageQuery: PageParams<NdmCameraPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const endpoint = `${prefix}/api/ndm/ndmCamera/defaultExportByTemplate`;
|
||||
const resp = await client.post<Blob>(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal });
|
||||
const [err, data] = resp;
|
||||
if (err) throw err;
|
||||
if (!data) throw new Error(`${data}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const importCameraApi = async (file: File, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const endpoint = `${prefix}/api/ndm/ndmCamera/importReturnMsg`;
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const resp = await client.post<ImportMsg>(endpoint, formData, { signal, upload: true });
|
||||
const [err, data] = resp;
|
||||
if (err) throw err;
|
||||
if (!data) throw new Error(`${data}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const getCameraSnapApi = async (deviceId: string, options?: { signal?: AbortSignal }) => {
|
||||
const { signal } = options ?? {};
|
||||
const endpoint = `/api/ndm/ndmCamera/getSnapByDeviceId`;
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
import { ndmClient, userClient, type NdmDecoderPageQuery, type NdmDecoderResultVO, type NdmDecoderSaveVO, type NdmDecoderUpdateVO, type PageParams, type PageResult, type Station } from '@/apis';
|
||||
import {
|
||||
ndmClient,
|
||||
userClient,
|
||||
type ImportMsg,
|
||||
type NdmDecoderPageQuery,
|
||||
type NdmDecoderResultVO,
|
||||
type NdmDecoderSaveVO,
|
||||
type NdmDecoderUpdateVO,
|
||||
type PageParams,
|
||||
type PageResult,
|
||||
type Station,
|
||||
} from '@/apis';
|
||||
|
||||
export const pageDecoderApi = async (pageQuery: PageParams<NdmDecoderPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
@@ -60,6 +71,32 @@ export const deleteDecoderApi = async (ids: string[], options?: { stationCode?:
|
||||
return data;
|
||||
};
|
||||
|
||||
export const exportDecoderApi = async (pageQuery: PageParams<NdmDecoderPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const endpoint = `${prefix}/api/ndm/ndmDecoder/defaultExportByTemplate`;
|
||||
const resp = await client.post<Blob>(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal });
|
||||
const [err, data] = resp;
|
||||
if (err) throw err;
|
||||
if (!data) throw new Error(`${data}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const importDecoderApi = async (file: File, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const endpoint = `${prefix}/api/ndm/ndmDecoder/importReturnMsg`;
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const resp = await client.post<ImportMsg>(endpoint, formData, { signal, upload: true });
|
||||
const [err, data] = resp;
|
||||
if (err) throw err;
|
||||
if (!data) throw new Error(`${data}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const probeDecoderApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
|
||||
@@ -1,4 +1,15 @@
|
||||
import { ndmClient, userClient, type NdmKeyboardPageQuery, type NdmKeyboardResultVO, type NdmKeyboardSaveVO, type NdmKeyboardUpdateVO, type PageParams, type PageResult, type Station } from '@/apis';
|
||||
import {
|
||||
ndmClient,
|
||||
userClient,
|
||||
type ImportMsg,
|
||||
type NdmKeyboardPageQuery,
|
||||
type NdmKeyboardResultVO,
|
||||
type NdmKeyboardSaveVO,
|
||||
type NdmKeyboardUpdateVO,
|
||||
type PageParams,
|
||||
type PageResult,
|
||||
type Station,
|
||||
} from '@/apis';
|
||||
|
||||
export const pageKeyboardApi = async (pageQuery: PageParams<NdmKeyboardPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
@@ -59,3 +70,29 @@ export const deleteKeyboardApi = async (ids: string[], options?: { stationCode?:
|
||||
if (!data) throw new Error(`${data}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const exportKeyboardApi = async (pageQuery: PageParams<NdmKeyboardPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const endpoint = `${prefix}/api/ndm/ndmKeyboard/defaultExportByTemplate`;
|
||||
const resp = await client.post<Blob>(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal });
|
||||
const [err, data] = resp;
|
||||
if (err) throw err;
|
||||
if (!data) throw new Error(`${data}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const importKeyboardApi = async (file: File, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const endpoint = `${prefix}/api/ndm/ndmKeyboard/importReturnMsg`;
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const resp = await client.post<ImportMsg>(endpoint, formData, { signal, upload: true });
|
||||
const [err, data] = resp;
|
||||
if (err) throw err;
|
||||
if (!data) throw new Error(`${data}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
ndmClient,
|
||||
userClient,
|
||||
type ImportMsg,
|
||||
type NdmMediaServerPageQuery,
|
||||
type NdmMediaServerResultVO,
|
||||
type NdmMediaServerSaveVO,
|
||||
@@ -70,6 +71,32 @@ export const deleteMediaServerApi = async (ids: string[], options?: { stationCod
|
||||
return data;
|
||||
};
|
||||
|
||||
export const exportMediaServerApi = async (pageQuery: PageParams<NdmMediaServerPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const endpoint = `${prefix}/api/ndm/ndmMediaServer/defaultExportByTemplate`;
|
||||
const resp = await client.post<Blob>(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal });
|
||||
const [err, data] = resp;
|
||||
if (err) throw err;
|
||||
if (!data) throw new Error(`${data}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const importMediaServerApi = async (file: File, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const endpoint = `${prefix}/api/ndm/ndmMediaServer/importReturnMsg`;
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const resp = await client.post<ImportMsg>(endpoint, formData, { signal, upload: true });
|
||||
const [err, data] = resp;
|
||||
if (err) throw err;
|
||||
if (!data) throw new Error(`${data}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const probeMediaServerApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
ndmClient,
|
||||
userClient,
|
||||
type ImportMsg,
|
||||
type NdmVideoServerPageQuery,
|
||||
type NdmVideoServerResultVO,
|
||||
type NdmVideoServerSaveVO,
|
||||
@@ -70,6 +71,32 @@ export const deleteVideoServerApi = async (ids: string[], options?: { stationCod
|
||||
return data;
|
||||
};
|
||||
|
||||
export const exportVideoServerApi = async (pageQuery: PageParams<NdmVideoServerPageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const endpoint = `${prefix}/api/ndm/ndmVideoServer/defaultExportByTemplate`;
|
||||
const resp = await client.post<Blob>(endpoint, pageQuery, { responseType: 'blob', retRaw: true, signal });
|
||||
const [err, data] = resp;
|
||||
if (err) throw err;
|
||||
if (!data) throw new Error(`${data}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const importVideoServerApi = async (file: File, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
const prefix = stationCode ? `/${stationCode}` : '';
|
||||
const endpoint = `${prefix}/api/ndm/ndmVideoServer/importReturnMsg`;
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
const resp = await client.post<ImportMsg>(endpoint, formData, { signal, upload: true });
|
||||
const [err, data] = resp;
|
||||
if (err) throw err;
|
||||
if (!data) throw new Error(`${data}`);
|
||||
return data;
|
||||
};
|
||||
|
||||
export const probeVideoServerApi = async (ids: string[], options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const { stationCode, signal } = options ?? {};
|
||||
const client = stationCode ? ndmClient : userClient;
|
||||
|
||||
Reference in New Issue
Block a user