Skip to content

Commit cd88d9d

Browse files
fix: router
1 parent 2cbd8af commit cd88d9d

File tree

1 file changed

+116
-54
lines changed

1 file changed

+116
-54
lines changed

ui/src/router/modules/system.ts

Lines changed: 116 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
import {PermissionConst, EditionConst, RoleConst} from '@/utils/permission/data'
2-
import {ComplexPermission} from '@/utils/permission/type'
1+
import { PermissionConst, EditionConst, RoleConst } from '@/utils/permission/data'
2+
import { ComplexPermission } from '@/utils/permission/type'
33

44
const systemRouter = {
55
path: '/system',
66
name: 'system',
7-
meta: {title: 'views.system.title'},
7+
meta: { title: 'views.system.title' },
88
hidden: true,
99
component: () => import('@/layout/layout-template/SystemMainLayout.vue'),
1010
children: [
@@ -24,49 +24,50 @@ const systemRouter = {
2424
component: () => import('@/views/system/user-manage/index.vue'),
2525
},
2626
{
27-
path: '/system/role',
28-
name: 'role',
27+
path: '/system/workspace',
28+
name: 'workspace',
2929
meta: {
30-
icon: 'app-role',
31-
iconActive: 'app-role-active',
32-
title: 'views.role.title',
30+
icon: 'app-workspace',
31+
iconActive: 'app-workspace-active',
32+
title: 'views.workspace.title',
3333
activeMenu: '/system',
3434
parentPath: '/system',
3535
parentName: 'system',
36-
sameRoute: 'role',
36+
sameRoute: 'workspace',
3737
permission: [
3838
new ComplexPermission(
39-
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
40-
[PermissionConst.ROLE_READ, PermissionConst.WORKSPACE_ROLE_READ],
41-
[EditionConst.IS_EE, EditionConst.IS_PE],
39+
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
40+
[PermissionConst.WORKSPACE_WORKSPACE_READ, PermissionConst.WORKSPACE_READ],
41+
[EditionConst.IS_EE],
4242
'OR',
4343
),
4444
],
4545
},
46-
component: () => import('@/views/system/role/index.vue'),
46+
component: () => import('@/views/system/workspace/index.vue'),
4747
},
4848
{
49-
path: '/system/workspace',
50-
name: 'workspace',
49+
path: '/system/role',
50+
name: 'role',
5151
meta: {
52-
icon: 'app-workspace',
53-
iconActive: 'app-workspace-active',
54-
title: 'views.workspace.title',
52+
icon: 'app-role',
53+
iconActive: 'app-role-active',
54+
title: 'views.role.title',
5555
activeMenu: '/system',
5656
parentPath: '/system',
5757
parentName: 'system',
58-
sameRoute: 'workspace',
58+
sameRoute: 'role',
5959
permission: [
6060
new ComplexPermission(
61-
[RoleConst.WORKSPACE_MANAGE, RoleConst.ADMIN],
62-
[PermissionConst.WORKSPACE_WORKSPACE_READ, PermissionConst.WORKSPACE_READ],
63-
[EditionConst.IS_EE],
61+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE.getWorkspaceRole],
62+
[PermissionConst.ROLE_READ, PermissionConst.WORKSPACE_ROLE_READ],
63+
[EditionConst.IS_EE, EditionConst.IS_PE],
6464
'OR',
6565
),
6666
],
6767
},
68-
component: () => import('@/views/system/workspace/index.vue'),
68+
component: () => import('@/views/system/role/index.vue'),
6969
},
70+
7071
{
7172
path: '/system/resource-management',
7273
name: 'resourceManagement',
@@ -123,7 +124,8 @@ const systemRouter = {
123124
),
124125
],
125126
},
126-
component: () => import('@/views/system-resource-management/ApplicationResourceIndex.vue'),
127+
component: () =>
128+
import('@/views/system-resource-management/ApplicationResourceIndex.vue'),
127129
},
128130
{
129131
path: '/system/resource-management/knowledge',
@@ -197,18 +199,47 @@ const systemRouter = {
197199
parentPath: '/system',
198200
parentName: 'system',
199201
sameRoute: 'authorization',
200-
permission: [new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
201-
[PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
202-
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole], [], 'OR'),
203-
new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
204-
[PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
205-
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole], [], 'OR'),
206-
new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
207-
[PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
208-
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole], [], 'OR'),
209-
new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
210-
[PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
211-
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole], [], 'OR'),
202+
permission: [
203+
new ComplexPermission(
204+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
205+
[
206+
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
207+
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ
208+
.getWorkspacePermissionWorkspaceManageRole,
209+
],
210+
[],
211+
'OR',
212+
),
213+
new ComplexPermission(
214+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
215+
[
216+
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
217+
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ
218+
.getWorkspacePermissionWorkspaceManageRole,
219+
],
220+
[],
221+
'OR',
222+
),
223+
new ComplexPermission(
224+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
225+
[
226+
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
227+
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ
228+
.getWorkspacePermissionWorkspaceManageRole,
229+
],
230+
[],
231+
'OR',
232+
),
233+
new ComplexPermission(
234+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
235+
[
236+
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
237+
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ
238+
.getWorkspacePermissionWorkspaceManageRole,
239+
],
240+
[],
241+
'OR',
242+
),
212243
],
213244
},
214245

@@ -223,9 +254,18 @@ const systemRouter = {
223254
parentName: 'system',
224255
resource: 'APPLICATION',
225256
sameRoute: 'authorization',
226-
permission: [new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
227-
[PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
228-
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole], [], 'OR'),]
257+
permission: [
258+
new ComplexPermission(
259+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
260+
[
261+
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
262+
PermissionConst.APPLICATION_WORKSPACE_USER_RESOURCE_PERMISSION_READ
263+
.getWorkspacePermissionWorkspaceManageRole,
264+
],
265+
[],
266+
'OR',
267+
),
268+
],
229269
},
230270
component: () => import('@/views/system/resource-authorization/index.vue'),
231271
},
@@ -239,9 +279,18 @@ const systemRouter = {
239279
parentName: 'system',
240280
resource: 'KNOWLEDGE',
241281
sameRoute: 'authorization',
242-
permission: [new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
243-
[PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
244-
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole], [], 'OR'),]
282+
permission: [
283+
new ComplexPermission(
284+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
285+
[
286+
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
287+
PermissionConst.KNOWLEDGE_WORKSPACE_USER_RESOURCE_PERMISSION_READ
288+
.getWorkspacePermissionWorkspaceManageRole,
289+
],
290+
[],
291+
'OR',
292+
),
293+
],
245294
},
246295
component: () => import('@/views/system/resource-authorization/index.vue'),
247296
},
@@ -255,9 +304,18 @@ const systemRouter = {
255304
parentName: 'system',
256305
resource: 'TOOL',
257306
sameRoute: 'authorization',
258-
permission: [new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
259-
[PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
260-
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole], [], 'OR'),]
307+
permission: [
308+
new ComplexPermission(
309+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
310+
[
311+
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
312+
PermissionConst.TOOL_WORKSPACE_USER_RESOURCE_PERMISSION_READ
313+
.getWorkspacePermissionWorkspaceManageRole,
314+
],
315+
[],
316+
'OR',
317+
),
318+
],
261319
},
262320
component: () => import('@/views/system/resource-authorization/index.vue'),
263321
},
@@ -271,9 +329,18 @@ const systemRouter = {
271329
parentName: 'system',
272330
resource: 'MODEL',
273331
sameRoute: 'authorization',
274-
permission: [new ComplexPermission([RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
275-
[PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
276-
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ.getWorkspacePermissionWorkspaceManageRole], [], 'OR'),]
332+
permission: [
333+
new ComplexPermission(
334+
[RoleConst.ADMIN, RoleConst.WORKSPACE_MANAGE],
335+
[
336+
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ,
337+
PermissionConst.MODEL_WORKSPACE_USER_RESOURCE_PERMISSION_READ
338+
.getWorkspacePermissionWorkspaceManageRole,
339+
],
340+
[],
341+
'OR',
342+
),
343+
],
277344
},
278345
component: () => import('@/views/system/resource-authorization/index.vue'),
279346
},
@@ -488,12 +555,7 @@ const systemRouter = {
488555
[EditionConst.IS_EE, EditionConst.IS_PE],
489556
'OR',
490557
),
491-
new ComplexPermission(
492-
[RoleConst.ADMIN],
493-
[PermissionConst.EMAIL_SETTING_READ],
494-
[],
495-
'OR',
496-
),
558+
new ComplexPermission([RoleConst.ADMIN], [PermissionConst.EMAIL_SETTING_READ], [], 'OR'),
497559
],
498560
},
499561
children: [

0 commit comments

Comments
 (0)