1515 <div class =" user-left border-r" >
1616 <div class =" p-24 pb-0" >
1717 <h4 class =" medium mb-12" >{{ $t('views.chatUser.group.title') }}</h4 >
18- <el-input
19- v-model =" filterText"
20- :placeholder =" $t('common.search')"
21- prefix-icon =" Search"
22- clearable
23- />
18+ <el-input v-model =" filterText" :placeholder =" $t('common.search')" prefix-icon =" Search" clearable />
2419 </div >
2520 <div class =" list-height-left" >
2621 <el-scrollbar v-loading =" loading" >
2722 <div class =" p-16" >
28- <common-list
29- :data =" filterList"
30- @click =" clickUserGroup"
31- :default-active =" current?.id"
32- >
23+ <common-list :data =" filterList" @click =" clickUserGroup" :default-active =" current?.id" >
3324 <template #default =" { row } " >
3425 <span class =" ellipsis-1" :title =" row.name" >{{ row.name }}</span >
3526 </template >
5748 </span >
5849 </div >
5950
60- <div
61- class =" flex align-center"
62- v-if ="
63- route.path.includes('share/')
64- ? false
65- : hasPermission(permissionObj[currentPermissionKey], 'OR')
66- "
67- >
51+ <div class =" flex align-center" v-if ="
52+ route.path.includes('share/')
53+ ? false
54+ : permissionObj[currentPermissionKey]
55+ " >
6856 <div class =" color-secondary mr-8" >{{ $t('views.chatUser.autoAuthorization') }}</div >
69- <el-switch
70- size =" small"
71- :model-value =" current?.is_auth"
72- @click =" changeAuth"
73- :loading =" loading"
74- ></el-switch >
57+ <el-switch size =" small" :model-value =" current?.is_auth" @click =" changeAuth"
58+ :loading =" loading" ></el-switch >
7559 </div >
7660 </div >
7761
7862 <div class =" flex-between mb-16" style =" margin-top : 18px " >
7963 <div class =" flex complex-search" >
8064 <el-select class =" complex-search__left" v-model =" searchType" style =" width : 120px " >
8165 <el-option :label =" $t('views.login.loginForm.username.label')" value =" username" />
82- <el-option
83- :label =" $t('views.userManage.userForm.nick_name.label')"
84- value =" nick_name"
85- />
66+ <el-option :label =" $t('views.userManage.userForm.nick_name.label')" value =" nick_name" />
8667 <el-option :label =" $t('views.userManage.source.label')" value =" source" />
8768 </el-select >
88- <el-input
89- v-if =" searchType === 'username'"
90- v-model =" searchForm.username"
91- @change =" getList"
92- :placeholder =" $t('common.inputPlaceholder')"
93- style =" width : 220px "
94- clearable
95- />
96- <el-input
97- v-else-if =" searchType === 'nick_name'"
98- v-model =" searchForm.nick_name"
99- @change =" getList"
100- :placeholder =" $t('common.inputPlaceholder')"
101- style =" width : 220px "
102- clearable
103- />
104- <el-select
105- v-else-if =" searchType === 'source'"
106- v-model =" searchForm.source"
107- @change =" getList"
108- :placeholder =" $t('common.selectPlaceholder')"
109- style =" width : 220px "
110- clearable
111- >
69+ <el-input v-if =" searchType === 'username'" v-model =" searchForm.username" @change =" getList"
70+ :placeholder =" $t('common.inputPlaceholder')" style =" width : 220px " clearable />
71+ <el-input v-else-if =" searchType === 'nick_name'" v-model =" searchForm.nick_name" @change =" getList"
72+ :placeholder =" $t('common.inputPlaceholder')" style =" width : 220px " clearable />
73+ <el-select v-else-if =" searchType === 'source'" v-model =" searchForm.source" @change =" getList"
74+ :placeholder =" $t('common.selectPlaceholder')" style =" width : 220px " clearable >
11275 <el-option :label =" $t('views.userManage.source.local')" value =" LOCAL" />
11376 <el-option label =" CAS" value =" CAS" />
11477 <el-option label =" LDAP" value =" LDAP" />
11982 <el-option :label =" $t('views.userManage.source.dingtalk')" value =" dingtalk" />
12083 </el-select >
12184 </div >
122- <el-button
123- type =" primary"
124- :disabled =" current?.is_auth"
125- @click =" handleSave"
126- v-if ="
127- route.path.includes('share/')
128- ? false
129- : hasPermission(permissionObj[currentPermissionKey], 'OR')
130- "
131- >
85+ <el-button type =" primary" :disabled =" current?.is_auth" @click =" handleSave" v-if ="
86+ route.path.includes('share/')
87+ ? false
88+ : permissionObj[currentPermissionKey]
89+ " >
13290 {{ t('common.save') }}
13391 </el-button >
13492 </div >
13593
136- <app-table
137- :data =" tableData"
138- :pagination-config =" paginationConfig"
139- @sizeChange =" handleSizeChange"
140- @changePage =" getList"
141- :maxTableHeight =" 350"
142- >
143- <el-table-column
144- prop =" nick_name"
145- :label =" $t('views.userManage.userForm.nick_name.label')"
146- />
94+ <app-table :data =" tableData" :pagination-config =" paginationConfig" @sizeChange =" handleSizeChange"
95+ @changePage =" getList" :maxTableHeight =" 350" >
96+ <el-table-column prop =" nick_name" :label =" $t('views.userManage.userForm.nick_name.label')" />
14797 <el-table-column prop =" username" :label =" $t('views.login.loginForm.username.label')" />
14898 <el-table-column prop =" source" :label =" $t('views.userManage.source.label')" >
14999 <template #default =" { row } " >
164114 </el-table-column >
165115 <el-table-column :width =" 140" align =" center" >
166116 <template #header >
167- <el-checkbox
168- :model-value =" allChecked"
169- :indeterminate =" allIndeterminate"
170- :disabled =" current?.is_auth"
171- @change =" handleCheckAll"
172- >{{ $t('views.chatUser.authorization') }}
117+ <el-checkbox :model-value =" allChecked" :indeterminate =" allIndeterminate" :disabled =" current?.is_auth"
118+ @change =" handleCheckAll" >{{ $t('views.chatUser.authorization') }}
173119 </el-checkbox >
174120 </template >
175121 <template #default =" { row } " >
176- <el-checkbox
177- v-model =" row.is_auth"
178- :indeterminate =" row.indeterminate"
179- :disabled =" current?.is_auth"
180- @change =" (value: boolean) => handleRowChange(value, row)"
181- />
122+ <el-checkbox v-model =" row.is_auth" :indeterminate =" row.indeterminate" :disabled =" current?.is_auth"
123+ @change =" (value: boolean) => handleRowChange(value, row)" />
182124 </template >
183125 </el-table-column >
184126 </app-table >
@@ -200,6 +142,7 @@ import { ComplexPermission } from '@/utils/permission/type'
200142import { RoleConst , PermissionConst } from ' @/utils/permission/data'
201143import { hasPermission } from ' @/utils/permission/index'
202144import { loadSharedApi } from ' @/utils/dynamics-api/shared-api'
145+ import permissionMap from ' @/permission'
203146
204147const route = useRoute ()
205148
@@ -208,43 +151,31 @@ const {
208151} = route as any
209152
210153const permissionObj = ref <any >({
211- APPLICATION: new ComplexPermission (
212- [RoleConst .ADMIN , RoleConst .WORKSPACE_MANAGE .getWorkspaceRole , RoleConst .USER .getWorkspaceRole ],
213- [
214- PermissionConst .APPLICATION_CHAT_USER_EDIT ,
215- PermissionConst .APPLICATION_CHAT_USER_EDIT .getApplicationWorkspaceResourcePermission (id ),
216- ],
217- [],
218- ' OR' ,
219- ),
220- KNOWLEDGE: new ComplexPermission (
221- [RoleConst .ADMIN , RoleConst .WORKSPACE_MANAGE .getWorkspaceRole , RoleConst .USER .getWorkspaceRole ],
222- [
223- PermissionConst .KNOWLEDGE_CHAT_USER_EDIT ,
224- PermissionConst .KNOWLEDGE_CHAT_USER_EDIT .getKnowledgeWorkspaceResourcePermission (id ),
225- ],
226- [],
227- ' OR' ,
228- ),
229- RESOURCE_APPLICATION: [RoleConst .ADMIN , PermissionConst .RESOURCE_APPLICATION_CHAT_USER_EDIT ],
230- RESOURCE_KNOWLEDGE: [RoleConst .ADMIN , PermissionConst .RESOURCE_KNOWLEDGE_CHAT_USER_EDIT ],
231- SHAREDKNOWLEDGE: new ComplexPermission (
154+ APPLICATION: permissionMap [' application' ][' workspace' ].application_chat_user_edit (id ),
155+ KNOWLEDGE: permissionMap [' knowledge' ][' workspace' ].chat_user_edit (id ),
156+ RESOURCE_APPLICATION: hasPermission ([RoleConst .ADMIN , PermissionConst .RESOURCE_APPLICATION_CHAT_USER_EDIT ], ' OR' ),
157+ RESOURCE_KNOWLEDGE: hasPermission ([RoleConst .ADMIN , PermissionConst .RESOURCE_KNOWLEDGE_CHAT_USER_EDIT ], ' OR' ),
158+ SHAREDKNOWLEDGE: hasPermission (new ComplexPermission (
232159 [RoleConst .ADMIN ],
233160 [PermissionConst .SHARED_KNOWLEDGE_CHAT_USER_EDIT ],
234161 [],
235162 ' OR' ,
236- ),
163+ ), ' OR ' )
237164})
238165
239166const currentPermissionKey = computed (() => {
240- if (route .path .includes (' shared' )) return ' SHAREDKNOWLEDGE'
241167 if (route .path .includes (' resource-management' )) {
242168 if (route .meta ?.resourceType === ' KNOWLEDGE' ) {
243169 return ' RESOURCE_KNOWLEDGE'
244170 } else if (route .meta ?.resourceType === ' APPLICATION' ) {
245171 return ' RESOURCE_APPLICATION'
246172 }
247173 }
174+ else if (route .path .includes (' shared' )) {return ' SHAREDKNOWLEDGE' }
175+ else {
176+ if (route .path .includes (' knowledge/' )) return ' KNOWLEDGE'
177+ if (route .path .includes (' application/' )) return ' APPLICATION'
178+ }
248179 return route .meta ?.resourceType as string
249180})
250181
0 commit comments