device.api.ts 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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.deleteById, params }, { joinParamsToUrl: true }).then(() => {
  55. handleSuccess();
  56. });
  57. };
  58. /**
  59. * 批量删除用户
  60. * @param params
  61. */
  62. export const batchDeleteById = (params, handleSuccess) => {
  63. Modal.confirm({
  64. title: '确认删除',
  65. content: '是否删除选中数据',
  66. okText: '确认',
  67. cancelText: '取消',
  68. onOk: () => {
  69. return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
  70. handleSuccess();
  71. });
  72. },
  73. });
  74. };
  75. /**
  76. * 保存或者更新用户
  77. * @param params
  78. */
  79. export const saveOrUpdate = (params, isUpdate) => {
  80. const url = isUpdate ? Api.edit : Api.save;
  81. return isUpdate ? defHttp.put({ url: url, params }) : defHttp.post({ url: url, params });
  82. };
  83. /**
  84. * 保存或者更新用户-进尺与瓦斯涌出
  85. * @param params
  86. */
  87. export const saveOrUpdateF = (params, isUpdate) => {
  88. const url = isUpdate ? Api.editF : Api.saveF;
  89. return isUpdate ? defHttp.put({ url: url, params }) : defHttp.post({ url: url, params });
  90. };
  91. /**
  92. * 列表接口
  93. * @param params
  94. */
  95. export const listF = (params) => defHttp.get({ url: Api.list, params });