From f74bafd59a9e77c444560dddcec0e0651aae064b Mon Sep 17 00:00:00 2001 From: wangdan-fit2cloud Date: Thu, 18 Jan 2024 18:41:32 +0800 Subject: [PATCH 1/3] feat: --- ui/src/assets/icon_web.svg.svg | 4 ++++ .../ai-chat/ParagraphSourceDialog.vue | 22 +++++-------------- 2 files changed, 10 insertions(+), 16 deletions(-) create mode 100644 ui/src/assets/icon_web.svg.svg diff --git a/ui/src/assets/icon_web.svg.svg b/ui/src/assets/icon_web.svg.svg new file mode 100644 index 000000000..f958baf61 --- /dev/null +++ b/ui/src/assets/icon_web.svg.svg @@ -0,0 +1,4 @@ + + + + diff --git a/ui/src/components/ai-chat/ParagraphSourceDialog.vue b/ui/src/components/ai-chat/ParagraphSourceDialog.vue index 34eb44ef3..12e687721 100644 --- a/ui/src/components/ai-chat/ParagraphSourceDialog.vue +++ b/ui/src/components/ai-chat/ParagraphSourceDialog.vue @@ -17,7 +17,6 @@ class="paragraph-source-card cursor mb-8" :class="item.is_active ? '' : 'disabled'" :showIcon="false" - @click="editParagraph(item)" > + diff --git a/ui/src/views/document/index.vue b/ui/src/views/document/index.vue index 16a3e2e15..83ef2d495 100644 --- a/ui/src/views/document/index.vue +++ b/ui/src/views/document/index.vue @@ -10,9 +10,16 @@ @click="router.push({ path: '/dataset/upload', query: { id: id } })" >上传文档 - 导入文档 - - 导入文档 + 批量同步 + 批量删除 @@ -126,7 +133,9 @@ @@ -147,6 +157,7 @@ import { ref, onMounted, reactive, onBeforeUnmount } from 'vue' import { useRouter, useRoute } from 'vue-router' import { ElTable } from 'element-plus' import documentApi from '@/api/document' +import ImportDocumentDialog from './component/ImportDocumentDialog.vue' import { numberFormat } from '@/utils/utils' import { datetimeFormat } from '@/utils/time' import { MsgSuccess, MsgConfirm } from '@/utils/message' @@ -171,8 +182,19 @@ const paginationConfig = reactive({ total: 0 }) +const ImportDocumentDialogRef = ref() const multipleTableRef = ref>() const multipleSelection = ref([]) +const title = ref('') + +function importDoc() { + title.value = '导入文档' + ImportDocumentDialogRef.value.open() +} +function settingDoc(row: any) { + title.value = '设置' + ImportDocumentDialogRef.value.open(row) +} const handleSelectionChange = (val: any[]) => { multipleSelection.value = val @@ -201,9 +223,22 @@ const closeInterval = () => { } } function refreshDocument(row: any) { - documentApi.putDocumentRefresh(row.dataset_id, row.id).then((res) => { - getList() - }) + if (row.type === '1') { + MsgConfirm(`确认同步文档?`, `同步将删除已有数据重新获取新数据,请谨慎操作。`, { + confirmButtonText: '同步', + confirmButtonClass: 'danger' + }) + .then(() => { + documentApi.putDocumentRefresh(row.dataset_id, row.id).then((res) => { + getList() + }) + }) + .catch(() => {}) + } else { + documentApi.putDocumentRefresh(row.dataset_id, row.id).then((res) => { + getList() + }) + } } function rowClickHandle(row: any) { @@ -227,6 +262,19 @@ function creatQuickHandle(val: string) { }) } +function syncMulDocument() { + const arr: string[] = [] + multipleSelection.value.map((v) => { + if (v) { + arr.push(v.id) + } + }) + documentApi.delMulSyncDocument(id, arr, loading).then(() => { + MsgSuccess('批量同步成功') + getList() + }) +} + function deleteMulDocument() { const arr: string[] = [] multipleSelection.value.map((v) => { @@ -235,7 +283,7 @@ function deleteMulDocument() { } }) documentApi.delMulDocument(id, arr, loading).then(() => { - MsgSuccess('删除成功') + MsgSuccess('批量删除成功') getList() }) } @@ -323,6 +371,11 @@ function getDetail() { }) } +function refresh() { + paginationConfig.current_page = 1 + getList() +} + onMounted(() => { getDetail() getList()