feat: 新增FAQ条目导出功能,支持CSV格式导出

This commit is contained in:
wizardchen
2025-12-16 15:16:46 +08:00
committed by lyingbug
parent d9b04a19a6
commit ad6bd157fd
14 changed files with 368 additions and 94 deletions
+20 -1
View File
@@ -99,6 +99,16 @@
<span class="kb-action-title">{{ t('knowledgeEditor.faq.searchTest') }}</span>
</div>
</div>
<div class="menu_item kb-action-item" @click.stop="handleFaqExportFromMenu">
<div class="kb-action-icon-wrapper">
<svg class="kb-action-icon" width="18" height="18" viewBox="0 0 18 18" fill="none">
<path d="M15.75 11.25V14.25C15.75 14.6478 15.592 15.0294 15.3107 15.3107C15.0294 15.592 14.6478 15.75 14.25 15.75H3.75C3.35218 15.75 2.97064 15.592 2.68934 15.3107C2.40804 15.0294 2.25 14.6478 2.25 14.25V11.25M12.75 6L9 2.25M9 2.25L5.25 6M9 2.25V11.25" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
<div class="kb-action-content">
<span class="kb-action-title">{{ t('knowledgeEditor.faqExport.exportButton') }}</span>
</div>
</div>
<t-dropdown
v-if="selectedFaqCount > 0"
:options="faqBatchActionOptions"
@@ -1132,7 +1142,7 @@ const handleDocURLImport = async () => {
}))
}
const dispatchFaqMenuAction = (action: 'create' | 'import' | 'search' | 'batch' | 'batchTag' | 'batchEnable' | 'batchDisable' | 'batchDelete', kbId: string) => {
const dispatchFaqMenuAction = (action: 'create' | 'import' | 'search' | 'export' | 'batch' | 'batchTag' | 'batchEnable' | 'batchDisable' | 'batchDelete', kbId: string) => {
window.dispatchEvent(new CustomEvent('faqMenuAction', {
detail: { action, kbId }
}))
@@ -1165,6 +1175,15 @@ const handleFaqSearchTestFromMenu = async () => {
dispatchFaqMenuAction('search', kbId)
}
const handleFaqExportFromMenu = async () => {
const kbId = await getCurrentKbId()
if (!kbId) {
MessagePlugin.warning(t('knowledgeEditor.messages.missingId'))
return
}
dispatchFaqMenuAction('export', kbId)
}
const faqBatchActionOptions = computed(() => {
if (selectedFaqCount.value === 0) {
return []