From 683b0bcf180907a4a3a22ab169d8b328012c8208 Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Thu, 26 Jun 2025 14:32:03 +0800 Subject: [PATCH] feat: role --- ui/src/components/app-icon/icons/menu.ts | 68 +++++ ui/src/components/common-list/index.vue | 5 +- ui/src/router/modules/system.ts | 20 +- ui/src/styles/app.scss | 1 - .../system/role/component/AddMemberDrawer.vue | 10 +- ui/src/views/system/role/component/Member.vue | 30 +- .../role/component/MemberFormContent.vue | 2 +- .../component/PermissionConfiguration.vue | 111 +++++--- ui/src/views/system/role/index.vue | 269 +++++++++--------- 9 files changed, 306 insertions(+), 210 deletions(-) diff --git a/ui/src/components/app-icon/icons/menu.ts b/ui/src/components/app-icon/icons/menu.ts index 40eea6d54..8b692d196 100644 --- a/ui/src/components/app-icon/icons/menu.ts +++ b/ui/src/components/app-icon/icons/menu.ts @@ -142,4 +142,72 @@ export default { ]) }, }, + 'app-role': { + iconReader: () => { + return h('i', [ + h( + 'svg', + { + viewBox: '0 0 20 20', + version: '1.1', + xmlns: 'http://www.w3.org/2000/svg', + }, + [ + h('path', { + d: 'M12.5 4.16667C11.35 4.16667 10.4167 5.09958 10.4167 6.25C10.4167 7.40042 11.35 8.33333 12.5 8.33333C13.65 8.33333 14.5833 7.40042 14.5833 6.25C14.5833 5.09958 13.65 4.16667 12.5 4.16667ZM8.75 6.25C8.75 4.17875 10.4292 2.5 12.5 2.5C14.5708 2.5 16.25 4.17875 16.25 6.25C16.25 8.32125 14.5708 10 12.5 10C10.4292 10 8.75 8.32125 8.75 6.25ZM10.2792 12.5C8.7625 12.5 7.5 13.7488 7.5 15.3333V16.6667H17.5V15.3333C17.5 13.7488 16.2375 12.5 14.7208 12.5H10.2792ZM5.83333 15.3333C5.83333 12.8479 7.825 10.8333 10.2792 10.8333H14.7208C17.175 10.8333 19.1667 12.8479 19.1667 15.3333V17.5833C19.1667 17.9975 18.8333 18.3333 18.425 18.3333H6.575C6.16667 18.3333 5.83333 17.9975 5.83333 17.5833V15.3333Z', + fill: 'currentColor', + }), + h('path', { + d: 'M7.08333 4.99998H2.5V16.6666H3.75C3.98012 16.6666 4.16667 16.8532 4.16667 17.0833V17.9166C4.16667 18.1468 3.98012 18.3333 3.75 18.3333H1.94036C1.25 18.3333 0.833334 17.9166 0.833334 17.0833V4.44034C0.833334 3.74998 1.25 3.33331 1.94036 3.33331H7.08333C7.31345 3.33331 7.5 3.51986 7.5 3.74998V4.58331C7.5 4.81343 7.31345 4.99998 7.08333 4.99998Z', + fill: 'currentColor', + }), + h('path', { + d: 'M3.66667 7.49998H7.16667C7.25507 7.49998 7.33986 7.54388 7.40237 7.62202C7.46488 7.70016 7.5 7.80614 7.5 7.91665V8.74998C7.5 8.86049 7.46488 8.96647 7.40237 9.04461C7.33986 9.12275 7.25507 9.16665 7.16667 9.16665H3.66667C3.57826 9.16665 3.49348 9.12275 3.43097 9.04461C3.36845 8.96647 3.33333 8.86049 3.33333 8.74998V7.91665C3.33333 7.80614 3.36845 7.70016 3.43097 7.62202C3.49348 7.54388 3.57826 7.49998 3.66667 7.49998Z', + fill: 'currentColor', + }), + h('path', { + d: 'M3.58333 9.99998H5.58333C5.64964 9.99998 5.71323 10.0439 5.76011 10.122C5.80699 10.2002 5.83333 10.3061 5.83333 10.4166V11.25C5.83333 11.3605 5.80699 11.4665 5.76011 11.5446C5.71323 11.6227 5.64964 11.6666 5.58333 11.6666H3.58333C3.51703 11.6666 3.45344 11.6227 3.40656 11.5446C3.35967 11.4665 3.33333 11.3605 3.33333 11.25V10.4166C3.33333 10.3061 3.35967 10.2002 3.40656 10.122C3.45344 10.0439 3.51703 9.99998 3.58333 9.99998Z', + fill: 'currentColor', + }), + ], + ), + ]) + }, + }, + 'app-role-active': { + iconReader: () => { + return h('i', [ + h( + 'svg', + { + viewBox: '0 0 20 20', + version: '1.1', + xmlns: 'http://www.w3.org/2000/svg', + }, + [ + h('path', { + d: 'M12.5 2.5C10.4292 2.5 8.75 4.17875 8.75 6.25C8.75 8.32125 10.4292 10 12.5 10C14.5708 10 16.25 8.32125 16.25 6.25C16.25 4.17875 14.5708 2.5 12.5 2.5Z', + fill: 'currentColor', + }), + h('path', { + d: 'M10.2792 10.8333C7.825 10.8333 5.83333 12.8479 5.83333 15.3333V17.5833C5.83333 17.9975 6.16667 18.3333 6.575 18.3333H18.425C18.8333 18.3333 19.1667 17.9975 19.1667 17.5833V15.3333C19.1667 12.8479 17.175 10.8333 14.7208 10.8333H10.2792Z', + fill: 'currentColor', + }), + h('path', { + d: 'M7.08333 4.99998H2.5V16.6666H3.75C3.98012 16.6666 4.16667 16.8532 4.16667 17.0833V17.9166C4.16667 18.1468 3.98012 18.3333 3.75 18.3333H1.94036C1.25 18.3333 0.833334 17.9166 0.833334 17.0833V4.44034C0.833334 3.74998 1.25 3.33331 1.94036 3.33331H7.08333C7.31345 3.33331 7.5 3.51986 7.5 3.74998V4.58331C7.5 4.81343 7.31345 4.99998 7.08333 4.99998Z', + fill: 'currentColor', + }), + h('path', { + d: 'M3.66667 7.49998H7.16667C7.25507 7.49998 7.33986 7.54388 7.40237 7.62202C7.46488 7.70016 7.5 7.80614 7.5 7.91665V8.74998C7.5 8.86049 7.46488 8.96647 7.40237 9.04461C7.33986 9.12275 7.25507 9.16665 7.16667 9.16665H3.66667C3.57826 9.16665 3.49348 9.12275 3.43097 9.04461C3.36845 8.96647 3.33333 8.86049 3.33333 8.74998V7.91665C3.33333 7.80614 3.36845 7.70016 3.43097 7.62202C3.49348 7.54388 3.57826 7.49998 3.66667 7.49998Z', + fill: 'currentColor', + }), + h('path', { + d: 'M3.58333 9.99998H5.58333C5.64964 9.99998 5.71323 10.0439 5.76011 10.122C5.80699 10.2002 5.83333 10.3061 5.83333 10.4166V11.25C5.83333 11.3605 5.80699 11.4665 5.76011 11.5446C5.71323 11.6227 5.64964 11.6666 5.58333 11.6666H3.58333C3.51703 11.6666 3.45344 11.6227 3.40656 11.5446C3.35967 11.4665 3.33333 11.3605 3.33333 11.25V10.4166C3.33333 10.3061 3.35967 10.2002 3.40656 10.122C3.45344 10.0439 3.51703 9.99998 3.58333 9.99998Z', + fill: 'currentColor', + }), + ], + ), + ]) + }, + }, } diff --git a/ui/src/components/common-list/index.vue b/ui/src/components/common-list/index.vue index 28e16500f..95d4cc343 100644 --- a/ui/src/components/common-list/index.vue +++ b/ui/src/components/common-list/index.vue @@ -71,11 +71,12 @@ defineExpose({ /* 通用 ui li样式 */ .common-list { li { - padding: 8px 16px; + padding: 8px; font-weight: 400; - color: var(--el-text-color-regular); font-size: 14px; margin-bottom: 4px; + min-height: 24px; + line-height: 24px; &.active { background: var(--el-color-primary-light-9); border-radius: 4px; diff --git a/ui/src/router/modules/system.ts b/ui/src/router/modules/system.ts index 9433bba00..d3c5c2c93 100644 --- a/ui/src/router/modules/system.ts +++ b/ui/src/router/modules/system.ts @@ -18,10 +18,7 @@ const systemRouter = { activeMenu: '/system', parentPath: '/system', parentName: 'system', - permission: [ - RoleConst.ADMIN, - PermissionConst.USER_READ - ], + permission: [RoleConst.ADMIN, PermissionConst.USER_READ], }, component: () => import('@/views/system/user-manage/index.vue'), }, @@ -29,8 +26,8 @@ const systemRouter = { path: '/system/role', name: 'role', meta: { - icon: 'app-resource-authorization', // TODO - iconActive: 'app-resource-authorization-active', // TODO + icon: 'app-role', + iconActive: 'app-role-active', title: 'views.role.title', activeMenu: '/system', parentPath: '/system', @@ -59,8 +56,9 @@ const systemRouter = { permission: [ new ComplexPermission( [RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN], - [PermissionConst.WORKSPACE_READ.getWorkspacePermissionWorkspaceManageRole, - PermissionConst.WORKSPACE_READ + [ + PermissionConst.WORKSPACE_READ.getWorkspacePermissionWorkspaceManageRole, + PermissionConst.WORKSPACE_READ, ], [EditionConst.IS_EE], 'OR', @@ -144,9 +142,9 @@ const systemRouter = { [RoleConst.ADMIN], [PermissionConst.SHARED_KNOWLEDGE_READ], [EditionConst.IS_EE], - 'OR' - ) - ] + 'OR', + ), + ], }, component: () => import('@/views/system-shared/KnowLedgeSharedIndex.vue'), }, diff --git a/ui/src/styles/app.scss b/ui/src/styles/app.scss index 7781c72bd..80a62cc1c 100644 --- a/ui/src/styles/app.scss +++ b/ui/src/styles/app.scss @@ -399,7 +399,6 @@ h5 { .color-secondary { color: var(--app-text-color-secondary); } - .color-input-placeholder { color: var(--app-input-color-placeholder); } diff --git a/ui/src/views/system/role/component/AddMemberDrawer.vue b/ui/src/views/system/role/component/AddMemberDrawer.vue index aa25539de..4707de94a 100644 --- a/ui/src/views/system/role/component/AddMemberDrawer.vue +++ b/ui/src/views/system/role/component/AddMemberDrawer.vue @@ -12,12 +12,10 @@ /> diff --git a/ui/src/views/system/role/component/Member.vue b/ui/src/views/system/role/component/Member.vue index 7460eeb9d..6fc09da04 100644 --- a/ui/src/views/system/role/component/Member.vue +++ b/ui/src/views/system/role/component/Member.vue @@ -1,9 +1,17 @@