gate.api.ts 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import { defHttp } from '/@/utils/http/axios';
  2. import { Modal } from 'ant-design-vue';
  3. enum Api {
  4. list = '/ventanaly-device/monitor/device',
  5. save = '/safety/ventanalyGate/add',
  6. edit = '/safety/ventanalyGate/edit',
  7. deleteById = '/safety/ventanalyGate/delete',
  8. deleteBatch = '/sys/user/deleteBatch',
  9. importExcel = '/sys/user/importExcel',
  10. exportXls = '/sys/user/exportXls',
  11. baseList = '/safety/ventanalyGate/list',
  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) => defHttp.post({ url: Api.list, params });
  27. /**
  28. * 删除用户
  29. */
  30. export const deleteById = (params, handleSuccess) => {
  31. return defHttp.delete({ url: Api.deleteById, params }, { joinParamsToUrl: true }).then(() => {
  32. handleSuccess();
  33. });
  34. };
  35. /**
  36. * 批量删除用户
  37. * @param params
  38. */
  39. export const batchDeleteById = (params, handleSuccess) => {
  40. Modal.confirm({
  41. title: '确认删除',
  42. content: '是否删除选中数据',
  43. okText: '确认',
  44. cancelText: '取消',
  45. onOk: () => {
  46. return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
  47. handleSuccess();
  48. });
  49. },
  50. });
  51. };
  52. /**
  53. * 保存或者更新用户
  54. * @param params
  55. */
  56. export const saveOrUpdate = (params, isUpdate) => {
  57. const url = isUpdate ? Api.edit : Api.save;
  58. return defHttp.put({ url: url, params });
  59. };
  60. export const getTableList = (params) => defHttp.get({ url: Api.baseList, params });