From 7acdd887bf63dcd1a7c438fbdec86e3736b5822b Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Thu, 19 Jun 2025 21:32:14 +0800 Subject: [PATCH] feat: document --- ui/src/api/knowledge/document.ts | 25 ++++++------ ui/src/api/knowledge/paragraph.ts | 3 +- ui/src/api/resource-management/document.ts | 14 ++++--- ui/src/api/shared/document.ts | 26 ++++--------- .../paragraph/component/ParagraphCard.vue | 8 +++- .../paragraph/component/ParagraphDialog.vue | 33 ++++++++++------ .../paragraph/component/ProblemComponent.vue | 14 +++---- ui/src/views/paragraph/index.vue | 38 ++++++------------- .../resource-management/paragraph/index.vue | 13 ++----- .../views/shared/paragraph-shared/index.vue | 13 ++----- 10 files changed, 82 insertions(+), 105 deletions(-) diff --git a/ui/src/api/knowledge/document.ts b/ui/src/api/knowledge/document.ts index 0d5aa1860..831804ea5 100644 --- a/ui/src/api/knowledge/document.ts +++ b/ui/src/api/knowledge/document.ts @@ -54,11 +54,14 @@ const getDocumentPage: ( * 文档详情 * @param 参数 knowledge_id */ -const getDocumentDetail: (knowledge_id: string, document_id: string) => Promise> = ( - knowledge_id, - document_id, -) => { - return get(`${prefix.value}/${knowledge_id}/document/${document_id}`) +const getDocumentDetail: ( + knowledge_id: string, + document_id: string, + loading?: Ref, +) => Promise> = (knowledge_id, document_id, loading) => { + return get(`${prefix.value}/${knowledge_id}/document/${document_id}`, + {}, + loading,) } /** @@ -108,12 +111,7 @@ const putBatchCancelTask: ( data: any, loading?: Ref, ) => Promise> = (knowledge_id, data, loading) => { - return put( - `${prefix.value}/${knowledge_id}/document/batch_cancel_task`, - data, - undefined, - loading, - ) + return put(`${prefix.value}/${knowledge_id}/document/batch_cancel_task`, data, undefined, loading) } /** @@ -560,12 +558,11 @@ const putMulLarkSyncDocument: ( const importLarkDocument: ( knowledge_id: string, data: any, - loading?: Ref + loading?: Ref, ) => Promise>> = (knowledge_id, data, loading) => { return post(`${prefix.value}/lark/${knowledge_id}/import`, data, null, loading) } - export default { getDocumentList, getDocumentPage, @@ -596,5 +593,5 @@ export default { getLarkDocumentList, putLarkDocumentSync, putMulLarkSyncDocument, - importLarkDocument + importLarkDocument, } diff --git a/ui/src/api/knowledge/paragraph.ts b/ui/src/api/knowledge/paragraph.ts index 35aa5cfad..639916d4a 100644 --- a/ui/src/api/knowledge/paragraph.ts +++ b/ui/src/api/knowledge/paragraph.ts @@ -300,5 +300,6 @@ export default { putMulParagraph, putBatchGenerateRelated, putMigrateMulParagraph, - putDisassociationProblem + putDisassociationProblem, + putAdjustPosition } diff --git a/ui/src/api/resource-management/document.ts b/ui/src/api/resource-management/document.ts index 478f66042..bed8e3c79 100644 --- a/ui/src/api/resource-management/document.ts +++ b/ui/src/api/resource-management/document.ts @@ -27,15 +27,19 @@ const getDocument: ( ) } + /** * 文档详情 * @param 参数 knowledge_id */ -const getDocumentDetail: (knowledge_id: string, document_id: string) => Promise> = ( - knowledge_id, - document_id, -) => { - return get(`${prefix}/${knowledge_id}/document/${document_id}`) +const getDocumentDetail: ( + knowledge_id: string, + document_id: string, + loading?: Ref, +) => Promise> = (knowledge_id, document_id, loading) => { + return get(`${prefix}/${knowledge_id}/document/${document_id}`, + {}, + loading,) } /** diff --git a/ui/src/api/shared/document.ts b/ui/src/api/shared/document.ts index 23911eae4..0ce48aa78 100644 --- a/ui/src/api/shared/document.ts +++ b/ui/src/api/shared/document.ts @@ -26,16 +26,16 @@ const getDocumentPage: ( loading, ) } - /** * 文档详情 * @param 参数 knowledge_id */ -const getDocumentDetail: (knowledge_id: string, document_id: string) => Promise> = ( - knowledge_id, - document_id, -) => { - return get(`${prefix}/${knowledge_id}/document/${document_id}`) +const getDocumentDetail: ( + knowledge_id: string, + document_id: string, + loading?: Ref, +) => Promise> = (knowledge_id, document_id, loading) => { + return get(`${prefix}/${knowledge_id}/document/${document_id}`, {}, loading) } /** @@ -85,12 +85,7 @@ const putBatchCancelTask: ( data: any, loading?: Ref, ) => Promise> = (knowledge_id, data, loading) => { - return put( - `${prefix}/${knowledge_id}/document/batch_cancel_task`, - data, - undefined, - loading, - ) + return put(`${prefix}/${knowledge_id}/document/batch_cancel_task`, data, undefined, loading) } /** @@ -470,12 +465,7 @@ const getLarkDocumentList: ( data: any, loading?: Ref, ) => Promise> = (knowledge_id, folder_token, data, loading) => { - return post( - `${prefix}/lark/${knowledge_id}/${folder_token}/doc_list`, - data, - undefined, - loading, - ) + return post(`${prefix}/lark/${knowledge_id}/${folder_token}/doc_list`, data, undefined, loading) } /** diff --git a/ui/src/views/paragraph/component/ParagraphCard.vue b/ui/src/views/paragraph/component/ParagraphCard.vue index caa9ed757..3e45be8c0 100644 --- a/ui/src/views/paragraph/component/ParagraphCard.vue +++ b/ui/src/views/paragraph/component/ParagraphCard.vue @@ -5,6 +5,7 @@ @mouseenter="cardEnter()" @mouseleave="cardLeave()" @click.stop="editParagraph(data)" + v-loading="loading" >

{{ data.title || '-' }}

@@ -30,7 +31,7 @@ - + @@ -154,6 +155,11 @@ function editParagraph(row: any) { } } +function addParagraph(row: any) { + title.value = t('views.paragraph.addParagraph') + ParagraphDialogRef.value.open(row, 'add') +} + const SelectDocumentDialogRef = ref() function openSelectDocumentDialog(row?: any) { SelectDocumentDialogRef.value.open([row.id]) diff --git a/ui/src/views/paragraph/component/ParagraphDialog.vue b/ui/src/views/paragraph/component/ParagraphDialog.vue index 0b8d243be..0a19c9cbc 100644 --- a/ui/src/views/paragraph/component/ParagraphDialog.vue +++ b/ui/src/views/paragraph/component/ParagraphDialog.vue @@ -7,13 +7,14 @@ destroy-on-close :close-on-click-modal="false" :close-on-press-escape="false" + @click.stop >
- +
@@ -21,7 +22,7 @@
-
+
{{ $t('common.cancel') }} {{ $t('common.save') }} @@ -31,14 +32,14 @@ -