feat: 添加系统配置

This commit is contained in:
2025-02-12 22:36:29 +08:00
parent b1b00a3a02
commit 21d128ed66
7 changed files with 745 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
import { http } from "@/utils/http";
import type {
ConfigInfo,
DepartmentInfo,
DepartmentRoleInfo,
PermissionInfo,
@@ -497,3 +498,99 @@ export const getUserGetDepartmentRolesAPI = (id: string) => {
`/api/department/roleList/${id}`
);
};
// ---------------------------配置相关-------------------------------------
/**
* 添加配置参数
*/
interface AddConfigParams {
/**配置名称 */
name: string;
/**配置键值 */
key: string;
/**配置值 */
value: string;
/**系统配置 */
type: string;
/**备注 */
remark?: string;
}
/**
* 添加配置
* @param data
* @returns
*/
export const postAddConfigAPI = (data: AddConfigParams) => {
return http.request<null>("post", `/api/config/add`, {
data
});
};
/**
* 删除配置
*/
export const deleteConfigAPI = (id: string) => {
return http.request<null>("post", `/api/config/delete/${id}`);
};
/**
* 批量删除配置
* @param data 配置ID列表
*/
export const deleteConfigListAPI = (data: { ids: string[] }) => {
return http.request<null>("post", `/api/config/deleteList`, { data });
};
/**
* 更新配置
*/
export const putUpdateConfigAPI = (data: AddConfigParams, id: string) => {
return http.request<null>("post", `/api/config/update/${id}`, {
data
});
};
/**
* 获取配置信息
* @param id 配置ID
*/
export const getConfigAPI = (id: string) => {
return http.request<ConfigInfo>("get", `/api/config/info/${id}`);
};
/**
* 获取配置列表参数
*/
interface GetConfigListParams {
/**
* 页码
*/
page: number;
/**
* 每页数量
*/
pageSize: number;
/**
* 配置名称
*/
name?: string;
/**
* 配置键值
*/
key?: string;
/**
* 系统配置
*/
type?: string;
}
/**
* 获取配置列表
* @param params
*/
export const getConfigListAPI = (params: GetConfigListParams) => {
return http.request<QueryListResult<ConfigInfo>>("get", `/api/config/list`, {
params: filterEmptyObject(params)
});
};