import { get, post, put, del } from '../../http'
/**
 * @description: 获取查询角色列表
 * @param {*} params
 * @return {*}
 */
export const getRolesList = async (params: any) => {
  return await get<any>('/sysRole/page', params)
}

/**
 * @description: 删除角色
 * @param {*} params
 * @return {*}
 */
export const delRolesById = async (id: string) => {
  return await del(`/sysRole/${id}`)
}

/**
 * @description: 更改角色状态
 * @param {*} params
 * @return {*}
 */
export const updateRoleStatus = async (data: any) => {
  return await post<any>('/sysRole/updateStatus', data)
}

/**
 * @description: 新增角色
 * @param {*} params
 * @return {*}
 */
export const addRole = async (data: any) => {
  return await post<any>('/sysRole', data)
}
/**
 * @description: 编辑角色
 * @param {*} params
 * @return {*}
 */
export const editorRole = async (data: any) => {
  return await put('/sysRole', data)
}

/**
 * @description: 获取角色拥有菜单权限
 * @param {*} params
 * @return {*}
 */
export const getOwnMenu = async (params: any) => {
  return await get<any>('/sysRole/ownMenu', params)
}

/**
 * @description: 获取角色拥有菜单权限
 * @param {*} params
 * @return {*}
 */
export const grantMenu = async (data: any) => {
  return await post<any>('/sysRole/grantMenu', data)
}
