1010 <div
1111 @click =" handleSharedNodeClick"
1212 v-if =" showShared && hasPermission(EditionConst.IS_EE, 'OR')"
13- class =" shared-knowledge "
13+ class =" shared-button flex cursor "
1414 :class =" currentNodeKey === 'share' && 'active'"
1515 >
16- <AppIcon : iconName =" iconName " style =" font-size : 18px " ></AppIcon >
16+ <AppIcon iconName =" app-folder-share-active " style =" font-size : 18px " ></AppIcon >
1717 <span class =" ml-8 lighter" >{{ shareTitle }}</span >
1818 </div >
19- <el-tree
20- ref =" treeRef"
21- :data =" data"
22- :props =" defaultProps"
23- @node-click =" handleNodeClick"
24- :filter-node-method =" filterNode"
25- :default-expanded-keys =" [currentNodeKey]"
26- :current-node-key =" currentNodeKey"
27- highlight-current
28- class =" overflow-inherit_node__children"
29- node-key =" id"
30- v-loading =" loading"
31- >
32- <template #default =" { node , data } " >
33- <div class =" flex-between w-full" @mouseenter.stop =" handleMouseEnter(data)" >
34- <div class =" flex align-center" >
35- <AppIcon iconName =" app-folder" style =" font-size : 16px " ></AppIcon >
36- <span class =" ml-8 ellipsis" style =" max-width : 110px " :label =" node.label" >{{
37- node.label
38- }}</span >
39- </div >
40-
41- <div
42- v-if =" canOperation && node.level !== 3"
43- @click.stop
44- v-show =" hoverNodeId === data.id"
45- @mouseenter.stop =" handleMouseEnter(data)"
46- @mouseleave.stop =" handleMouseleave"
47- class =" mr-16"
48- >
49- <el-dropdown trigger =" click" :teleported =" false" >
50- <el-button text class =" w-full" >
51- <el-icon class =" rotate-90" ><MoreFilled /></el-icon >
52- </el-button >
53- <template #dropdown >
54- <el-dropdown-menu >
55- <el-dropdown-item @click.stop =" openCreateFolder(data)" >
56- <AppIcon iconName =" app-add-folder" ></AppIcon >
57- {{ '添加子文件夹' }}
58- </el-dropdown-item >
59- <el-dropdown-item @click.stop =" openEditFolder(data)" >
60- <el-icon ><EditPen /></el-icon >
61- {{ $t('common.edit') }}
62- </el-dropdown-item >
63- <el-dropdown-item
64- divided
65- @click.stop =" deleteFolder(data)"
66- :disabled =" !data.parent_id"
67- >
68- <el-icon ><Delete /></el-icon >
69- {{ $t('common.delete') }}
70- </el-dropdown-item >
71- </el-dropdown-menu >
72- </template >
73- </el-dropdown >
74- </div >
75- </div >
76- </template >
77- </el-tree >
19+ <div class =" tree-height border-t" :style =" treeStyle" >
20+ <el-scrollbar >
21+ <el-tree
22+ ref =" treeRef"
23+ :data =" data"
24+ :props =" defaultProps"
25+ @node-click =" handleNodeClick"
26+ :filter-node-method =" filterNode"
27+ :default-expanded-keys =" [currentNodeKey]"
28+ :current-node-key =" currentNodeKey"
29+ highlight-current
30+ class =" overflow-inherit_node__children"
31+ node-key =" id"
32+ v-loading =" loading"
33+ >
34+ <template #default =" { node , data } " >
35+ <div class =" flex-between w-full" @mouseenter.stop =" handleMouseEnter(data)" >
36+ <div class =" flex align-center" >
37+ <AppIcon iconName =" app-folder" style =" font-size : 16px " ></AppIcon >
38+ <span class =" ml-8 ellipsis" style =" max-width : 110px " :title =" node.label" >{{
39+ node.label
40+ }}</span >
41+ </div >
42+
43+ <div
44+ v-if =" canOperation && node.level !== 3"
45+ @click.stop
46+ v-show =" hoverNodeId === data.id"
47+ @mouseenter.stop =" handleMouseEnter(data)"
48+ @mouseleave.stop =" handleMouseleave"
49+ class =" mr-16"
50+ >
51+ <el-dropdown trigger =" click" :teleported =" false" >
52+ <el-button text class =" w-full" >
53+ <el-icon class =" rotate-90" ><MoreFilled /></el-icon >
54+ </el-button >
55+ <template #dropdown >
56+ <el-dropdown-menu >
57+ <el-dropdown-item @click.stop =" openCreateFolder(data)" >
58+ <AppIcon iconName =" app-add-folder" ></AppIcon >
59+ {{ $t('components.folder.addChildFolder') }}
60+ </el-dropdown-item >
61+ <el-dropdown-item @click.stop =" openEditFolder(data)" >
62+ <el-icon ><EditPen /></el-icon >
63+ {{ $t('common.edit') }}
64+ </el-dropdown-item >
65+ <el-dropdown-item
66+ divided
67+ @click.stop =" deleteFolder(data)"
68+ :disabled =" !data.parent_id"
69+ >
70+ <el-icon ><Delete /></el-icon >
71+ {{ $t('common.delete') }}
72+ </el-dropdown-item >
73+ </el-dropdown-menu >
74+ </template >
75+ </el-dropdown >
76+ </div >
77+ </div >
78+ </template >
79+ </el-tree >
80+ </el-scrollbar >
81+ </div >
7882 <CreateFolderDialog ref =" CreateFolderDialogRef" @refresh =" refreshFolder" :title =" title" />
7983 </div >
8084</template >
@@ -108,10 +112,6 @@ const props = defineProps({
108112 type: Boolean ,
109113 default: false ,
110114 },
111- iconName: {
112- type: String ,
113- default: ' app-folder-share-active' ,
114- },
115115 shareTitle: {
116116 type: String ,
117117 default: ' ' ,
@@ -120,6 +120,10 @@ const props = defineProps({
120120 type: Boolean ,
121121 default: true ,
122122 },
123+ treeStyle: {
124+ type: Object ,
125+ default : () => ({}),
126+ },
123127})
124128
125129const { folder } = useStore ()
@@ -184,11 +188,11 @@ function deleteFolder(row: Tree) {
184188
185189const CreateFolderDialogRef = ref ()
186190function openCreateFolder(row : Tree ) {
187- title .value = ' 添加子文件夹 '
191+ title .value = t ( ' components.folder.addChildFolder ' )
188192 CreateFolderDialogRef .value .open (props .source , row .id )
189193}
190194function openEditFolder(row : Tree ) {
191- title .value = ' 编辑文件夹 '
195+ title .value = t ( ' components.folder.editFolder ' )
192196 CreateFolderDialogRef .value .open (props .source , row .id , row )
193197}
194198
@@ -197,39 +201,35 @@ function refreshFolder() {
197201}
198202 </script >
199203<style lang="scss" scoped>
200- .shared-knowledge {
201- padding-left : 8px ;
202- display : flex ;
203- align-items : center ;
204- height : 40px ;
205- position : relative ;
206- margin-bottom : 8px ;
207- border-radius : 4px ;
208- cursor : pointer ;
209-
210- & :hover {
211- background : var (--app-text-color-light-1 );
212- color : var (--el-menu-text-color );
213- }
214-
215- & .active {
216- color : var (--el-color-primary );
217- background : var (--el-color-primary-light-9 );
204+ .folder-tree {
205+ .shared-button {
206+ padding : 10px 8px ;
207+ font-weight : 400 ;
208+ font-size : 14px ;
209+ margin-bottom : 4px ;
210+ & .active {
211+ background : var (--el-color-primary-light-9 );
212+ border-radius : 4px ;
213+ color : var (--el-color-primary );
214+ font-weight : 500 ;
215+ & :hover {
216+ background : var (--el-color-primary-light-9 );
217+ }
218+ }
219+ & :hover {
220+ border-radius : 4px ;
221+ background : var (--app-text-color-light-1 );
222+ }
223+ & .is-active {
224+ & :hover {
225+ color : var (--el-color-primary );
226+ background : var (--el-color-primary-light-9 );
227+ }
228+ }
218229 }
219-
220- & ::after {
221- content : ' ' ;
222- position : absolute ;
223- bottom : -4px ;
224- background-color : #1f232926 ;
225- left : 0 ;
226- width : 100% ;
227- height : 1px ;
228- }
229- }
230- :deep(.overflow-inherit_node__children ) {
231- .el-tree-node__children {
232- overflow : inherit !important ;
230+ .tree-height {
231+ padding-top : 4px ;
232+ height : calc (100vh - 210px );
233233 }
234234}
235235 </style >
0 commit comments