import request from '@/utils/request'

const roleApi = {
  add: '/sys/role/add',
  edit: '/sys/role/edit',
  del: '/sys/role/del',
  page: '/sys/role/pageList',
  list: '/sys/role/list',
  ownMenu: '/sys/role/ownMenu',
  grantMenu: '/sys/role/grantMenu'
}

export function roleAdd (params) {
  return request({
    url: roleApi.add,
    method: 'post',
    data: params
  })
}
export function roleEdit (params) {
  return request({
    url: roleApi.edit,
    method: 'post',
    data: params
  })
}
export function roleDel (params) {
  return request({
    url: roleApi.del,
    method: 'post',
    params: params
  })
}
export function rolePage (params) {
  return request({
    url: roleApi.page,
    method: 'get',
    params: params
  })
}
export function roleList (params) {
  return request({
    url: roleApi.list,
    method: 'get',
    params: params
  })
}
export function roleOwnMenu (params) {
  return request({
    url: roleApi.ownMenu,
    method: 'post',
    params: params
  })
}
export function roleGrantMenu (params) {
  return request({
    url: roleApi.grantMenu,
    method: 'post',
    data: params
  })
}
