index.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import type { PageConfig, RoleGroupEntity } from '@vben/types';
  2. import { parseQueryValues } from '@vben/utils';
  3. import { requestClient } from '#/api/request';
  4. interface RolePartialEntity extends Partial<Omit<RoleGroupEntity, 'title'>> {
  5. title?: string;
  6. }
  7. interface RoleQueryParams extends PageConfig, RolePartialEntity {}
  8. /**
  9. * 角色信息_列表
  10. */
  11. export async function getRoleListApi(params: RoleQueryParams) {
  12. return requestClient.post<any>('/api/query/list?pagevalue=88', {
  13. ...params,
  14. });
  15. }
  16. /**
  17. * 角色信息_详情
  18. */
  19. export async function getRoleDetailApi(data: { id: number }) {
  20. return requestClient.post<any>(
  21. '/api/query/view?pagevalue=89',
  22. {
  23. ...parseQueryValues(data),
  24. },
  25. { formatData: true },
  26. );
  27. }
  28. /**
  29. * 角色信息_新增
  30. */
  31. export async function addRoleApi(data: RoleGroupEntity) {
  32. return requestClient.post<any>('/api/add?pagevalue=90', { ...data });
  33. }
  34. /**
  35. * 角色信息_编辑
  36. */
  37. export async function editRoleApi(data: RoleGroupEntity) {
  38. return requestClient.post<any>('/api/up?pagevalue=91', { ...data });
  39. }
  40. /**
  41. * 角色信息_删除
  42. */
  43. export async function deleteRoleApi(data: { 'id.value': number }) {
  44. return requestClient.post<any>('/api/del?pagevalue=92', { ...data });
  45. }