35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
import {
|
|
exportAlarmHostApi,
|
|
exportCameraApi,
|
|
exportDecoderApi,
|
|
exportKeyboardApi,
|
|
exportMediaServerApi,
|
|
exportNvrApi,
|
|
exportSecurityBoxApi,
|
|
exportSwitchApi,
|
|
exportVideoServerApi,
|
|
type NdmDevicePageQuery,
|
|
type PageParams,
|
|
type Station,
|
|
} from '@/apis';
|
|
import { DEVICE_TYPE_LITERALS, type DeviceType } from '@/enums';
|
|
|
|
export const exportDeviceApi = async (deviceType: DeviceType, pageQuery: PageParams<NdmDevicePageQuery>, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
|
const apiRecord = {
|
|
[DEVICE_TYPE_LITERALS.ndmAlarmHost]: exportAlarmHostApi,
|
|
[DEVICE_TYPE_LITERALS.ndmCamera]: exportCameraApi,
|
|
[DEVICE_TYPE_LITERALS.ndmDecoder]: exportDecoderApi,
|
|
[DEVICE_TYPE_LITERALS.ndmKeyboard]: exportKeyboardApi,
|
|
[DEVICE_TYPE_LITERALS.ndmMediaServer]: exportMediaServerApi,
|
|
[DEVICE_TYPE_LITERALS.ndmNvr]: exportNvrApi,
|
|
[DEVICE_TYPE_LITERALS.ndmSecurityBox]: exportSecurityBoxApi,
|
|
[DEVICE_TYPE_LITERALS.ndmSwitch]: exportSwitchApi,
|
|
[DEVICE_TYPE_LITERALS.ndmVideoServer]: exportVideoServerApi,
|
|
};
|
|
|
|
const exportApi = apiRecord[deviceType];
|
|
if (!exportApi) throw new Error('接口不存在');
|
|
|
|
return exportApi(pageQuery, options);
|
|
};
|