- 401 自动登出:http 会话过期回调 + main.ts 注册(清 menu/tabs + 跳登录) - 参数配置/字典/组织/资源/角色/操作日志/登录日志对接真实接口 - 角色管理新增权限分配树(el-tree 勾选资源,/roles/:code/resources) - 操作日志/登录日志只读页(ty-search-form + ty-table + useRequest) - listOrgs 迁到 api/org.ts Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
55 lines
1.3 KiB
TypeScript
55 lines
1.3 KiB
TypeScript
import { http } from '@/api/http'
|
||
|
||
export interface Config {
|
||
id: string
|
||
tenantCode: string
|
||
key: string
|
||
value: string | null
|
||
remark: string | null
|
||
createdAt: string
|
||
updatedAt: string
|
||
}
|
||
|
||
export interface ConfigListQuery {
|
||
page: number
|
||
pageSize: number
|
||
key?: string
|
||
value?: string
|
||
}
|
||
|
||
export interface ConfigListResult {
|
||
list: Config[]
|
||
total: number
|
||
page: number
|
||
pageSize: number
|
||
}
|
||
|
||
export interface ConfigUpsertData {
|
||
key?: string
|
||
value?: string
|
||
remark?: string
|
||
}
|
||
|
||
/** 配置分页列表。 */
|
||
export function listConfigs(query: ConfigListQuery, signal?: AbortSignal): Promise<ConfigListResult> {
|
||
const params: Record<string, unknown> = { page: query.page, pageSize: query.pageSize }
|
||
if (query.key) params.key = query.key
|
||
if (query.value) params.value = query.value
|
||
return http.get<ConfigListResult>('/configs', { params, signal })
|
||
}
|
||
|
||
/** 新增配置。 */
|
||
export function createConfig(data: ConfigUpsertData): Promise<Config> {
|
||
return http.post<Config>('/configs', data)
|
||
}
|
||
|
||
/** 更新配置(key 不可改)。 */
|
||
export function updateConfig(id: string, data: ConfigUpsertData): Promise<Config> {
|
||
return http.patch<Config>(`/configs/${id}`, data)
|
||
}
|
||
|
||
/** 删除配置(软删)。 */
|
||
export function deleteConfig(id: string): Promise<unknown> {
|
||
return http.delete(`/configs/${id}`)
|
||
}
|