import request from '@/utils/request';
// 平台三级按钮列表
export function getList(data) {
  let param = '?page=' + data.page + '&size=' + data.size;
  if (data.name !== '' && data.name !== undefined) {
    param += '&name=' + data.name;
  }
  return request({
    url: '/sysButton/list' + param,
    method: 'get',
    data,
  });
}

// 平台按钮树桩列表
export async function buttonTree(data) {
  return request({
    url: '/sysButton/buttonTree',
    method: 'get',
    data,
  });
}

// 添加平台三级按钮
export async function doAdd(data) {
  return request({
    url: '/sysButton/insert',
    method: 'post',
    data,
  });
}
// 修改平台三级按钮
export async function doEdit(data) {
  return request({
    url: '/sysButton/update',
    method: 'post',
    data,
  });
}
// 分配平台三级按钮
export async function assignButton(data) {
  return request({
    url: '/sysRole/assignButton',
    method: 'post',
    data,
  });
}
// 查询角色已有按钮权限id
export async function getButtonIds(data) {
  return request({
    url: '/sysRole/getButtonIds',
    method: 'get',
    params: data,
  });
}
// 查询当前用户按钮权限标识
export async function getButtonPerms(data) {
  return request({
    url: '/system/getButtonPerms',
    method: 'get',
    params: data,
  });
}
