diff --git a/apps/vben5/apps/app-antd/package.json b/apps/vben5/apps/app-antd/package.json index 6bec70b7c..f7f4accbe 100644 --- a/apps/vben5/apps/app-antd/package.json +++ b/apps/vben5/apps/app-antd/package.json @@ -33,6 +33,7 @@ "@abp/openiddict": "workspace:*", "@abp/permission": "workspace:*", "@abp/request": "workspace:*", + "@abp/settings": "workspace:*", "@abp/ui": "workspace:*", "@vben/access": "workspace:*", "@vben/common-ui": "workspace:*", diff --git a/apps/vben5/apps/app-antd/src/locales/langs/en-US/abp.json b/apps/vben5/apps/app-antd/src/locales/langs/en-US/abp.json index bdea2d667..25ec69283 100644 --- a/apps/vben5/apps/app-antd/src/locales/langs/en-US/abp.json +++ b/apps/vben5/apps/app-antd/src/locales/langs/en-US/abp.json @@ -15,6 +15,11 @@ "title": "Permissions", "groups": "Groups", "definitions": "Definitions" + }, + "settings": { + "title": "Settings", + "definitions": "Definitions", + "system": "System Settings" } }, "openiddict": { diff --git a/apps/vben5/apps/app-antd/src/locales/langs/zh-CN/abp.json b/apps/vben5/apps/app-antd/src/locales/langs/zh-CN/abp.json index 103d0ab79..bd4920650 100644 --- a/apps/vben5/apps/app-antd/src/locales/langs/zh-CN/abp.json +++ b/apps/vben5/apps/app-antd/src/locales/langs/zh-CN/abp.json @@ -15,6 +15,11 @@ "title": "权限管理", "groups": "权限分组", "definitions": "权限定义" + }, + "settings": { + "title": "设置管理", + "definitions": "设置定义", + "system": "系统设置" } }, "openiddict": { diff --git a/apps/vben5/apps/app-antd/src/router/routes/modules/abp.ts b/apps/vben5/apps/app-antd/src/router/routes/modules/abp.ts index 7d71a20c2..7fcd60a98 100644 --- a/apps/vben5/apps/app-antd/src/router/routes/modules/abp.ts +++ b/apps/vben5/apps/app-antd/src/router/routes/modules/abp.ts @@ -110,6 +110,35 @@ const routes: RouteRecordRaw[] = [ }, ], }, + { + meta: { + title: $t('abp.manage.settings.title'), + icon: 'ic:outline-settings', + }, + name: 'SettingManagement', + path: '/manage/settings', + children: [ + { + meta: { + title: $t('abp.manage.settings.definitions'), + icon: 'codicon:settings', + }, + name: 'SettingDefinitions', + path: '/manage/settings/definitions', + component: () => + import('#/views/settings/definitions/index.vue'), + }, + { + meta: { + title: $t('abp.manage.settings.system'), + icon: 'tabler:settings-cog', + }, + name: 'SystemSettings', + path: '/manage/settings/system', + component: () => import('#/views/settings/system/index.vue'), + }, + ], + }, { meta: { title: $t('abp.manage.identity.auditLogs'), diff --git a/apps/vben5/apps/app-antd/src/views/settings/definitions/index.vue b/apps/vben5/apps/app-antd/src/views/settings/definitions/index.vue new file mode 100644 index 000000000..545f397d3 --- /dev/null +++ b/apps/vben5/apps/app-antd/src/views/settings/definitions/index.vue @@ -0,0 +1,15 @@ + + + + + + + diff --git a/apps/vben5/apps/app-antd/src/views/settings/system/index.vue b/apps/vben5/apps/app-antd/src/views/settings/system/index.vue new file mode 100644 index 000000000..f602c52ef --- /dev/null +++ b/apps/vben5/apps/app-antd/src/views/settings/system/index.vue @@ -0,0 +1,15 @@ + + + + + + + diff --git a/apps/vben5/packages/@abp/settings/package.json b/apps/vben5/packages/@abp/settings/package.json new file mode 100644 index 000000000..4d76e0d29 --- /dev/null +++ b/apps/vben5/packages/@abp/settings/package.json @@ -0,0 +1,37 @@ +{ + "name": "@abp/settings", + "version": "8.3.2", + "homepage": "https://github.com/colinin/abp-next-admin", + "bugs": "https://github.com/colinin/abp-next-admin/issues", + "repository": { + "type": "git", + "url": "git+https://github.com/colinin/abp-next-admin.git", + "directory": "packages/@abp/settings" + }, + "license": "MIT", + "type": "module", + "sideEffects": [ + "**/*.css" + ], + "exports": { + ".": { + "types": "./src/index.ts", + "default": "./src/index.ts" + } + }, + "dependencies": { + "@abp/core": "workspace:*", + "@abp/request": "workspace:*", + "@abp/ui": "workspace:*", + "@ant-design/icons-vue": "catalog:", + "@vben/access": "workspace:*", + "@vben/common-ui": "workspace:*", + "@vben/hooks": "workspace:*", + "@vben/icons": "workspace:*", + "@vben/layouts": "workspace:*", + "@vben/locales": "workspace:*", + "ant-design-vue": "catalog:", + "dayjs": "catalog:", + "vue": "catalog:*" + } +} diff --git a/apps/vben5/packages/@abp/settings/src/api/definitions.ts b/apps/vben5/packages/@abp/settings/src/api/definitions.ts new file mode 100644 index 000000000..65c5d0fcd --- /dev/null +++ b/apps/vben5/packages/@abp/settings/src/api/definitions.ts @@ -0,0 +1,77 @@ +import type { ListResultDto } from '@abp/core'; + +import type { + SettingDefinitionCreateDto, + SettingDefinitionDto, + SettingDefinitionGetListInput, + SettingDefinitionUpdateDto, +} from '../types/definitions'; + +import { requestClient } from '@abp/request'; + +/** + * 删除设置定义 + * @param name 设置名称 + */ +export function deleteApi(name: string): Promise { + return requestClient.delete( + `/api/setting-management/settings/definitions/${name}`, + ); +} + +/** + * 查询设置定义 + * @param name 设置名称 + * @returns 设置定义数据传输对象 + */ +export function getApi(name: string): Promise { + return requestClient.get( + `/api/setting-management/settings/definitions/${name}`, + ); +} + +/** + * 查询设置定义列表 + * @param input 设置过滤条件 + * @returns 设置定义数据传输对象列表 + */ +export function getListApi( + input?: SettingDefinitionGetListInput, +): Promise> { + return requestClient.get>( + `/api/setting-management/settings/definitions`, + { + params: input, + }, + ); +} + +/** + * 创建设置定义 + * @param input 设置定义参数 + * @returns 设置定义数据传输对象 + */ +export function createApi( + input: SettingDefinitionCreateDto, +): Promise { + return requestClient.post( + '/api/setting-management/settings/definitions', + input, + ); +} + +/** + * 更新设置定义 + * @param name 设置名称 + * @param input 设置定义参数 + * @returns 设置定义数据传输对象 + */ +export function updateApi( + name: string, + input: SettingDefinitionUpdateDto, +): Promise { + return requestClient.put( + `/api/setting-management/settings/definitions/${name}`, + input, + ); +} diff --git a/apps/vben5/packages/@abp/settings/src/api/index.ts b/apps/vben5/packages/@abp/settings/src/api/index.ts new file mode 100644 index 000000000..523f55130 --- /dev/null +++ b/apps/vben5/packages/@abp/settings/src/api/index.ts @@ -0,0 +1,2 @@ +export * as settingDefinitionsApi from './definitions'; +export * as settingsApi from './settings'; diff --git a/apps/vben5/packages/@abp/settings/src/api/settings.ts b/apps/vben5/packages/@abp/settings/src/api/settings.ts new file mode 100644 index 000000000..81d4356ba --- /dev/null +++ b/apps/vben5/packages/@abp/settings/src/api/settings.ts @@ -0,0 +1,84 @@ +import type { ListResultDto } from '@abp/core'; + +import type { SettingGroup, SettingsUpdateInput } from '../types/settings'; + +import { requestClient } from '@abp/request'; + +/** + * 获取全局设置 + * @returns 设置数据传输对象列表 + */ +export function getGlobalSettingsApi(): Promise> { + return requestClient.get>( + `/api/setting-management/settings/by-global`, + ); +} + +/** + * 设置全局设置 + * @returns 设置数据传输对象列表 + */ +export function setGlobalSettingsApi( + input: SettingsUpdateInput, +): Promise { + return requestClient.put( + `/api/setting-management/settings/change-global`, + input, + ); +} + +/** + * 获取租户设置 + * @returns 设置数据传输对象列表 + */ +export function getTenantSettingsApi(): Promise> { + return requestClient.get>( + `/api/setting-management/settings/by-current-tenant`, + ); +} + +/** + * 设置租户设置 + * @returns 设置数据传输对象列表 + */ +export function setTenantSettingsApi( + input: SettingsUpdateInput, +): Promise { + return requestClient.put( + `/api/setting-management/settings/change-current-tenant`, + input, + ); +} +/** + * 获取用户设置 + * @returns 设置数据传输对象列表 + */ +export function getUserSettingsApi(): Promise> { + return requestClient.get>( + `/api/setting-management/settings/by-current-user`, + ); +} + +/** + * 设置用户设置 + * @returns 设置数据传输对象列表 + */ +export function setUserSettingsApi(input: SettingsUpdateInput): Promise { + return requestClient.put( + `/api/setting-management/settings/change-current-user`, + input, + ); +} + +/** + * 发送测试邮件 + * @param emailAddress 邮件接收方地址 + */ +export const sendTestEmailApi = (emailAddress: string) => { + return requestClient.post( + `/api/setting-management/settings/send-test-email`, + { + emailAddress, + }, + ); +}; diff --git a/apps/vben5/packages/@abp/settings/src/components/definitions/SettingDefinitionModal.vue b/apps/vben5/packages/@abp/settings/src/components/definitions/SettingDefinitionModal.vue new file mode 100644 index 000000000..475674827 --- /dev/null +++ b/apps/vben5/packages/@abp/settings/src/components/definitions/SettingDefinitionModal.vue @@ -0,0 +1,236 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + {{ $t('AbpSettingManagement.DisplayName:IsInherited') }} + + + + + {{ $t('AbpSettingManagement.DisplayName:IsEncrypted') }} + + + + + {{ $t('AbpSettingManagement.DisplayName:IsVisibleToClients') }} + + + + + + + + + + + + + diff --git a/apps/vben5/packages/@abp/settings/src/components/definitions/SettingDefinitionTable.vue b/apps/vben5/packages/@abp/settings/src/components/definitions/SettingDefinitionTable.vue new file mode 100644 index 000000000..8cfe20b3d --- /dev/null +++ b/apps/vben5/packages/@abp/settings/src/components/definitions/SettingDefinitionTable.vue @@ -0,0 +1,219 @@ + + + + + + + {{ $t('AbpSettingManagement.Definition:AddNew') }} + + + + + + + {{ $t('AbpUi.Edit') }} + + + + + {{ $t('AbpUi.Delete') }} + + + + + + onGet()" /> + + + diff --git a/apps/vben5/packages/@abp/settings/src/components/index.ts b/apps/vben5/packages/@abp/settings/src/components/index.ts new file mode 100644 index 000000000..aaa211b75 --- /dev/null +++ b/apps/vben5/packages/@abp/settings/src/components/index.ts @@ -0,0 +1,3 @@ +export { default as SettingDefinitionTable } from './definitions/SettingDefinitionTable.vue'; +export { default as SystemSetting } from './settings/SystemSetting.vue'; +export { default as UserSetting } from './settings/UserSetting.vue'; diff --git a/apps/vben5/packages/@abp/settings/src/components/settings/SettingForm.vue b/apps/vben5/packages/@abp/settings/src/components/settings/SettingForm.vue new file mode 100644 index 000000000..1100322f7 --- /dev/null +++ b/apps/vben5/packages/@abp/settings/src/components/settings/SettingForm.vue @@ -0,0 +1,214 @@ + + + + + + + {{ $t('AbpUi.Submit') }} + + + + + + + + + + + + + + + + + + + {{ option.name }} + + + + {{ detail.displayName }} + + + + + + + + + + + + diff --git a/apps/vben5/packages/@abp/settings/src/components/settings/SystemSetting.vue b/apps/vben5/packages/@abp/settings/src/components/settings/SystemSetting.vue new file mode 100644 index 000000000..4c8621385 --- /dev/null +++ b/apps/vben5/packages/@abp/settings/src/components/settings/SystemSetting.vue @@ -0,0 +1,91 @@ + + + + + + + + + + {{ $t('AbpSettingManagement.Send') }} + + + + + + + + + diff --git a/apps/vben5/packages/@abp/settings/src/components/settings/UserSetting.vue b/apps/vben5/packages/@abp/settings/src/components/settings/UserSetting.vue new file mode 100644 index 000000000..2bb156214 --- /dev/null +++ b/apps/vben5/packages/@abp/settings/src/components/settings/UserSetting.vue @@ -0,0 +1,25 @@ + + + + + + + diff --git a/apps/vben5/packages/@abp/settings/src/constants/index.ts b/apps/vben5/packages/@abp/settings/src/constants/index.ts new file mode 100644 index 000000000..c85954d3e --- /dev/null +++ b/apps/vben5/packages/@abp/settings/src/constants/index.ts @@ -0,0 +1 @@ +export * from './permissions'; diff --git a/apps/vben5/packages/@abp/settings/src/constants/permissions.ts b/apps/vben5/packages/@abp/settings/src/constants/permissions.ts new file mode 100644 index 000000000..0ab2b3558 --- /dev/null +++ b/apps/vben5/packages/@abp/settings/src/constants/permissions.ts @@ -0,0 +1,10 @@ +/** 设置定义权限 */ +export const SettingDefinitionsPermissions = { + /** 新增 */ + Create: 'SettingManagement.Definition.Create', + Default: 'SettingManagement.Definition', + /** 还原或删除 */ + DeleteOrRestore: 'SettingManagement.Definition.DeleteOrRestore', + /** 更新 */ + Update: 'SettingManagement.Definition.Update', +}; diff --git a/apps/vben5/packages/@abp/settings/src/index.ts b/apps/vben5/packages/@abp/settings/src/index.ts new file mode 100644 index 000000000..314dad0cd --- /dev/null +++ b/apps/vben5/packages/@abp/settings/src/index.ts @@ -0,0 +1,3 @@ +export * from './api'; +export * from './components'; +export * from './types'; diff --git a/apps/vben5/packages/@abp/settings/src/types/definitions.ts b/apps/vben5/packages/@abp/settings/src/types/definitions.ts new file mode 100644 index 000000000..92c793247 --- /dev/null +++ b/apps/vben5/packages/@abp/settings/src/types/definitions.ts @@ -0,0 +1,48 @@ +import type { + ExtensibleObject, + IHasConcurrencyStamp, + IHasExtraProperties, +} from '@abp/core'; + +interface SettingDefinitionDto extends ExtensibleObject { + defaultValue?: string; + description?: string; + displayName: string; + isEncrypted: boolean; + isInherited: boolean; + isStatic: boolean; + isVisibleToClients: boolean; + name: string; + providers: string[]; +} + +interface SettingDefinitionGetListInput { + filter?: string; + providerName?: string; +} + +interface SettingDefinitionCreateOrUpdateDto + extends IHasConcurrencyStamp, + IHasExtraProperties { + defaultValue?: string; + description?: string; + displayName: string; + isEncrypted: boolean; + isInherited: boolean; + isVisibleToClients: boolean; + providers: string[]; +} + +interface SettingDefinitionCreateDto + extends SettingDefinitionCreateOrUpdateDto { + name: string; +} + +type SettingDefinitionUpdateDto = SettingDefinitionCreateOrUpdateDto; + +export type { + SettingDefinitionCreateDto, + SettingDefinitionDto, + SettingDefinitionGetListInput, + SettingDefinitionUpdateDto, +}; diff --git a/apps/vben5/packages/@abp/settings/src/types/index.ts b/apps/vben5/packages/@abp/settings/src/types/index.ts new file mode 100644 index 000000000..f7366dc9f --- /dev/null +++ b/apps/vben5/packages/@abp/settings/src/types/index.ts @@ -0,0 +1,2 @@ +export * from './definitions'; +export * from './settings'; diff --git a/apps/vben5/packages/@abp/settings/src/types/settings.ts b/apps/vben5/packages/@abp/settings/src/types/settings.ts new file mode 100644 index 000000000..b29cb6a0b --- /dev/null +++ b/apps/vben5/packages/@abp/settings/src/types/settings.ts @@ -0,0 +1,56 @@ +interface SettingBase { + /** 名称 */ + name: string; + /** 当前设置值 */ + value: string; +} + +/** 配置变更对象 */ +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 { Setting, SettingDetail, SettingGroup, SettingsUpdateInput }; diff --git a/apps/vben5/packages/@abp/settings/tsconfig.json b/apps/vben5/packages/@abp/settings/tsconfig.json new file mode 100644 index 000000000..ce1a891fb --- /dev/null +++ b/apps/vben5/packages/@abp/settings/tsconfig.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://json.schemastore.org/tsconfig", + "extends": "@vben/tsconfig/web.json", + "include": ["src"], + "exclude": ["node_modules"] +}