import { axios } from '@/utils/request'

// 获取列表数据
export const getPowerRoleList = params => {
  const url = `/mdrole/queryLike/${params.pageNo}/${params.pageSize}`
  delete params.pageNo
  delete params.pageSize
  return axios({
    url: url,
    data: params,
    method: 'POST'
  })
}

// 改变权限状态接口 flag 0：禁用 1：启用
export const updateEnableStatus = params => {
  return axios({
    url: `/mdrole/enable/${params.id}/${params.flag}`,
    data: {},
    method: 'get'
  })
}

// 删除用户接口
export const delectRolePower = params => {
  return axios({
    url: `/mdrole/delete/${params.id}`,
    data: {},
    method: 'get'
  })
}

// 新增/编辑保存接口
export const saveRolePower = params => {
  return axios({
    url: '/mdrole/save',
    data: params,
    method: 'POST'
  })
}

// 获取菜单树数据
export const getMenuList = params => {
  const url = `/mdrole/findAllMenu/${params.id}`
  return axios({
    url: url,
    method: 'get'
  })
}

// 保存权限分配
export const addMenuPower = params => {
  const url = `/mdrole/saveRoleMenu`
  return axios({
    url: url,
    data: params,
    method: 'post'
  })
}

// 获取角色列表接口
export const getRoleList = params => {
  return axios({
    url: '/mdrole/findAll',
    data: params,
    method: 'POST'
  })
}
