device.api.ts 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import { defHttp } from '/@/utils/http/axios';
  2. import { Modal } from 'ant-design-vue';
  3. enum Api {
  4. list = '/safety/ventanalyDeviceInfo/list',
  5. footageList = '/safety/fteGasReg/list',
  6. queryById = '/safety/ventanalyDeviceInfo/queryById',
  7. save = '/safety/ventanalyDeviceInfo/add',
  8. saveF = '/safety/fteGasReg/add',
  9. edit = '/safety/ventanalyDeviceInfo/edit',
  10. editF = '/safety/fteGasReg/edit',
  11. deleteById = '/safety/ventanalyDeviceInfo/delete',
  12. deleteByIdF = '/safety/fteGasReg/delete',
  13. deleteBatch = '/safety/ventanalyDeviceInfo/deleteBatch',
  14. importExcel = '/sys/user/importExcel',
  15. exportXls = '/safety/ventanalyMonitorParams/exportXls',
  16. importExcel1 = '/safety/gasDayReport/importByExcel',
  17. }
  18. /**
  19. * 导出api
  20. * @param params
  21. */
  22. export const getExportUrl = Api.exportXls;
  23. /**
  24. * 导入api
  25. */
  26. export const getImportUrl = Api.importExcel;
  27. /**
  28. * 导入api
  29. */
  30. export const getImportUrl1 = Api.importExcel1;
  31. /**
  32. * 列表接口
  33. * @param params
  34. */
  35. export const list = (params) => defHttp.get({ url: Api.list, params });
  36. /**
  37. * 列表接口-进尺与瓦斯涌出
  38. * @param params
  39. */
  40. export const footageList = (params) => defHttp.get({ url: Api.footageList, params });
  41. export const queryById = (params) => defHttp.get({ url: Api.queryById, params });
  42. /**
  43. * 删除用户
  44. */
  45. export const deleteById = (params, handleSuccess) => {
  46. return defHttp.delete({ url: Api.deleteById, params }, { joinParamsToUrl: true }).then(() => {
  47. handleSuccess();
  48. });
  49. };
  50. /**
  51. * 删除用户-进尺与瓦斯涌出
  52. */
  53. export const deleteByIdF = (params, handleSuccess) => {
  54. return defHttp.delete({ url: Api.deleteByIdF, params }, { joinParamsToUrl: true }).then(() => {
  55. handleSuccess();
  56. });
  57. };
  58. /**
  59. * 批量删除用户
  60. * @param params
  61. */
  62. export const batchDeleteById = (params, handleSuccess, handleCancel) => {
  63. Modal.confirm({
  64. title: '确认删除',
  65. content: '是否删除选中数据',
  66. okText: '确认',
  67. cancelText: '取消',
  68. wrapClassName: 'delete-confirm-modal',
  69. onOk: () => {
  70. return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
  71. handleSuccess();
  72. });
  73. },
  74. onCancel: () => {
  75. handleCancel?.();
  76. },
  77. });
  78. };
  79. /**
  80. * 保存或者更新用户
  81. * @param params
  82. */
  83. export const saveOrUpdate = (params, isUpdate) => {
  84. const url = isUpdate ? Api.edit : Api.save;
  85. return isUpdate ? defHttp.put({ url: url, params }) : defHttp.post({ url: url, params });
  86. };
  87. /**
  88. * 保存或者更新用户-进尺与瓦斯涌出
  89. * @param params
  90. */
  91. export const saveOrUpdateF = (params, isUpdate) => {
  92. const url = isUpdate ? Api.editF : Api.saveF;
  93. return isUpdate ? defHttp.put({ url: url, params }) : defHttp.post({ url: url, params });
  94. };
  95. /**
  96. * 列表接口
  97. * @param params
  98. */
  99. export const listF = (params) => defHttp.get({ url: Api.list, params });