Skip to content

Commit 5304877

Browse files
feat: tree
1 parent deb7268 commit 5304877

File tree

4 files changed

+17
-66
lines changed

4 files changed

+17
-66
lines changed

ui/src/api/folder.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ const prefix = '/workspace'
88
* 获得知识库文件夹列表
99
* @params 参数
1010
* source : APPLICATION, KNOWLEDGE, TOOL
11-
* {
12-
* name: string}
11+
* {name: string}
1312
*/
1413
const getFolder: (
1514
wordspace_id: string,

ui/src/components/folder-tree/index.vue

Lines changed: 8 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -9,75 +9,23 @@
99

1010
<script lang="ts" setup>
1111
defineOptions({ name: 'FolderTree' })
12+
const props = defineProps({
13+
data: {
14+
type: Array,
15+
default: () => [],
16+
},
17+
})
1218
interface Tree {
13-
label: string
19+
name: string
1420
children?: Tree[]
1521
}
1622
1723
const handleNodeClick = (data: Tree) => {
1824
console.log(data)
1925
}
2026
21-
const data: Tree[] = [
22-
{
23-
label: 'Level one 1',
24-
children: [
25-
{
26-
label: 'Level two 1-1',
27-
children: [
28-
{
29-
label: 'Level three 1-1-1',
30-
},
31-
],
32-
},
33-
],
34-
},
35-
{
36-
label: 'Level one 2',
37-
children: [
38-
{
39-
label: 'Level two 2-1',
40-
children: [
41-
{
42-
label: 'Level three 2-1-1',
43-
},
44-
],
45-
},
46-
{
47-
label: 'Level two 2-2',
48-
children: [
49-
{
50-
label: 'Level three 2-2-1',
51-
},
52-
],
53-
},
54-
],
55-
},
56-
{
57-
label: 'Level one 3',
58-
children: [
59-
{
60-
label: 'Level two 3-1',
61-
children: [
62-
{
63-
label: 'Level three 3-1-1',
64-
},
65-
],
66-
},
67-
{
68-
label: 'Level two 3-2',
69-
children: [
70-
{
71-
label: 'Level three 3-2-1',
72-
},
73-
],
74-
},
75-
],
76-
},
77-
]
78-
7927
const defaultProps = {
8028
children: 'children',
81-
label: 'label',
29+
label: 'name',
8230
}
8331
</script>

ui/src/styles/element-plus.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,7 @@
2020
.el-card {
2121
--el-card-padding: calc(var(--app-base-px) * 2);
2222
}
23+
24+
.el-tree {
25+
background: none;
26+
}

ui/src/views/tool/index.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<LayoutContainer class="tool-manage">
33
<template #left>
44
<h4>{{ $t('views.tool.title') }}</h4>
5-
<folder-tree />
5+
<folder-tree :data="folderList" />
66
</template>
77
<ContentContainer>
88
<div class="flex-between mb-16">
@@ -68,6 +68,7 @@ const paginationConfig = reactive({
6868
total: 0,
6969
})
7070
71+
const folderList = ref<any[]>([])
7172
const toolList = ref<any[]>([])
7273
const folderId = ref<string>('root')
7374
@@ -84,9 +85,8 @@ function getList() {
8485
8586
function getFolder() {
8687
const params = {}
87-
folder.asynGetFolder('default', 'TOOL', params, loading).then((res) => {
88-
// paginationConfig.total = res.data.total
89-
// datasetList.value = [...datasetList.value, ...res.data.records]
88+
folder.asynGetFolder('default', 'TOOL', params, loading).then((res: any) => {
89+
folderList.value = res.data
9090
})
9191
}
9292

0 commit comments

Comments
 (0)