From 19fe1b05ebb37fda2492e9c693b23c407b716f9f Mon Sep 17 00:00:00 2001 From: AN <1983933789@qq.com> Date: Sun, 27 Apr 2025 14:53:55 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AF=B9=E6=8E=A5OSS=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/locales/langs/en-us.ts | 3 +- src/locales/langs/zh-cn.ts | 3 +- src/router/elegant/imports.ts | 1 + src/router/elegant/routes.ts | 11 + src/router/elegant/transform.ts | 1 + src/router/routes/index.ts | 25 ++ src/service/api/system/oss-config.ts | 45 ++++ src/typings/api/system.api.d.ts | 62 +++++ src/typings/elegant-router.d.ts | 6 +- src/views/system/oss-config/index.vue | 249 ++++++++++++++++++ .../modules/oss-config-operate-drawer.vue | 245 +++++++++++++++++ .../oss-config/modules/oss-config-search.vue | 83 ++++++ src/views/system/oss/index.vue | 11 +- 13 files changed, 738 insertions(+), 7 deletions(-) create mode 100644 src/service/api/system/oss-config.ts create mode 100644 src/views/system/oss-config/index.vue create mode 100644 src/views/system/oss-config/modules/oss-config-operate-drawer.vue create mode 100644 src/views/system/oss-config/modules/oss-config-search.vue diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index 9076000d..719cc82c 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -184,7 +184,8 @@ const local: App.I18n.Schema = { system_client: 'Client Management', system_notice: 'Notice Management', 'social-callback': 'Social Callback', - system_oss: 'File Management' + system_oss: 'File Management', + 'system_oss-config': 'OSS Config' }, page: { login: { diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 377bf5e0..cc687434 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -184,7 +184,8 @@ const local: App.I18n.Schema = { system_client: '客户端管理', system_notice: '通知公告', 'social-callback': '单点登录回调', - system_oss: '文件管理' + system_oss: '文件管理', + 'system_oss-config': 'OSS配置' }, page: { login: { diff --git a/src/router/elegant/imports.ts b/src/router/elegant/imports.ts index 29b71b19..594cee43 100644 --- a/src/router/elegant/imports.ts +++ b/src/router/elegant/imports.ts @@ -32,6 +32,7 @@ export const views: Record Promise import("@/views/system/dict/type/index.vue"), system_menu: () => import("@/views/system/menu/index.vue"), system_notice: () => import("@/views/system/notice/index.vue"), + "system_oss-config": () => import("@/views/system/oss-config/index.vue"), system_oss: () => import("@/views/system/oss/index.vue"), system_post: () => import("@/views/system/post/index.vue"), system_tenant: () => import("@/views/system/tenant/index.vue"), diff --git a/src/router/elegant/routes.ts b/src/router/elegant/routes.ts index 2f9938ff..12c770b1 100644 --- a/src/router/elegant/routes.ts +++ b/src/router/elegant/routes.ts @@ -211,6 +211,17 @@ export const generatedRoutes: GeneratedRoute[] = [ i18nKey: 'route.system_oss' } }, + { + name: 'system_oss-config', + path: '/oss-config', + component: 'view.system_oss-config', + meta: { + title: 'system_oss-config', + i18nKey: 'route.system_oss-config', + constant: true, + hideInMenu: true + } + }, { name: 'system_post', path: '/system/post', diff --git a/src/router/elegant/transform.ts b/src/router/elegant/transform.ts index a80a503a..f8366218 100644 --- a/src/router/elegant/transform.ts +++ b/src/router/elegant/transform.ts @@ -183,6 +183,7 @@ const routeMap: RouteMap = { "system_menu": "/system/menu", "system_notice": "/system/notice", "system_oss": "/system/oss", + "system_oss-config": "/oss-config", "system_post": "/system/post", "system_tenant": "/system/tenant", "system_user": "/system/user", diff --git a/src/router/routes/index.ts b/src/router/routes/index.ts index fdc4afc0..8b245913 100644 --- a/src/router/routes/index.ts +++ b/src/router/routes/index.ts @@ -112,6 +112,31 @@ const dynamicConstantRoutes: ElegantRoute[] = [ hideInMenu: true, icon: 'simple-icons:authy' } + }, + { + name: 'system', + path: '/system', + component: 'layout.base', + meta: { + title: 'system', + i18nKey: 'route.system', + localIcon: 'menu-system', + order: 1 + }, + children: [ + { + name: 'system_oss-config', + path: '/oss-config', + component: 'view.system_oss-config', + meta: { + title: 'system_oss-config', + i18nKey: 'route.system_oss-config', + constant: true, + hideInMenu: true, + icon: 'hugeicons:configuration-01' + } + } + ] } ]; diff --git a/src/service/api/system/oss-config.ts b/src/service/api/system/oss-config.ts new file mode 100644 index 00000000..a59740f1 --- /dev/null +++ b/src/service/api/system/oss-config.ts @@ -0,0 +1,45 @@ +import { request } from '@/service/request'; + +/** 获取OSS配置列表 */ +export function fetchGetOssConfigList(params?: Api.System.OssConfigSearchParams) { + return request({ + url: '/resource/oss/config/list', + method: 'get', + params + }); +} + +/** 新增OSS配置 */ +export function fetchCreateOssConfig(data: Api.System.OssConfigOperateParams) { + return request({ + url: '/resource/oss/config', + method: 'post', + data + }); +} + +/** 修改OSS配置 */ +export function fetchUpdateOssConfig(data: Api.System.OssConfigOperateParams) { + return request({ + url: '/resource/oss/config', + method: 'put', + data + }); +} + +/** 批量删除OSS配置 */ +export function fetchBatchDeleteOssConfig(ossConfigIds: CommonType.IdType[]) { + return request({ + url: `/resource/oss/config/${ossConfigIds.join(',')}`, + method: 'delete' + }); +} + +/** 状态修改 */ +export function fetchUpdateOssConfigStatus(data: Api.System.OssConfigOperateParams) { + return request({ + url: '/resource/oss/config/changeStatus', + method: 'put', + data + }); +} diff --git a/src/typings/api/system.api.d.ts b/src/typings/api/system.api.d.ts index 0c427c96..9c238776 100644 --- a/src/typings/api/system.api.d.ts +++ b/src/typings/api/system.api.d.ts @@ -642,5 +642,67 @@ declare namespace Api { /** oss list */ type OssList = Api.Common.PaginatingQueryRecord; + + /** oss config */ + type OssConfig = Common.CommonRecord<{ + /** 主键 */ + ossConfigId: CommonType.IdType; + /** 租户编号 */ + tenantId: CommonType.IdType; + /** 配置名称 */ + configKey: string; + /** accessKey */ + accessKey: string; + /** 秘钥secretKey */ + secretKey: string; + /** 桶名称 */ + bucketName: string; + /** 前缀 */ + prefix: string; + /** 访问站点 */ + endpoint: string; + /** 自定义域名 */ + domain: string; + /** 是否https(Y=是,N=否) */ + isHttps: string; + /** 域 */ + region: string; + /** 桶权限类型 */ + accessPolicy: string; + /** 是否默认(0=是,1=否) */ + status: string; + /** 扩展字段 */ + ext1: string; + /** 备注 */ + remark: string; + }>; + + /** oss config search params */ + type OssConfigSearchParams = CommonType.RecordNullable< + Pick & Api.Common.CommonSearchParams + >; + + /** oss config operate params */ + type OssConfigOperateParams = CommonType.RecordNullable< + Pick< + Api.System.OssConfig, + | 'ossConfigId' + | 'configKey' + | 'accessKey' + | 'secretKey' + | 'bucketName' + | 'prefix' + | 'endpoint' + | 'domain' + | 'isHttps' + | 'region' + | 'accessPolicy' + | 'status' + | 'remark' + > + >; + + /** oss config list */ + type OssConfigList = Api.Common.PaginatingQueryRecord; } } diff --git a/src/typings/elegant-router.d.ts b/src/typings/elegant-router.d.ts index 3ebcb8cc..d1458956 100644 --- a/src/typings/elegant-router.d.ts +++ b/src/typings/elegant-router.d.ts @@ -37,6 +37,7 @@ declare module "@elegant-router/types" { "system_menu": "/system/menu"; "system_notice": "/system/notice"; "system_oss": "/system/oss"; + "system_oss-config": "/oss-config"; "system_post": "/system/post"; "system_tenant": "/system/tenant"; "system_user": "/system/user"; @@ -117,6 +118,7 @@ declare module "@elegant-router/types" { | "system_menu" | "system_notice" | "system_oss" + | "system_oss-config" | "system_post" | "system_tenant" | "system_user" @@ -192,7 +194,7 @@ declare module "@elegant-router/types" { component: `view.${K}`; } : never; - + /** * the center level route */ @@ -215,7 +217,7 @@ declare module "@elegant-router/types" { children: (CenterLevelRoute> | LastLevelRoute>)[]; } : never; - + /** * the custom first level route */ diff --git a/src/views/system/oss-config/index.vue b/src/views/system/oss-config/index.vue new file mode 100644 index 00000000..0679f65e --- /dev/null +++ b/src/views/system/oss-config/index.vue @@ -0,0 +1,249 @@ + + + + + diff --git a/src/views/system/oss-config/modules/oss-config-operate-drawer.vue b/src/views/system/oss-config/modules/oss-config-operate-drawer.vue new file mode 100644 index 00000000..c7a1f2de --- /dev/null +++ b/src/views/system/oss-config/modules/oss-config-operate-drawer.vue @@ -0,0 +1,245 @@ + + + + + diff --git a/src/views/system/oss-config/modules/oss-config-search.vue b/src/views/system/oss-config/modules/oss-config-search.vue new file mode 100644 index 00000000..25667727 --- /dev/null +++ b/src/views/system/oss-config/modules/oss-config-search.vue @@ -0,0 +1,83 @@ + + + + + diff --git a/src/views/system/oss/index.vue b/src/views/system/oss/index.vue index 5bc9a2fd..648dc6de 100644 --- a/src/views/system/oss/index.vue +++ b/src/views/system/oss/index.vue @@ -8,24 +8,25 @@ import { useAppStore } from '@/store/modules/app'; import { useTable, useTableOperate } from '@/hooks/common/table'; import { useAuth } from '@/hooks/business/auth'; import { useDownload } from '@/hooks/business/download'; +import { useRouterPush } from '@/hooks/common/router'; import { isImage } from '@/utils/common'; import { $t } from '@/locales'; import ButtonIcon from '@/components/custom/button-icon.vue'; import OssSearch from './modules/oss-search.vue'; import OssUploadModal from './modules/oss-upload-modal.vue'; - defineOptions({ name: 'OssList' }); +const { routerPushByKey } = useRouterPush(); const { hasAuth } = useAuth(); const { oss } = useDownload(); const appStore = useAppStore(); + const fileUploadType = ref<'file' | 'image'>('file'); const { bool: preview, setBool: setPreview } = useBoolean(true); const { loading: previewLoading, startLoading: startPreviewLoading, endLoading: endPreviewLoading } = useLoading(false); const { bool: uploadVisible, setTrue: showFUploadModal } = useBoolean(false); - const { columns, columnChecks, @@ -229,6 +230,10 @@ async function handleUpdatePreview(checked: boolean) { } }); } + +function handleToOssConfig() { + routerPushByKey('system_oss-config'); +} 上传图片 - +