40 lines
867 B
TypeScript
40 lines
867 B
TypeScript
|
import { defHttp } from '/@/utils/http/axios';
|
||
|
|
||
|
enum Api {
|
||
|
list = '/iot/regionInfo/list',
|
||
|
sync = '/iot/regionInfo/sync',
|
||
|
add = '/iot/regionInfo/add',
|
||
|
edit = '/iot/regionInfo/edit',
|
||
|
delete = '/iot/regionInfo/delete',
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* 列表接口
|
||
|
* @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();
|
||
|
});
|
||
|
};
|