普兆健康管家后端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.6 KiB

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