feat: tree
This commit is contained in:
parent
deb7268be1
commit
53048774ee
@ -8,8 +8,7 @@ const prefix = '/workspace'
|
|||||||
* 获得知识库文件夹列表
|
* 获得知识库文件夹列表
|
||||||
* @params 参数
|
* @params 参数
|
||||||
* source : APPLICATION, KNOWLEDGE, TOOL
|
* source : APPLICATION, KNOWLEDGE, TOOL
|
||||||
* {
|
* {name: string}
|
||||||
* name: string}
|
|
||||||
*/
|
*/
|
||||||
const getFolder: (
|
const getFolder: (
|
||||||
wordspace_id: string,
|
wordspace_id: string,
|
||||||
|
|||||||
@ -9,8 +9,14 @@
|
|||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
defineOptions({ name: 'FolderTree' })
|
defineOptions({ name: 'FolderTree' })
|
||||||
|
const props = defineProps({
|
||||||
|
data: {
|
||||||
|
type: Array,
|
||||||
|
default: () => [],
|
||||||
|
},
|
||||||
|
})
|
||||||
interface Tree {
|
interface Tree {
|
||||||
label: string
|
name: string
|
||||||
children?: Tree[]
|
children?: Tree[]
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -18,66 +24,8 @@ const handleNodeClick = (data: Tree) => {
|
|||||||
console.log(data)
|
console.log(data)
|
||||||
}
|
}
|
||||||
|
|
||||||
const data: Tree[] = [
|
|
||||||
{
|
|
||||||
label: 'Level one 1',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: 'Level two 1-1',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: 'Level three 1-1-1',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Level one 2',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: 'Level two 2-1',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: 'Level three 2-1-1',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Level two 2-2',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: 'Level three 2-2-1',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Level one 3',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: 'Level two 3-1',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: 'Level three 3-1-1',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
label: 'Level two 3-2',
|
|
||||||
children: [
|
|
||||||
{
|
|
||||||
label: 'Level three 3-2-1',
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
]
|
|
||||||
|
|
||||||
const defaultProps = {
|
const defaultProps = {
|
||||||
children: 'children',
|
children: 'children',
|
||||||
label: 'label',
|
label: 'name',
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -20,3 +20,7 @@
|
|||||||
.el-card {
|
.el-card {
|
||||||
--el-card-padding: calc(var(--app-base-px) * 2);
|
--el-card-padding: calc(var(--app-base-px) * 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.el-tree {
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<LayoutContainer class="tool-manage">
|
<LayoutContainer class="tool-manage">
|
||||||
<template #left>
|
<template #left>
|
||||||
<h4>{{ $t('views.tool.title') }}</h4>
|
<h4>{{ $t('views.tool.title') }}</h4>
|
||||||
<folder-tree />
|
<folder-tree :data="folderList" />
|
||||||
</template>
|
</template>
|
||||||
<ContentContainer>
|
<ContentContainer>
|
||||||
<div class="flex-between mb-16">
|
<div class="flex-between mb-16">
|
||||||
@ -68,6 +68,7 @@ const paginationConfig = reactive({
|
|||||||
total: 0,
|
total: 0,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const folderList = ref<any[]>([])
|
||||||
const toolList = ref<any[]>([])
|
const toolList = ref<any[]>([])
|
||||||
const folderId = ref<string>('root')
|
const folderId = ref<string>('root')
|
||||||
|
|
||||||
@ -84,9 +85,8 @@ function getList() {
|
|||||||
|
|
||||||
function getFolder() {
|
function getFolder() {
|
||||||
const params = {}
|
const params = {}
|
||||||
folder.asynGetFolder('default', 'TOOL', params, loading).then((res) => {
|
folder.asynGetFolder('default', 'TOOL', params, loading).then((res: any) => {
|
||||||
// paginationConfig.total = res.data.total
|
folderList.value = res.data
|
||||||
// datasetList.value = [...datasetList.value, ...res.data.records]
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user