@jdlinker/linker
Version:
jdLinker 系统模块
59 lines (46 loc) • 2.13 kB
text/typescript
import { defHttp } from '@jdlinker/func';
import { BASE_API_PATH } from '@jdlinker/utils';
export const queryPage = (data: any) => {
const params = { ...data };
return defHttp.post({ url: `/plugin/driver/list`, data, params }, { isTransformResponse: false });
};
export const uploadFile = `${BASE_API_PATH}/plugin/driver/upload`;
export const add = (data: any) => defHttp.post({ url: '/plugin/driver', data });
export const update = (data: any) => defHttp.put({ url: '/plugin/driver', data });
export const removeFn = (id: string) => defHttp.delete({ url: `/plugin/driver/${id}` });
export const detail = (id: string) => defHttp.get({ url: `/plugin/driver/${id}` });
/**
* 获取插件支持的产品信息
* 用于在产品选择接入方式后,选择产品类型。
* 即将平台中当前产品与插件中指定的产品绑定,然后把插件的物模型保存到产品并且绑定产品ID映射关系
* @param id
*/
export const getProductsById = (id: string) => defHttp.get({ url: `/plugin/driver/${id}/products` });
/**
*
* @param type product:产品;device:设备
* @param pluginId 设备接入id
* @param internalId 产品或者设备id
* @param externalId 映射id
*/
export const savePluginData = (type: string, pluginId: string, internalId: string, externalId: string) => {
const data = {
externalId: externalId
};
return defHttp.put({
url: `/plugin/mapping/${type}/${pluginId}/${internalId}`,
data
});
};
export const getPluginData = (type: string, pluginId: string, internalId: string) =>
defHttp.get({ url: `/plugin/mapping/${type}/${pluginId}/${internalId}` });
export const getPublic = (id: string, path: string) => defHttp.get({ url: `/plugin/driver/${id}/${path}` });
export const getTypes = () =>
defHttp.get({ url: `/dictionary/internal-plugin-type/items` }, { isTransformResponse: false });
export const vailIdFn = (id: string) => {
const data = {
id: id
};
return defHttp.get({ url: `/plugin/driver/id/_validate`, data });
};
export const getProductByPluginId = (id: string) => defHttp.get({ url: `/plugin/driver/${id}/products` });