import { request } from 'umi';
import { getDataBaseUrl } from '@/global_data';
//分页
export async function Page(params) {
  return request(getDataBaseUrl()+'/api/roles/page', {
    method: 'post',
    data: {
      ...params,
    },
  });
}
//启用
export async function Enable(params) {
  return request(getDataBaseUrl()+`/api/roles/enable/?Id=${params}`);
}
//禁用
export async function Disable(params) {
  return request(getDataBaseUrl()+`/api/roles/disable/?Id=${params}`);
}

//新增
export async function add(params) {
  return request(getDataBaseUrl()+'/api/roles/add', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
//修改
export async function edit(params) {
  return request(getDataBaseUrl()+'/api​/roles/update', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
//删除
export async function removeRole(params) {
  return request(getDataBaseUrl()+'/api​/roles/delete', {
    method: 'POST',
    data: params,
  });
}

//设置菜单
export async function setMenu(params) {
  return request(getDataBaseUrl()+'​/api/roles/addorupdatemenurole',{
    method:'post',
    data:params
  });
}

//获取角色菜单
export async function GetRoleMenu(params) {
  return request(getDataBaseUrl()+`/api/roles/getmenurole/?RoleId=${params}`);
}

//数据授权
export async function SetDataRole(params) {
  return request(getDataBaseUrl()+`/api/roles/setandalterdatascope`,{
    method:'post',
    data:params
  });
}
 /** 查询功能菜单*/
 export async function GetMenu(params) {
  return request(getDataBaseUrl()+`​/api/menu/menuparmytrees?getType=${params.getType}&&type=${params.type}`,
  {
    method: 'Get',
  });
}
