index.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import request from "@/config/axios";
  2. // 文件预签名地址 Response VO
  3. export interface FilePresignedUrlRespVO {
  4. // 文件配置编号
  5. configId: number;
  6. // 文件上传 URL
  7. uploadUrl: string;
  8. uploadUrlPath: string;
  9. // 文件 URL
  10. url: string;
  11. }
  12. // 查询文件列表
  13. export const getFilePage = (params: any) => {
  14. return request.get({ url: "/infra/file/page", params });
  15. };
  16. // 删除文件
  17. export const deleteFile = (id: number) => {
  18. return request.delete({ url: "/infra/file/delete?id=" + id });
  19. };
  20. // 获取文件预签名地址
  21. export const getFilePresignedUrl = (path: string) => {
  22. return request.get<FilePresignedUrlRespVO>({
  23. url: "/infra/file/presigned-url",
  24. params: { path },
  25. });
  26. };
  27. // 创建文件
  28. export const createFile = (data: any) => {
  29. return request.post({ url: "/infra/file/create", data });
  30. };
  31. // 上传文件
  32. export const updateFile = (data: any) => {
  33. return request.upload({ url: "/infra/file/upload", data });
  34. };
  35. export const updateFilePath = (data: any) => {
  36. return request.upload({ url: "/infra/file/upload/path", data });
  37. };
  38. export const updateFileQhsePath = (data: any) => {
  39. return request.upload({ url: "/infra/file/upload/qhse/path", data });
  40. };