file.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. import request from '@/utils/request'
  2. import qs from 'qs'
  3. import { getDictByTypeValue } from '@/api/dict'
  4. export const getAttaments = (params) => {
  5. return new request({
  6. url: './file/sysAttachmentInfos',
  7. method: 'get',
  8. params: params
  9. });
  10. }
  11. export const searchFiles = (params) => {
  12. return new request({
  13. url: './file/sysAttachmentInfos/search',
  14. method: 'get',
  15. params: params
  16. });
  17. }
  18. export const convertFile = (attachmentId) => {
  19. return new request({
  20. url: './file/convert/' + attachmentId,
  21. method: 'post',
  22. });
  23. }
  24. export const delAttament = (attachmentId) => {
  25. return new request({
  26. url: './file/sysAttachmentInfos/' + attachmentId,
  27. method: 'delete',
  28. });
  29. }
  30. export const checkFileExist = (params) => {
  31. return new request({
  32. url: './file/download/checkFileExist',
  33. method: 'get',
  34. params: params,
  35. });
  36. }
  37. export const downloadFile = (params) => {
  38. return new request({
  39. url: './file/download',
  40. method: 'get',
  41. params: params,
  42. responseType: 'blob'
  43. });
  44. }
  45. export const downloadAttachment = (id) => {
  46. return new request({
  47. url: './file/download/attachment/' + id,
  48. method: 'get',
  49. responseType:'blob',
  50. });
  51. }
  52. export const getFileUploadInitData = (attachmentBusinessId, attachmentBusinessType, fileFuncTypePrefix) => {
  53. return request.all([getDictByTypeValue('FILE_FUNCTION_TYPE_DICT', fileFuncTypePrefix), getAttaments({
  54. attachmentBusinessId,
  55. attachmentBusinessType
  56. })]);
  57. }