import request from '@/utils/request'

// 获取所有的Role
export function getAll(data) {
  return request({
    url: '/admin/rbac/role/list',
    method: 'post',
    data
  })
}

export function getRoleByUserId(data) {
  return request({
    url: '/admin/rbac/role/listByUserId',
    method: 'post',
    data
  })
}

export function add(data) {
  return request({
    url: '/admin/rbac/role/save',
    method: 'post',
    data
  })
}

export function get(params) {
  return request({
    url: '/admin/rbac/role/get',
    method: 'post',
    params
  })
}

export function getLevel() {
  return request({
    url: 'roles/level',
    method: 'get'
  })
}

export function del(data) {
  return request({
    url: '/admin/rbac/role/delete',
    method: 'post',
    data
  })
}

export function edit(data) {
  return request({
    url: '/admin/rbac/role/update',
    method: 'post',
    data
  })
}

export function editPermission(data) {
  return request({
    url: '/admin/rbac/role/savePermissions',
    method: 'post',
    data
  })
}

export function editMenu(data) {
  return request({
    url: '/admin/rbac/role/saveMenus',
    method: 'post',
    data
  })
}
