import { defHttp } from '/@/utils/http/axios'; enum Api { queryProjectTreeSync = '/iot/projectInfo/queryRegionTreeSync', queryRegionTreeSync = '/iot/regionInfo/queryRegionTreeSync', syncProject = '/iot/projectInfo/sync', syncRegion = '/iot/regionInfo/sync', syncRegionChildren = '/iot/regionInfo/syncChildren', list = '/iot/regionInfo/list', sync = '/iot/regionInfo/sync', add = '/iot/regionInfo/add', edit = '/iot/regionInfo/edit', delete = '/iot/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(); }); };