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: '/wechatButton/list' + param,
    method: 'get',
    data,
  });
}

// 添加小程序三级按钮
export async function doAdd(data) {
  return request({
    url: '/wechatButton/insert',
    method: 'post',
    data,
  });
}
// 修改小程序三级按钮
export async function doEdit(data) {
  return request({
    url: '/wechatButton/update',
    method: 'post',
    data,
  });
}
// 分配小程序三级按钮
export async function assignButton(data) {
  return request({
    url: '/miniRole/assignButton',
    method: 'post',
    data,
  });
}
// 查询角色已有按钮权限id
export async function getButtonIds(data) {
  return request({
    url: '/miniRole/getButtonIds',
    method: 'get',
    params: data,
  });
}

// 树形列表
export async function buttonTree(data) {
  return request({
    url: '/wechatButton/buttonTree',
    method: 'get',
    params: data,
  });
}
