import request from '/@/utils/request'

// 查询菜单列表
export function listMenu(params?: any) {
  return request({
    url: '/system/menu/list',
    method: 'get',
    params,
  })
}

export function getTree(params?: any) {
  return request({
    url: '/menuManagement/getTree',
    method: 'get',
    params,
  })
}

/** 新增菜单 */
export const doAdd = (data: any) => {
  return request({
    url: '/system/menu',
    method: 'post',
    data,
  })
}

/** 修改菜单 */
export const doEdit = (data: any) => {
  return request({
    url: '/system/menu',
    method: 'put',
    data,
  })
}

/** 删除菜单 */
export const doDelete = (menuId: any) => {
  return request({
    url: `/system/menu/${menuId}`,
    method: 'delete',
  })
}

// 查询菜单详细
export function getMenu(menuId: any) {
  return request({
    url: `/system/menu/${menuId}`,
    method: 'get',
  })
}

// 查询菜单下拉树结构
export function treeselect() {
  return request({
    url: '/system/menu/treeselect',
    method: 'get',
  })
}

// 根据角色ID查询菜单下拉树结构
export function roleMenuTreeselect(roleId: any) {
  return request({
    url: `/system/menu/roleMenuTreeselect/${roleId}`,
    method: 'get',
  })
}
