fix: folder bugs
This commit is contained in:
parent
949c6d5ce1
commit
2ead8b3ed2
@ -2,7 +2,7 @@
|
|||||||
<div class="chat-knowledge-source">
|
<div class="chat-knowledge-source">
|
||||||
<div
|
<div
|
||||||
class="flex align-center mt-16"
|
class="flex align-center mt-16"
|
||||||
v-if="(type === 'log' || type === 'debug-ai-chat') ? true : application.show_source"
|
v-if="type === 'log' || type === 'debug-ai-chat' ? true : application.show_source"
|
||||||
>
|
>
|
||||||
<span class="mr-4 color-secondary">{{ $t('chat.KnowledgeSource.title') }}</span>
|
<span class="mr-4 color-secondary">{{ $t('chat.KnowledgeSource.title') }}</span>
|
||||||
<el-divider direction="vertical" />
|
<el-divider direction="vertical" />
|
||||||
@ -15,7 +15,7 @@
|
|||||||
|
|
||||||
<div
|
<div
|
||||||
class="mt-8"
|
class="mt-8"
|
||||||
v-if="(type === 'log' || type === 'debug-ai-chat') ? true : application.show_source"
|
v-if="type === 'log' || type === 'debug-ai-chat' ? true : application.show_source"
|
||||||
>
|
>
|
||||||
<el-row :gutter="8" v-if="uniqueParagraphList?.length">
|
<el-row :gutter="8" v-if="uniqueParagraphList?.length">
|
||||||
<template v-for="(item, index) in uniqueParagraphList" :key="index">
|
<template v-for="(item, index) in uniqueParagraphList" :key="index">
|
||||||
@ -51,7 +51,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
v-if="(type === 'log' || type === 'debug-ai-chat') ? true : application.show_exec"
|
v-if="type === 'log' || type === 'debug-ai-chat' ? true : application.show_exec"
|
||||||
class="execution-details border-t color-secondary flex-between mt-12"
|
class="execution-details border-t color-secondary flex-between mt-12"
|
||||||
style="padding-top: 12px; padding-bottom: 8px"
|
style="padding-top: 12px; padding-bottom: 8px"
|
||||||
>
|
>
|
||||||
@ -89,13 +89,13 @@
|
|||||||
<span class="medium ellipsis" :title="dialogTitle" :id="titleId" :class="titleClass">
|
<span class="medium ellipsis" :title="dialogTitle" :id="titleId" :class="titleClass">
|
||||||
{{ dialogTitle }}
|
{{ dialogTitle }}
|
||||||
</span>
|
</span>
|
||||||
<div class="flex align-center mr-8">
|
<div class="flex align-center mr-8" v-if="dialogType === 'pdfDocument'">
|
||||||
<span v-if="dialogType === 'pdfDocument'" class="mr-4">
|
<span class="mr-4">
|
||||||
<el-button text>
|
<el-button text>
|
||||||
<el-icon> <Download /> </el-icon>
|
<el-icon> <Download /> </el-icon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
<span v-if="dialogType === 'pdfDocument'">
|
<span>
|
||||||
<el-button text> <app-icon iconName="app-export" size="20" /></el-button>
|
<el-button text> <app-icon iconName="app-export" size="20" /></el-button>
|
||||||
</span>
|
</span>
|
||||||
<el-divider direction="vertical" />
|
<el-divider direction="vertical" />
|
||||||
@ -103,7 +103,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<div class="mb-8">
|
<div class="mb-8">
|
||||||
<component :is="currentComponent" :detail="currentChatDetail" :appType="appType"></component>
|
<component
|
||||||
|
:is="currentComponent"
|
||||||
|
:detail="currentChatDetail"
|
||||||
|
:appType="appType"
|
||||||
|
></component>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -41,7 +41,7 @@
|
|||||||
<el-button @click.prevent="dialogVisible = false" :loading="loading">
|
<el-button @click.prevent="dialogVisible = false" :loading="loading">
|
||||||
{{ $t('common.cancel') }}
|
{{ $t('common.cancel') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
<el-button type="primary" @click="submitHandle" :loading="loading">
|
<el-button type="primary" @click="submitHandle" :disabled="loading" :loading="loading">
|
||||||
{{ isEdit ? $t('common.confirm') : $t('common.add') }}
|
{{ isEdit ? $t('common.confirm') : $t('common.add') }}
|
||||||
</el-button>
|
</el-button>
|
||||||
</span>
|
</span>
|
||||||
@ -54,6 +54,7 @@ import folderApi from '@/api/folder'
|
|||||||
import { MsgSuccess, MsgAlert } from '@/utils/message'
|
import { MsgSuccess, MsgAlert } from '@/utils/message'
|
||||||
import { t } from '@/locales'
|
import { t } from '@/locales'
|
||||||
import useStore from '@/stores'
|
import useStore from '@/stores'
|
||||||
|
import disable$ from 'dingtalk-jsapi/api/ui/pullToRefresh/disable'
|
||||||
const { tool, knowledge, folder } = useStore()
|
const { tool, knowledge, folder } = useStore()
|
||||||
const emit = defineEmits(['refresh'])
|
const emit = defineEmits(['refresh'])
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
:close-on-press-escape="false"
|
:close-on-press-escape="false"
|
||||||
>
|
>
|
||||||
<folder-tree
|
<folder-tree
|
||||||
|
ref="treeRef"
|
||||||
:source="source"
|
:source="source"
|
||||||
:data="folderList"
|
:data="folderList"
|
||||||
:treeStyle="{
|
:treeStyle="{
|
||||||
@ -15,7 +16,7 @@
|
|||||||
borderRadius: '6px',
|
borderRadius: '6px',
|
||||||
padding: '8px',
|
padding: '8px',
|
||||||
}"
|
}"
|
||||||
:default-expanded-keys="['default']"
|
:default-expanded-keys="[currentNodeKey]"
|
||||||
:canOperation="false"
|
:canOperation="false"
|
||||||
class="move-to-dialog-tree"
|
class="move-to-dialog-tree"
|
||||||
@handleNodeClick="folderClickHandle"
|
@handleNodeClick="folderClickHandle"
|
||||||
@ -50,17 +51,21 @@ const props = defineProps({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const treeRef = ref()
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const dialogVisible = ref(false)
|
const dialogVisible = ref(false)
|
||||||
const folderList = ref<any[]>([])
|
const folderList = ref<any[]>([])
|
||||||
const detail = ref<any>({})
|
const detail = ref<any>({})
|
||||||
const selectForderId = ref<any>('')
|
const selectForderId = ref<any>('')
|
||||||
|
const currentNodeKey = ref<string>('')
|
||||||
|
|
||||||
watch(dialogVisible, (bool) => {
|
watch(dialogVisible, (bool) => {
|
||||||
if (!bool) {
|
if (!bool) {
|
||||||
detail.value = {}
|
detail.value = {}
|
||||||
selectForderId.value = ''
|
selectForderId.value = ''
|
||||||
folderList.value = []
|
folderList.value = []
|
||||||
|
currentNodeKey.value = ''
|
||||||
|
treeRef.value?.clearCurrentKey()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -74,6 +79,11 @@ function getFolder() {
|
|||||||
const params = {}
|
const params = {}
|
||||||
folder.asyncGetFolder(props.source, params, loading).then((res: any) => {
|
folder.asyncGetFolder(props.source, params, loading).then((res: any) => {
|
||||||
folderList.value = res.data
|
folderList.value = res.data
|
||||||
|
if (folderList.value?.length > 0) {
|
||||||
|
currentNodeKey.value = folderList.value[0]?.id
|
||||||
|
} else {
|
||||||
|
currentNodeKey.value = ''
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -96,7 +96,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { computed, ref, watch } from 'vue'
|
import { computed, onUnmounted, ref, watch } from 'vue'
|
||||||
import { onBeforeRouteLeave } from 'vue-router'
|
import { onBeforeRouteLeave } from 'vue-router'
|
||||||
import type { TreeInstance } from 'element-plus'
|
import type { TreeInstance } from 'element-plus'
|
||||||
import CreateFolderDialog from '@/components/folder-tree/CreateFolderDialog.vue'
|
import CreateFolderDialog from '@/components/folder-tree/CreateFolderDialog.vue'
|
||||||
@ -245,6 +245,16 @@ function openEditFolder(row: Tree) {
|
|||||||
function refreshFolder() {
|
function refreshFolder() {
|
||||||
emit('refreshTree')
|
emit('refreshTree')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearCurrentKey() {
|
||||||
|
treeRef.value?.setCurrentKey(undefined)
|
||||||
|
}
|
||||||
|
defineExpose({
|
||||||
|
clearCurrentKey,
|
||||||
|
})
|
||||||
|
onUnmounted(() => {
|
||||||
|
treeRef.value?.setCurrentKey(undefined)
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.folder-tree {
|
.folder-tree {
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
class="p-8"
|
class="p-8"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<ToolListContainer>
|
<ToolListContainer @refreshFolder="refreshFolder">
|
||||||
<template #header>
|
<template #header>
|
||||||
<FolderBreadcrumb :folderList="folderList" @click="folderClickHandle" />
|
<FolderBreadcrumb :folderList="folderList" @click="folderClickHandle" />
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user