CuspCustomerProfile.api.ts 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import {defHttp} from '/@/utils/http/axios';
  2. import { useMessage } from "/@/hooks/web/useMessage";
  3. const { createConfirm } = useMessage();
  4. enum Api {
  5. list = '/cuspCode/cuspCustomerProfile/list',
  6. save='/cuspCode/cuspCustomerProfile/add',
  7. edit='/cuspCode/cuspCustomerProfile/edit',
  8. deleteOne = '/cuspCode/cuspCustomerProfile/delete',
  9. deleteBatch = '/cuspCode/cuspCustomerProfile/deleteBatch',
  10. importExcel = '/cuspCode/cuspCustomerProfile/importExcel',
  11. exportXls = '/cuspCode/cuspCustomerProfile/exportXls',
  12. cuspCustomerProfileManList = '/cuspCode/cuspCustomerProfile/queryCuspCustomerProfileManByMainId',
  13. }
  14. /**
  15. * 导出api
  16. * @param params
  17. */
  18. export const getExportUrl = Api.exportXls;
  19. /**
  20. * 导入api
  21. */
  22. export const getImportUrl = Api.importExcel;
  23. /**
  24. * 查询子表数据
  25. * @param params
  26. */
  27. export const cuspCustomerProfileManList = Api.cuspCustomerProfileManList;
  28. /**
  29. * 列表接口
  30. * @param params
  31. */
  32. export const list = (params) =>
  33. defHttp.get({url: Api.list, params});
  34. /**
  35. * 删除单个
  36. */
  37. export const deleteOne = (params,handleSuccess) => {
  38. return defHttp.delete({url: Api.deleteOne, params}, {joinParamsToUrl: true}).then(() => {
  39. handleSuccess();
  40. });
  41. }
  42. /**
  43. * 批量删除
  44. * @param params
  45. */
  46. export const batchDelete = (params, handleSuccess) => {
  47. createConfirm({
  48. iconType: 'warning',
  49. title: '确认删除',
  50. content: '是否删除选中数据',
  51. okText: '确认',
  52. cancelText: '取消',
  53. onOk: () => {
  54. return defHttp.delete({url: Api.deleteBatch, data: params}, {joinParamsToUrl: true}).then(() => {
  55. handleSuccess();
  56. });
  57. }
  58. });
  59. }
  60. /**
  61. * 保存或者更新
  62. * @param params
  63. */
  64. export const saveOrUpdate = (params, isUpdate) => {
  65. let url = isUpdate ? Api.edit : Api.save;
  66. return defHttp.post({url: url, params});
  67. }