auth-web/src/api/v1/files.ts

43 lines
1.8 KiB
TypeScript
Raw Normal View History

import { http } from '@/api/service/request';
import type { BaseResult, ResultTable } from '@/api/service/types';
2024-10-12 16:57:13 +08:00
/** 系统文件管理---获取系统文件管理列表 */
export const fetchGetFilesList = (data: any) => {
return http.request<BaseResult<ResultTable>>('get', `files/getFilesList/${data.currentPage}/${data.pageSize}`, { params: data });
};
2024-10-23 13:46:46 +08:00
/** 系统文件管理---根据Id下载系统文件 */
export const downloadFilesByFileId = (data: any) => {
return http.request<any>('get', `files/downloadFilesByFileId/${data.id}`, { responseType: 'blob' });
};
/** 系统文件管理---批量下载系统文件 */
export const downloadFilesByFilepath = (data: any) => {
return http.request<any>('get', `files/downloadFilesByFilepath`, { params: data, responseType: 'blob' });
2024-10-12 16:57:13 +08:00
};
2024-10-14 14:12:43 +08:00
/** 系统文件管理---获取所有文件类型 */
export const fetchGetAllMediaTypes = () => {
return http.request<BaseResult<any>>('get', `files/noManage/getAllMediaTypes`);
2024-10-14 14:12:43 +08:00
};
/** 系统文件管理---获取所有文件存储基础路径 */
2024-10-14 14:12:43 +08:00
export const fetchGetAllFilesStoragePath = () => {
return http.request<BaseResult<any>>('get', `files/noManage/getAllFilesStoragePath`);
2024-10-14 14:12:43 +08:00
};
2024-10-12 16:57:13 +08:00
/** 系统文件管理---添加系统文件管理 */
export const fetchAddFiles = (data: any) => {
2024-10-14 14:12:43 +08:00
return http.request<BaseResult<any>>('post', 'files/addFiles', { data }, { headers: { 'Content-Type': 'multipart/form-data' } });
};
2024-10-12 16:57:13 +08:00
/** 系统文件管理---更新系统文件管理 */
export const fetchUpdateFiles = (data: any) => {
2024-10-14 14:12:43 +08:00
return http.request<BaseResult<object>>('put', 'files/updateFiles', { data }, { headers: { 'Content-Type': 'multipart/form-data' } });
};
2024-10-12 16:57:13 +08:00
/** 系统文件管理---删除系统文件管理 */
export const fetchDeleteFiles = (data: any) => {
2024-10-12 16:57:13 +08:00
return http.request<BaseResult<any>>('delete', 'files/deleteFiles', { data });
};