feat: 设备树添加管理功能
- 新增设备导入、导出、删除功能及相关API - 封装设备管理逻辑,拆分设备选择与设备管理逻辑 - 添加右键菜单支持设备管理操作
This commit is contained in:
32
src/apis/request/biz/composed/delete-device.ts
Normal file
32
src/apis/request/biz/composed/delete-device.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import {
|
||||
deleteAlarmHostApi,
|
||||
deleteCameraApi,
|
||||
deleteDecoderApi,
|
||||
deleteKeyboardApi,
|
||||
deleteMediaServerApi,
|
||||
deleteNvrApi,
|
||||
deleteSecurityBoxApi,
|
||||
deleteSwitchApi,
|
||||
deleteVideoServerApi,
|
||||
type Station,
|
||||
} from '@/apis';
|
||||
import { DEVICE_TYPE_LITERALS, type DeviceType } from '@/enums';
|
||||
|
||||
export const deleteDeviceApi = async (deviceType: DeviceType, id: string, options?: { stationCode?: Station['code']; signal?: AbortSignal }) => {
|
||||
const apiRecord = {
|
||||
[DEVICE_TYPE_LITERALS.ndmAlarmHost]: deleteAlarmHostApi,
|
||||
[DEVICE_TYPE_LITERALS.ndmCamera]: deleteCameraApi,
|
||||
[DEVICE_TYPE_LITERALS.ndmDecoder]: deleteDecoderApi,
|
||||
[DEVICE_TYPE_LITERALS.ndmKeyboard]: deleteKeyboardApi,
|
||||
[DEVICE_TYPE_LITERALS.ndmMediaServer]: deleteMediaServerApi,
|
||||
[DEVICE_TYPE_LITERALS.ndmNvr]: deleteNvrApi,
|
||||
[DEVICE_TYPE_LITERALS.ndmSecurityBox]: deleteSecurityBoxApi,
|
||||
[DEVICE_TYPE_LITERALS.ndmSwitch]: deleteSwitchApi,
|
||||
[DEVICE_TYPE_LITERALS.ndmVideoServer]: deleteVideoServerApi,
|
||||
};
|
||||
|
||||
const deleteApi = apiRecord[deviceType];
|
||||
if (!deleteApi) throw new Error('接口不存在');
|
||||
|
||||
return deleteApi([id], options);
|
||||
};
|
||||
Reference in New Issue
Block a user