permission.ts 995 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { BaseQuery, deleteRequest, get, post, put, Result } from "../base";
  2. /**
  3. * 菜单与权限树形列表
  4. * @param query 查询参数
  5. * @returns 树形列表
  6. */
  7. export function treeList<P extends BaseQuery, T>(
  8. query?: P
  9. ): Promise<Result<T>> {
  10. return get("/sys/permission/tree", query);
  11. }
  12. /**
  13. * 菜单树形列表
  14. * @param query .
  15. */
  16. export function treeMenus<P extends BaseQuery, T>(
  17. query?: P
  18. ): Promise<Result<T>> {
  19. return get("/sys/permission/tree/menu", query);
  20. }
  21. /**
  22. * 新增
  23. * @param data .
  24. * @returns .
  25. */
  26. export function savePermission<T>(data: any): Promise<Result<T>> {
  27. return post("/sys/permission/save", data);
  28. }
  29. /**
  30. * 更新
  31. * @param id .
  32. * @param data .
  33. * @returns .
  34. */
  35. export function updatePermission<T>(id: string, data: any): Promise<Result<T>> {
  36. return put("/sys/permission/update", { id: id }, data);
  37. }
  38. export function deletePermission<T>(ids: string[]): Promise<Result<T>> {
  39. return deleteRequest("/sys/permission/delete", {}, ids);
  40. }