Skip to content

Commit 683b0bc

Browse files
feat: role
1 parent bf4e98b commit 683b0bc

File tree

9 files changed

+306
-210
lines changed

9 files changed

+306
-210
lines changed

ui/src/components/app-icon/icons/menu.ts

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,4 +142,72 @@ export default {
142142
])
143143
},
144144
},
145+
'app-role': {
146+
iconReader: () => {
147+
return h('i', [
148+
h(
149+
'svg',
150+
{
151+
viewBox: '0 0 20 20',
152+
version: '1.1',
153+
xmlns: 'http://www.w3.org/2000/svg',
154+
},
155+
[
156+
h('path', {
157+
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',
158+
fill: 'currentColor',
159+
}),
160+
h('path', {
161+
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',
162+
fill: 'currentColor',
163+
}),
164+
h('path', {
165+
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',
166+
fill: 'currentColor',
167+
}),
168+
h('path', {
169+
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',
170+
fill: 'currentColor',
171+
}),
172+
],
173+
),
174+
])
175+
},
176+
},
177+
'app-role-active': {
178+
iconReader: () => {
179+
return h('i', [
180+
h(
181+
'svg',
182+
{
183+
viewBox: '0 0 20 20',
184+
version: '1.1',
185+
xmlns: 'http://www.w3.org/2000/svg',
186+
},
187+
[
188+
h('path', {
189+
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',
190+
fill: 'currentColor',
191+
}),
192+
h('path', {
193+
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',
194+
fill: 'currentColor',
195+
}),
196+
h('path', {
197+
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',
198+
fill: 'currentColor',
199+
}),
200+
h('path', {
201+
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',
202+
fill: 'currentColor',
203+
}),
204+
h('path', {
205+
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',
206+
fill: 'currentColor',
207+
}),
208+
],
209+
),
210+
])
211+
},
212+
},
145213
}

ui/src/components/common-list/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,12 @@ defineExpose({
7171
/* 通用 ui li样式 */
7272
.common-list {
7373
li {
74-
padding: 8px 16px;
74+
padding: 8px;
7575
font-weight: 400;
76-
color: var(--el-text-color-regular);
7776
font-size: 14px;
7877
margin-bottom: 4px;
78+
min-height: 24px;
79+
line-height: 24px;
7980
&.active {
8081
background: var(--el-color-primary-light-9);
8182
border-radius: 4px;

ui/src/router/modules/system.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,16 @@ const systemRouter = {
1818
activeMenu: '/system',
1919
parentPath: '/system',
2020
parentName: 'system',
21-
permission: [
22-
RoleConst.ADMIN,
23-
PermissionConst.USER_READ
24-
],
21+
permission: [RoleConst.ADMIN, PermissionConst.USER_READ],
2522
},
2623
component: () => import('@/views/system/user-manage/index.vue'),
2724
},
2825
{
2926
path: '/system/role',
3027
name: 'role',
3128
meta: {
32-
icon: 'app-resource-authorization', // TODO
33-
iconActive: 'app-resource-authorization-active', // TODO
29+
icon: 'app-role',
30+
iconActive: 'app-role-active',
3431
title: 'views.role.title',
3532
activeMenu: '/system',
3633
parentPath: '/system',
@@ -59,8 +56,9 @@ const systemRouter = {
5956
permission: [
6057
new ComplexPermission(
6158
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
62-
[PermissionConst.WORKSPACE_READ.getWorkspacePermissionWorkspaceManageRole,
63-
PermissionConst.WORKSPACE_READ
59+
[
60+
PermissionConst.WORKSPACE_READ.getWorkspacePermissionWorkspaceManageRole,
61+
PermissionConst.WORKSPACE_READ,
6462
],
6563
[EditionConst.IS_EE],
6664
'OR',
@@ -144,9 +142,9 @@ const systemRouter = {
144142
[RoleConst.ADMIN],
145143
[PermissionConst.SHARED_KNOWLEDGE_READ],
146144
[EditionConst.IS_EE],
147-
'OR'
148-
)
149-
]
145+
'OR',
146+
),
147+
],
150148
},
151149
component: () => import('@/views/system-shared/KnowLedgeSharedIndex.vue'),
152150
},

ui/src/styles/app.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ h5 {
399399
.color-secondary {
400400
color: var(--app-text-color-secondary);
401401
}
402-
403402
.color-input-placeholder {
404403
color: var(--app-input-color-placeholder);
405404
}

ui/src/views/system/role/component/AddMemberDrawer.vue

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@
1212
/>
1313
</template>
1414
<template #footer>
15-
<div style="flex: auto">
16-
<el-button @click="handleCancel">{{ $t('common.cancel') }}</el-button>
17-
<el-button type="primary" @click="handleAdd()" :loading="loading">
18-
{{ $t('common.add') }}
19-
</el-button>
20-
</div>
15+
<el-button @click="handleCancel">{{ $t('common.cancel') }}</el-button>
16+
<el-button type="primary" @click="handleAdd()" :loading="loading">
17+
{{ $t('common.add') }}
18+
</el-button>
2119
</template>
2220
</el-drawer>
2321
</template>

ui/src/views/system/role/component/Member.vue

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
<template>
22
<div class="p-24 pt-0">
33
<div class="flex-between mb-16">
4-
<el-button type="primary" @click="handleAdd"
5-
v-hasPermission="new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
6-
[PermissionConst.ROLE_ADD_MEMBER.getWorkspacePermission],[], 'OR')"
4+
<el-button
5+
type="primary"
6+
@click="handleAdd"
7+
v-hasPermission="
8+
new ComplexPermission(
9+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
10+
[PermissionConst.ROLE_ADD_MEMBER.getWorkspacePermission],
11+
[],
12+
'OR',
13+
)
14+
"
715
>
816
{{ $t('views.role.member.add') }}
917
</el-button>
@@ -43,10 +51,20 @@
4351
:content="`${$t('views.role.member.delete.button')}`"
4452
placement="top"
4553
>
46-
<el-button type="primary" text @click.stop="handleDelete(row)"
47-
v-hasPermission="new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
48-
[PermissionConst.ROLE_REMOVE_MEMBER.getWorkspacePermission],[], 'OR')"
54+
<el-button
55+
type="primary"
56+
text
57+
@click.stop="handleDelete(row)"
58+
v-hasPermission="
59+
new ComplexPermission(
60+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
61+
[PermissionConst.ROLE_REMOVE_MEMBER.getWorkspacePermission],
62+
[],
63+
'OR',
64+
)
65+
"
4966
>
67+
<!-- TODO: 删除图标需要换 -->
5068
<el-icon>
5169
<Delete />
5270
</el-icon>

ui/src/views/system/role/component/MemberFormContent.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</el-select>
1313
</el-form-item>
1414
<!-- 删除按钮 -->
15-
<el-button @click="handleDelete(index)"
15+
<el-button @click="handleDelete(index)" text
1616
:style="{ 'margin-top': index === 0 && props.models.some((item) => item.label) ? '30px' : '' }">
1717
<el-icon>
1818
<Delete />

0 commit comments

Comments
 (0)