import { defHttp } from '/@/utils/http/axios';
import { setParams } from '/@/utils/index';
enum Api {
  sysOrgAdd = '/sys/org/add',
  sysOrgDetailOrgId = '/sys/org/detail',
  sysOrgEdit = '/sys/org/edit',
  sysOrgExport = '/sys/org/export',
  sysOrgRemove = '/sys/org/deleteByIds',
  sysOrgQueryPage = '/sys/org/query/page',
  sysOrgQueryTree = '/sys/org/tree',
}

/**
 * @description: 查询组织机构分页列表,权限 - sys:org:add
 * @method: POST
 */
export const sysOrgQueryPage = (params?: object) => {
  return defHttp.post({ url: Api.sysOrgQueryPage, params: setParams(params) });
};

/**
 * @description: 新增组织机构,权限 - sys:org:add
 * @method: POST
 */
export const sysOrgAdd = (params?: object) => {
  return defHttp.post({ url: Api.sysOrgAdd, params: params });
};
/**
 * @description: 获取组织机构详细信息,权限 - sys:org:query
 * @method: GET
 */
export const sysOrgDetailOrgId = (orgId?: string | number, params?: object) => {
  return defHttp.get({ url: Api.sysOrgDetailOrgId + '/' + orgId, params: params });
};
/**
 * @description: 通过主键id修改组织机构,权限 - sys:org:edit
 * @method: POST
 */
export const sysOrgEdit = (params?: object) => {
  return defHttp.post({ url: Api.sysOrgEdit, params: params });
};
/**
 * @description: 导出组织机构
 * @method: POST
 */
export const sysOrgExport = (params?: object) => {
  return defHttp.post({ url: Api.sysOrgExport, params: params });
};
/**
 * @description: 组织树
 * @method: POST
 */
export const sysOrgQueryTree = (params?: object) => {
  return defHttp.post({ url: Api.sysOrgQueryTree, params: params });
};
/**
 * @description: 删除组织机构,权限 - sys:org:remove
 * @method: POST
 */

export const sysOrgRemove = (params?: Array<string | number>) => {
  return defHttp.post({ url: Api.sysOrgRemove, params: params });
};
