import { http } from '@/utils/http/axios';

/**
 * @description: 角色列表
 */
export function getRoleList(params?) {
  return http.request({
    url: '/role/page',
    method: 'GET',
    params,
  });
}
export function getRoleAllList(params?) {
  return http.request({
    url: '/role/list',
    method: 'GET',
    params,
  });
}
/**
 * @description: 根据ID获取详情
 */
export function getRoleDetail(roleId) {
  return http.request({
    url: '/role/detail/'+roleId,
    method: 'get',
  });
}
/**
 * @description: 添加角色
 */
export function roleAdd(data:any) {
  return http.request({
    url: '/role/add',
    method: 'POST',
    data,
  });
}
/**
 * @description: 更新角色
 */
export function roleUpdate(data:any) {
  return http.request({
    url: '/role/update',
    method: 'PUT',
    data
  });
}
/**
 * @description: 删除角色
 */
export function roleDelete(roleId) {
  return http.request({
    url: '/role/delete/'+roleId,
    method: 'DELETE',
  });
}
/**
 * @description: 批量删除角色
 */
export function roleBatchDelete(data) {
  return http.request({
    url: '/role/batchDelete',
    method: 'DELETE',
    data
  });
}
/**
 * @description: 获取角色菜单
 */
export function getRoleMenuList(roleId) {
  return http.request({
    url: '/role/menu/list/'+roleId,
    method: 'get',
  });
}
/**
 * @description: 保存角色菜单
 */
export function roleMenuSave(data:any) {
  return http.request({
    url: '/role/menu/save',
    method: 'POST',
    data,
  });
}