index.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import type { CustomerEntity, PageConfig } from '@vben/types';
  2. import { parseQueryValues } from '@vben/utils';
  3. import { requestClient } from '#/api/request';
  4. interface CustomerPartialEntity
  5. extends Partial<Omit<CustomerEntity, 'usersname' | 'usersphone'>> {
  6. usersphone?: string;
  7. usersname?: string;
  8. }
  9. interface CustomerQueryParams extends CustomerPartialEntity, PageConfig {
  10. [key: `${string}.value`]: boolean | number | string;
  11. }
  12. /**
  13. * 客户信息_列表
  14. */
  15. export async function getCustomerListApi(params: CustomerQueryParams) {
  16. const queryParams = params;
  17. if (params.usersnature) {
  18. queryParams['usersnature.value'] = params.usersnature;
  19. }
  20. return requestClient.post<any>('/api/query/list?pagevalue=17', {
  21. ...params,
  22. });
  23. }
  24. /**
  25. * 客户信息_详情
  26. */
  27. export async function getCustomerDetailApi(data: { usersid: string }) {
  28. return requestClient.post<any>(
  29. '/api/query/view?pagevalue=19',
  30. {
  31. ...parseQueryValues(data),
  32. },
  33. { formatData: true }, // 格式化返回数据
  34. );
  35. }
  36. /**
  37. * 客户信息_新增
  38. */
  39. export async function addCustomerApi(data: CustomerEntity) {
  40. return requestClient.post<any>('/api/add?pagevalue=20', { ...data });
  41. }
  42. /**
  43. * 客户信息_编辑
  44. */
  45. export async function editCustomerApi(data: CustomerEntity) {
  46. return requestClient.post<any>('/api/up?pagevalue=21', { ...data });
  47. }
  48. /**
  49. * 客户信息_删除
  50. */
  51. export async function deleteCustomerApi(data: { 'usersid.value': string }) {
  52. return requestClient.post<any>('/api/del?pagevalue=22', { ...data });
  53. }