point.api.ts 2.0 KB

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