feat: tree

This commit is contained in:
wangdan-fit2cloud 2025-05-09 14:42:51 +08:00
parent deb7268be1
commit 53048774ee
4 changed files with 17 additions and 66 deletions

View File

@ -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,

View File

@ -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>

View File

@ -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;
}

View File

@ -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]
}) })
} }