import request from '@/assets/js/utils/request'
// 角色列表获取
export function fetchList(data) {
  return request({
    url: '/bidprocurement/common-user/user/role/getRoleList',
    method: 'post',
    data
  })
}
// 角色添加
export function addRole(data) {
  return request({
    url: '/bidprocurement/common-user/user/role/addRole',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'application/json;charset=UTF-8'
    }
  })
}
// 角色修改
export function updateRole(data) {
  return request({
    url: '/bidprocurement/common-user/user/role/updateRole',
    method: 'post',
    data
  })
}
// 角色删除
export function deleteRole(id) {
  return request({
    url: '/bidprocurement/common-user/user/role/deleteRole' + '?id=' + id,
    method: 'post'
  })
}
// ???
export function fetchUsableRoleList() {
  return request({
    url: '/bidprocurement/user/roleManagement/role/usable/list',
    method: 'post'
  })
}

//  获取当前角色菜单列表
export function getListMenu(id) {
  return request({
    url:
      '/bidprocurement/common-user/user/roleFunction/getFunction' + '?id=' + id,
    method: 'post'
  })
}

// 角色菜单授权
export function setMenu(data) {
  return request({
    url: '/bidprocurement/common-user/user/roleFunction/setFunction',
    method: 'post',
    data
  })
}
//  根据角色id查询该拥有该角色的用户
export function selectUserListByRoleId(data) {
  return request({
    url: '/bidprocurement/common-user/user/user/selectUserListByRoleId',
    method: 'post',
    data
  })
}
