tableColumns.api.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import { defHttp } from '/@/utils/http/axios';
  2. import { Modal } from 'ant-design-vue';
  3. enum Api {
  4. list = '/safety/ventanalyShowColum/list',
  5. save = '/safety/ventanalyShowColum/add',
  6. edit = '/safety/ventanalyShowColum/edit',
  7. selectDevice = '/jeecg-system/sys/dict/DeviceKind/query',
  8. deleteById = '/safety/ventanalyShowColum/delete',
  9. importExcel = '/safety/ventanalyShowColum/importExcel',
  10. exportXls = '/safety/ventanalyShowColum/exportXls',
  11. }
  12. /**
  13. * 导出api
  14. * @param params
  15. */
  16. export const getExportUrl = Api.exportXls;
  17. /**
  18. * 导入api
  19. */
  20. export const getImportUrl = Api.importExcel;
  21. /**
  22. * 列表接口
  23. * @param params
  24. */
  25. export const list = (params) => defHttp.get({ url: Api.list, params });
  26. /**
  27. * 设备类型查询接口
  28. * @param params
  29. */
  30. export const selectDevice = (params) => defHttp.get({ url: Api.selectDevice, params });
  31. /**
  32. * 删除用户
  33. */
  34. export const deleteById = (params, handleSuccess) => {
  35. return defHttp.delete({ url: Api.deleteById, params }, { joinParamsToUrl: true }).then(() => {
  36. handleSuccess();
  37. });
  38. };
  39. /**
  40. * 批量删除用户
  41. * @param params
  42. */
  43. export const batchDeleteById = (params, handleSuccess) => {
  44. Modal.confirm({
  45. title: '确认删除',
  46. content: '是否删除选中数据',
  47. okText: '确认',
  48. cancelText: '取消',
  49. onOk: () => {
  50. return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
  51. handleSuccess();
  52. });
  53. },
  54. });
  55. };
  56. /**
  57. * 保存或者更新用户
  58. * @param params
  59. */
  60. export const saveOrUpdate = (params, isUpdate) => {
  61. const url = isUpdate ? Api.edit : Api.save;
  62. return isUpdate ? defHttp.put({ url: url, params }) : defHttp.post({ url: url, params });
  63. };