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 { const params: Record = { page: query.page, pageSize: query.pageSize } if (query.key) params.key = query.key if (query.value) params.value = query.value return http.get('/configs', { params, signal }) } /** 新增配置。 */ export function createConfig(data: ConfigUpsertData): Promise { return http.post('/configs', data) } /** 更新配置(key 不可改)。 */ export function updateConfig(id: string, data: ConfigUpsertData): Promise { return http.patch(`/configs/${id}`, data) } /** 删除配置(软删)。 */ export function deleteConfig(id: string): Promise { return http.delete(`/configs/${id}`) }