import request from '@/utils/request';

/**
 * 查询所有菜单列表
 * */
export function getMenu(params: any) {
  return request({
    url: '/api/menu/getHierarchicalMenu',
    method: 'post',
    data: params,
  });
}

/**
 * 根据用户查询菜单列表
 * */
export function getMenuWithRole(params: any) {
  return request({
    url: '/api/menu/getHierarchicalMenuWithCheck',
    method: 'post',
    data: params,
  });
}

/**
 * 新增菜单
 * */
export function addMenu(params: any) {
  return request({
    url: '/api/menu/addMenu',
    method: 'post',
    data: params,
  });
}

/**
 * 删除菜单
 * */
export function delMenu(params: any) {
  return request({
    url: '/api/menu/deleteMenu',
    method: 'post',
    data: params,
  });
}

/**
 * 修改菜单
 * */
export function updateMenu(params: any) {
  return request({
    url: '/api/menu/editMenu',
    method: 'post',
    data: params,
  });
}




/**
 * 目录结构
 */
export function getCatalogList(queryParams: any) {
  return request({
    url: '/api/user/getUserCatalogList',
    method: 'post',
    data: queryParams
  });
}

export function getUserMenuList(queryParams: any) {
  return request({
    url: '/api/user/getUserMenuList',
    method: 'post',
    data: queryParams
  });
}



/**
 * 目录树
 */
export function getCatalogTree() {
  return request({
    url: '/catalog/tree',
    method: 'post',
    data: {}
  });
}
/**
 * 目录新增
 * */
export function addCatalogData(data: any) {
  console.log(data, 'data')
  return request({
    url: '/catalog/add',
    method: 'post',
    data: data,
  });
}
/**
 * 目录编辑
 * */
export function updateCatalogData(data: any) {
  return request({
    url: '/catalog/update',
    method: 'post',
    data: data,
  });
}
/**
 * 页面列表
 * @param queryParams
 */
export function getPageList(queryParams: any) {
  return request({
    url: '/page/pageList',
    method: 'post',
    data: queryParams,
  });
}
/**
 * 页面新增
 * */
export function addPage(data: any) {
  return request({
    url: '/page/add',
    method: 'post',
    data: data,
  });
}
/**
 * 页面编辑
 * */
export function updatePage(data: any) {
  return request({
    url: '/page/update',
    method: 'post',
    data: data,
  });
}

/**
 * 启用页面
 */
export function enablePage(data: any) {
  return request({
    url: '/page/enable',
    method: 'post',
    data: data,
  });
}
/**
 * 禁用页面
 */
export function disablePage(data: any) {
  return request({
    url: '/page/disable',
    method: 'post',
    data: data,
  });
}

/**
 * 删除页面
 */
export function deletePage(data: any) {
  return request({
    url: '/page/delete',
    method: 'post',
    data: data,
  });
}
/**
 * 启用目录
 */
export function enableCatalogData(data: any) {
  return request({
    url: '/catalog/enable',
    method: 'post',
    data: data,
  });
}
/**
 * 禁用目录
 */
export function disableCatalogData(data: any) {
  return request({
    url: '/catalog/disable',
    method: 'post',
    data: data,
  });
}

/**
 * 删除目录
 */
export function deleteCatalogData(data: any) {
  return request({
    url: '/catalog/delete',
    method: 'post',
    data: data,
  });
}
/*按钮清单*/
export function getLinkButton(data: any) {
  return request({
    url: '/button/list',
    method: 'post',
    data: data,
  });
}
/*删除按钮*/
export function deleteLinkButtonData(data: any) {
  return request({
    url: '/button/delete',
    method: 'post',
    data: data,
  });
}
/*新增按钮*/
export function addLinkButtonData(data: any) {
  return request({
    url: '/button/add',
    method: 'post',
    data: data,
  });
}
/*编辑按钮*/
export function updateLinkButtonData(data: any) {
  return request({
    url: '/button/update',
    method: 'post',
    data: data,
  });
}
