/*
 * @Author: your name
 * @Date: 2021-08-03 14:38:54
 * @LastEditTime: 2021-09-28 09:51:43
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /CostAccountManaSys/src/pages/platformMana/menuManage/service.js
 */



import { request } from 'umi';

// 获角色列表
export async function getMenuList(params, options) {
    return request('/api/pfm/menu/list', {
      method: 'GET',
      params: {...params},
      ...(options || {}),
    });
}

// 新增菜单
export async function addList(body, options) {
    return request('/api/pfm/menu/save', {
      method: 'POST',
      data: {...body},
      ...(options || {}),
    });
}

// 编辑角色
export async function editList(body, options) {
  return request('/api/pfm/menu/edit', {
    method: 'POST',
    data: {...body},
    ...(options || {}),
  });
}

// 删除角色
export async function delList(params, options) {
  const {ids} = params;
  return request(`/api/pfm/menu/delete`, {
    data:ids,
    method: 'POST',
    ...(options || {}),
  });
}

// //根据角色查询已绑用户
// export async function getUsersByRoleId(params, options) {
//   const {roleId} = params;
//   return request(`/api/costAccount/role/editUserRole`, {
//     data:{roleId, userIds},
//     method: 'POST',
//     ...(options || {}),
//   });
// }

// 角色绑定用户
export async function roleBindUser(params, options) {
  const {roleId, userIds} = params;
  return request(`/api/pfm/role/editUserRole`, {
    data:{roleId, userIds},
    method: 'POST',
    ...(options || {}),
  });
}
