83 lines
2.1 KiB
TypeScript
83 lines
2.1 KiB
TypeScript
import { defHttp } from '/@/utils/http/axios';
|
|
|
|
enum Api {
|
|
queryProjectTreeSync = '/iot/tplink/projectInfo/queryRegionTreeSync',
|
|
queryRegionTreeSync = '/iot/tplink/regionInfo/queryRegionTreeSync',
|
|
syncProject = '/iot/tplink/projectInfo/sync',
|
|
syncRegion = '/iot/tplink/regionInfo/sync',
|
|
syncRegionChildren = '/iot/tplink/regionInfo/syncChildren',
|
|
list = '/iot/tplink/regionInfo/list',
|
|
sync = '/iot/tplink/regionInfo/sync',
|
|
add = '/iot/tplink/regionInfo/add',
|
|
edit = '/iot/tplink/regionInfo/edit',
|
|
delete = '/iot/tplink/regionInfo/delete',
|
|
queryChildrenByParentId = '/sys/sysDepart/queryChildrenByParentId',
|
|
}
|
|
|
|
|
|
/**
|
|
* 获取项目树列表
|
|
* @param params
|
|
*/
|
|
export const queryProjectTreeSync = (params?) => defHttp.get({ url: Api.queryProjectTreeSync, params });
|
|
|
|
/**
|
|
* 获取分组树列表
|
|
* @param params
|
|
*/
|
|
export const queryRegionTreeSync = (params?) => defHttp.get({ url: Api.queryRegionTreeSync, params });
|
|
|
|
/**
|
|
* 同步项目
|
|
* @param params
|
|
*/
|
|
export const syncProject = (params?) => defHttp.get({ url: Api.syncProject, params });
|
|
|
|
/**
|
|
* 同步分组
|
|
* @param params
|
|
*/
|
|
export const syncRegionChildren = (params?) => defHttp.get({ url: Api.syncRegionChildren, params });
|
|
|
|
/**
|
|
* 同步子分组
|
|
* @param params
|
|
*/
|
|
export const syncRegion = (params?) => defHttp.get({ url: Api.syncRegion, params });
|
|
|
|
/**
|
|
* 通过parentId获取区域列表
|
|
* @param params
|
|
*/
|
|
export const queryArea = (params?) => defHttp.get({ url: Api.queryChildrenByParentId, params });
|
|
|
|
/**
|
|
* 列表接口
|
|
* @param params
|
|
*/
|
|
export const list = (params) => defHttp.get({ url: Api.list, params });
|
|
|
|
/**
|
|
* 项目信息同步
|
|
* @param params
|
|
*/
|
|
export const sync = (params) => defHttp.get({ url: Api.sync, params });
|
|
|
|
/**
|
|
* 保存或者更新分组
|
|
* @param params
|
|
*/
|
|
export const saveOrUpdateRegion = (params, isUpdate) => {
|
|
let url = isUpdate ? Api.edit : Api.add;
|
|
return defHttp.post({ url: url, params });
|
|
};
|
|
|
|
/**
|
|
* 删除分组
|
|
*/
|
|
export const deleteRegion = (params,handleSuccess) => {
|
|
return defHttp.post({ url: Api.delete, params }, { joinParamsToUrl: true }).then(() => {
|
|
handleSuccess();
|
|
});
|
|
};
|