configuration.api.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import { defHttp } from '/@/utils/http/axios';
  2. enum Api {
  3. list = '/safety/configurationData/getConfigurationDataList',
  4. save = '/safety/configurationData/addConfigurationData',
  5. edit = '/safety/configurationData/updateConfigurationData',
  6. deleteById = '/safety/configurationData/deleteConfigurationData',
  7. }
  8. /**
  9. * 列表接口
  10. * @param params
  11. */
  12. export const list = (params) => defHttp.post({ url: Api.list, params });
  13. /**
  14. * 删除配置项
  15. */
  16. export const deleteById = (params, handleSuccess) => {
  17. return defHttp.get({ url: Api.deleteById, params }, { joinParamsToUrl: true }).then(() => {
  18. handleSuccess();
  19. });
  20. };
  21. // /**
  22. // * 批量删除配置项
  23. // * @param params
  24. // */
  25. // export const batchDeleteById = (params, handleSuccess) => {
  26. // Modal.confirm({
  27. // title: '确认删除',
  28. // content: '是否删除选中数据',
  29. // okText: '确认',
  30. // cancelText: '取消',
  31. // onOk: () => {
  32. // return defHttp.get({ url: Api.deleteById, data: params }, { joinParamsToUrl: true }).then(() => {
  33. // handleSuccess();
  34. // });
  35. // },
  36. // });
  37. // };
  38. /**
  39. * 保存或者更新
  40. * @param params
  41. */
  42. export const saveOrUpdate = (params, isUpdate) => {
  43. const url = isUpdate ? Api.edit : Api.save;
  44. return isUpdate ? defHttp.post({ url: url, params }) : defHttp.post({ url: url, params });
  45. };