import { request } from '@@/plugin-request/request';
import { stringify } from 'qs';

/**
 * 查询菜单数据
 * @param param
 */
export async function queryMenu(param: object) {
  return request(`/web/v1/menus?${stringify(param)}`);
}

/**
 * 删除菜单
 * @param record_id
 */
export async function delMenu(record_id: any) {
  return request(`/web/v1/menus/${record_id}`, {
    method: 'DELETE',
  });
}

/**
 * 新增菜单
 * @param params
 */
export async function createMenu(params: object) {
  return request(`/web/v1/menus`, {
    method: 'POST',
    data: params,
  });
}

/**
 * 编辑菜单
 * @param params
 */
export async function editMenu(params: any) {
  return request(`/web/v1/menus/${params.record_id}`, {
    method: 'PUT',
    data: params,
  });
}
