4 changed files with 130 additions and 1 deletions
@ -1 +1,2 @@ |
|||
export * as settingDefintiionsApi from './definitions'; |
|||
export * as settingDefinitionsApi from './definitions'; |
|||
export * as settingsApi from './settings'; |
|||
|
|||
@ -0,0 +1,71 @@ |
|||
import type { ListResultDto } from '@abp/core'; |
|||
|
|||
import type { SettingGroup, SettingsUpdateInput } from '../types/settings'; |
|||
|
|||
import { requestClient } from '@abp/request'; |
|||
|
|||
/** |
|||
* 获取全局设置 |
|||
* @returns 设置数据传输对象列表 |
|||
*/ |
|||
export function getGlobalSettingsApi(): Promise<ListResultDto<SettingGroup>> { |
|||
return requestClient.get<ListResultDto<SettingGroup>>( |
|||
`/api/setting-management/settings/by-global`, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 设置全局设置 |
|||
* @returns 设置数据传输对象列表 |
|||
*/ |
|||
export function setGlobalSettingsApi( |
|||
input: SettingsUpdateInput, |
|||
): Promise<void> { |
|||
return requestClient.put( |
|||
`/api/setting-management/settings/change-global`, |
|||
input, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 获取租户设置 |
|||
* @returns 设置数据传输对象列表 |
|||
*/ |
|||
export function getTenantSettingsApi(): Promise<ListResultDto<SettingGroup>> { |
|||
return requestClient.get<ListResultDto<SettingGroup>>( |
|||
`/api/setting-management/settings/by-current-tenant`, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 设置租户设置 |
|||
* @returns 设置数据传输对象列表 |
|||
*/ |
|||
export function setTenantSettingsApi( |
|||
input: SettingsUpdateInput, |
|||
): Promise<void> { |
|||
return requestClient.put( |
|||
`/api/setting-management/settings/change-current-tenant`, |
|||
input, |
|||
); |
|||
} |
|||
/** |
|||
* 获取用户设置 |
|||
* @returns 设置数据传输对象列表 |
|||
*/ |
|||
export function getUserSettingsApi(): Promise<ListResultDto<SettingGroup>> { |
|||
return requestClient.get<ListResultDto<SettingGroup>>( |
|||
`/api/setting-management/settings/by-current-user`, |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* 设置用户设置 |
|||
* @returns 设置数据传输对象列表 |
|||
*/ |
|||
export function setUserSettingsApi(input: SettingsUpdateInput): Promise<void> { |
|||
return requestClient.put( |
|||
`/api/setting-management/settings/change-current-user`, |
|||
input, |
|||
); |
|||
} |
|||
@ -1 +1,2 @@ |
|||
export * from './definitions'; |
|||
export * from './settings'; |
|||
|
|||
@ -0,0 +1,56 @@ |
|||
interface SettingBase { |
|||
/** 名称 */ |
|||
name: string; |
|||
/** 当前设置值 */ |
|||
value: any; |
|||
} |
|||
|
|||
/** 配置变更对象 */ |
|||
type SettingUpdateInput = SettingBase; |
|||
|
|||
/** 配置变更集合对象 */ |
|||
interface SettingsUpdateInput { |
|||
/** 配置集合 */ |
|||
settings: SettingUpdateInput[]; |
|||
} |
|||
|
|||
export enum ValueType { |
|||
Array = 4, |
|||
Boolean = 2, |
|||
Date = 3, |
|||
Number = 1, |
|||
Object = 10, |
|||
Option = 5, |
|||
String = 0, |
|||
} |
|||
|
|||
interface Option { |
|||
name: string; |
|||
value: string; |
|||
} |
|||
|
|||
interface SettingDetail { |
|||
defaultValue: string; |
|||
description?: string; |
|||
displayName: string; |
|||
isEncrypted: boolean; |
|||
name: string; |
|||
options: Option[]; |
|||
slot?: string; |
|||
value?: string; |
|||
valueType: ValueType; |
|||
} |
|||
|
|||
interface Setting { |
|||
description?: string; |
|||
details: SettingDetail[]; |
|||
displayName: string; |
|||
} |
|||
|
|||
interface SettingGroup { |
|||
description: string; |
|||
displayName: string; |
|||
settings: Setting[]; |
|||
} |
|||
|
|||
export type { SettingGroup, SettingsUpdateInput }; |
|||
Loading…
Reference in new issue