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

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

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

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

// 获取菜单树数据
export const getMenuList = params => {
  const url = `mdrole/findAllMenuByRootId/${params.id}`
  return request({
    url: url,
	data: {rootIds: '10002'},
    method: 'post'
  })
}

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

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