mirror of
https://github.com/fastapiadmin/FastapiAdmin.git
synced 2026-09-27 06:41:12 +00:00
feat: 重构前端项目结构并优化代码
refactor: 迁移前端资源文件至web目录 feat: 新增多种图标资源 style: 统一代码风格和格式化配置 docs: 更新README和文档说明 chore: 更新依赖和配置文件 fix: 修复部分类型定义和枚举 perf: 优化路由和组件加载逻辑
This commit is contained in:
@@ -0,0 +1,130 @@
|
||||
import request from '@/utils/http';
|
||||
|
||||
const API_PATH = '/system/param';
|
||||
|
||||
const ParamsAPI = {
|
||||
/**
|
||||
* 上传文件
|
||||
* @param body 文件数据
|
||||
* @returns 上传后的文件路径
|
||||
*/
|
||||
uploadFile(body: any) {
|
||||
return request<ApiResponse<UploadFilePath>>({
|
||||
url: `${API_PATH}/upload`,
|
||||
method: 'post',
|
||||
data: body,
|
||||
headers: { 'Content-Type': 'multipart/form-data' },
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取初始化配置
|
||||
* @returns 初始化配置列表
|
||||
*/
|
||||
getInitConfig() {
|
||||
return request<ApiResponse<ConfigTable[]>>({
|
||||
url: `${API_PATH}/info`,
|
||||
method: 'get',
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取参数列表
|
||||
* @param query 查询参数
|
||||
* @returns 参数列表
|
||||
*/
|
||||
listParams(query: ConfigPageQuery) {
|
||||
return request<PageResult<ConfigTable[]>>({
|
||||
url: `${API_PATH}/list`,
|
||||
method: 'get',
|
||||
params: query,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 获取参数详情
|
||||
* @param query 参数ID
|
||||
* @returns 参数详情
|
||||
*/
|
||||
detailParams(query: number) {
|
||||
return request<ApiResponse<ConfigTable>>({
|
||||
url: `${API_PATH}/detail/${query}`,
|
||||
method: 'get',
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 创建参数
|
||||
* @param body 参数信息
|
||||
*/
|
||||
createParams(body: ConfigForm) {
|
||||
return request({
|
||||
url: `${API_PATH}/create`,
|
||||
method: 'post',
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 更新参数
|
||||
* @param id 参数ID
|
||||
* @param body 参数信息
|
||||
*/
|
||||
updateParams(id: number, body: ConfigForm) {
|
||||
return request({
|
||||
url: `${API_PATH}/update/${id}`,
|
||||
method: 'put',
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 删除参数
|
||||
* @param body 参数ID列表
|
||||
*/
|
||||
deleteParams(body: number[]) {
|
||||
return request({
|
||||
url: `${API_PATH}/delete`,
|
||||
method: 'delete',
|
||||
data: body,
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 导出参数
|
||||
* @param body 查询参数
|
||||
* @returns 导出的参数文件
|
||||
*/
|
||||
exportParams(body: ConfigPageQuery) {
|
||||
return request<ApiResponse<Blob>>({
|
||||
url: `${API_PATH}/export`,
|
||||
method: 'post',
|
||||
data: body,
|
||||
responseType: 'blob',
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
export default ParamsAPI;
|
||||
|
||||
export interface ConfigPageQuery extends PageQuery {
|
||||
config_name?: string;
|
||||
config_key?: string;
|
||||
config_type?: boolean;
|
||||
created_time?: string[];
|
||||
updated_time?: string[];
|
||||
}
|
||||
|
||||
export interface ConfigTable extends BaseType {
|
||||
config_name?: string;
|
||||
config_key?: string;
|
||||
config_value?: string;
|
||||
config_type?: boolean;
|
||||
}
|
||||
|
||||
export interface ConfigForm extends BaseFormType {
|
||||
config_name?: string;
|
||||
config_key?: string;
|
||||
config_value?: string;
|
||||
config_type?: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user