fileDetail.api.ts 2.1 KB

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