file.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 convertFile = (attachmentId) => {
  12. return new request({
  13. url: './file/convert/' + attachmentId,
  14. method: 'post',
  15. });
  16. }
  17. export const delAttament = (attachmentId) => {
  18. return new request({
  19. url: './file/sysAttachmentInfos/' + attachmentId,
  20. method: 'delete',
  21. });
  22. }
  23. export const checkFileExist = (params) => {
  24. return new request({
  25. url: './file/download/checkFileExist',
  26. method: 'get',
  27. params: params,
  28. });
  29. }
  30. export const downloadFile = (params) => {
  31. return new request({
  32. url: './file/download',
  33. method: 'get',
  34. params: params,
  35. responseType: 'blob'
  36. });
  37. }
  38. export const downloadAttachment = (id) => {
  39. return new request({
  40. url: './file/download/attachment/' + id,
  41. method: 'get',
  42. responseType: 'blob'
  43. });
  44. }
  45. export const getFileUploadInitData = (attachmentBusinessId, attachmentBusinessType, fileFuncTypePrefix) => {
  46. return request.all([getDictByTypeValue('FILE_FUNCTION_TYPE_DICT', fileFuncTypePrefix), getAttaments({
  47. attachmentBusinessId,
  48. attachmentBusinessType
  49. })]);
  50. }