tableReport.api.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import { defHttp } from '/@/utils/http/axios';
  2. import { Modal } from 'ant-design-vue';
  3. enum Api {
  4. list = '/safety/reportDataSyn/list',
  5. save = '/safety/reportDataSyn/add',
  6. edit = '/safety/reportDataSyn/edit',
  7. deleteById = '/safety/reportDataSyn/delete',
  8. readReportData= '/safety/reportDataSyn/readReportData'//手动从报表里提取数据
  9. }
  10. /**
  11. * 手动从报表里提取数据
  12. * @param params
  13. */
  14. export const readReportData = (params) => {
  15. return defHttp.get({ url: Api.readReportData, params }, { joinParamsToUrl: true })
  16. };
  17. /**
  18. * 列表接口
  19. * @param params
  20. */
  21. export const list = (params) => defHttp.get({ url: Api.list, params });
  22. /**
  23. * 删除用户
  24. */
  25. export const deleteById = (params, handleSuccess) => {
  26. return defHttp.delete({ url: Api.deleteById, params }, { joinParamsToUrl: true }).then(() => {
  27. handleSuccess();
  28. });
  29. };
  30. /**
  31. * 批量删除用户
  32. * @param params
  33. */
  34. export const batchDeleteById = (params, handleSuccess) => {
  35. Modal.confirm({
  36. title: '确认删除',
  37. content: '是否删除选中数据',
  38. okText: '确认',
  39. cancelText: '取消',
  40. onOk: () => {
  41. return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
  42. handleSuccess();
  43. });
  44. },
  45. });
  46. };
  47. /**
  48. * 保存或者更新用户
  49. * @param params
  50. */
  51. export const saveOrUpdate = (params, isUpdate) => {
  52. const url = isUpdate ? Api.edit : Api.save;
  53. return defHttp.post({ url: url, params });
  54. };