mirror of
https://github.com/1Panel-dev/MaxKB.git
synced 2025-12-27 20:42:52 +00:00
feat:
This commit is contained in:
parent
65136549be
commit
6503132492
|
|
@ -109,7 +109,16 @@ const delDocument: (dataset_id: string, document_id: string) => Promise<Result<b
|
|||
) => {
|
||||
return del(`${prefix}/${dataset_id}/document/${document_id}`)
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 批量删除文档
|
||||
// * @param 参数 dataset_id, document_id,
|
||||
// */
|
||||
// const delDocument: (dataset_id: string, document_id: string) => Promise<Result<boolean>> = (
|
||||
// dataset_id,
|
||||
// document_id
|
||||
// ) => {
|
||||
// return del(`${prefix}/${dataset_id}/document/${document_id}`)
|
||||
// }
|
||||
/**
|
||||
* 文档详情
|
||||
* @param 参数 dataset_id
|
||||
|
|
|
|||
|
|
@ -60,7 +60,6 @@ const open = (id: string) => {
|
|||
|
||||
const submit = () => {
|
||||
dataset.asyncSyncDateset(datasetId.value, method.value, loading).then((res: any) => {
|
||||
// MsgSuccess('删除成功')
|
||||
emit('refresh', res.data)
|
||||
dialogVisible.value = false
|
||||
})
|
||||
|
|
|
|||
|
|
@ -0,0 +1,88 @@
|
|||
<template>
|
||||
<el-dialog
|
||||
title="同步知识库"
|
||||
v-model="dialogVisible"
|
||||
width="600px"
|
||||
:close-on-click-modal="false"
|
||||
:close-on-press-escape="false"
|
||||
:destroy-on-close="true"
|
||||
>
|
||||
<p class="mb-8">同步方式</p>
|
||||
<el-radio-group v-model="method" class="card__radio">
|
||||
<el-card shadow="never" class="mb-16" :class="method === 'replace' ? 'active' : ''">
|
||||
<el-radio label="replace" size="large">
|
||||
<p class="mb-4">替换同步</p>
|
||||
<el-text type="info">重新获取 Web 站点文档,覆盖替换本地知识库中的文档</el-text>
|
||||
</el-radio>
|
||||
</el-card>
|
||||
|
||||
<el-card shadow="never" class="mb-16" :class="method === 'complete' ? 'active' : ''">
|
||||
<el-radio label="complete" size="large">
|
||||
<p class="mb-4">整体同步</p>
|
||||
<el-text type="info">先删除本地知识库所有文档,重新获取 Web 站点文档</el-text>
|
||||
</el-radio>
|
||||
</el-card>
|
||||
</el-radio-group>
|
||||
<p class="danger">注意:所有同步都会删除已有数据重新获取新数据,请谨慎操作。</p>
|
||||
<template #footer>
|
||||
<span class="dialog-footer">
|
||||
<el-button @click.prevent="dialogVisible = false"> 取消 </el-button>
|
||||
<el-button type="primary" @click="submit" :loading="loading"> 确定 </el-button>
|
||||
</span>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
<script setup lang="ts">
|
||||
import { ref, watch } from 'vue'
|
||||
|
||||
import { MsgSuccess } from '@/utils/message'
|
||||
|
||||
import useStore from '@/stores'
|
||||
const { dataset } = useStore()
|
||||
|
||||
const emit = defineEmits(['refresh'])
|
||||
const loading = ref<boolean>(false)
|
||||
const method = ref('replace')
|
||||
const datasetId = ref('')
|
||||
|
||||
const dialogVisible = ref<boolean>(false)
|
||||
|
||||
watch(dialogVisible, (bool) => {
|
||||
if (!bool) {
|
||||
method.value = 'replace'
|
||||
}
|
||||
})
|
||||
|
||||
const open = (id: string) => {
|
||||
datasetId.value = id
|
||||
dialogVisible.value = true
|
||||
}
|
||||
|
||||
const submit = () => {
|
||||
dataset.asyncSyncDateset(datasetId.value, method.value, loading).then((res: any) => {
|
||||
// MsgSuccess('删除成功')
|
||||
emit('refresh', res.data)
|
||||
dialogVisible.value = false
|
||||
})
|
||||
}
|
||||
|
||||
defineExpose({ open })
|
||||
</script>
|
||||
<style lang="scss" scoped>
|
||||
.select-provider {
|
||||
font-size: 16px;
|
||||
color: rgba(100, 106, 115, 1);
|
||||
font-weight: 400;
|
||||
line-height: 24px;
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
color: var(--el-color-primary);
|
||||
}
|
||||
}
|
||||
.active-breadcrumb {
|
||||
font-size: 16px;
|
||||
color: rgba(31, 35, 41, 1);
|
||||
font-weight: 500;
|
||||
line-height: 24px;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
>
|
||||
<el-button v-if="datasetDetail.type === '1'" type="primary">导入文档</el-button>
|
||||
<!-- <el-button v-if="datasetDetail.type === '1'">批量同步</el-button> -->
|
||||
<el-button>批量删除</el-button>
|
||||
<el-button :disabled="multipleSelection.length === 0">批量删除</el-button>
|
||||
</div>
|
||||
|
||||
<el-input
|
||||
|
|
@ -24,6 +24,7 @@
|
|||
/>
|
||||
</div>
|
||||
<app-table
|
||||
ref="multipleTableRef"
|
||||
class="mt-16"
|
||||
:data="documentData"
|
||||
:pagination-config="paginationConfig"
|
||||
|
|
@ -34,8 +35,10 @@
|
|||
@cell-mouse-leave="cellMouseLeave"
|
||||
@creatQuick="creatQuickHandle"
|
||||
@row-click="rowClickHandle"
|
||||
@selection-change="handleSelectionChange"
|
||||
v-loading="loading"
|
||||
>
|
||||
<el-table-column type="selection" width="55" />
|
||||
<el-table-column prop="name" label="文件名称" min-width="280">
|
||||
<template #default="{ row }">
|
||||
<ReadWrite
|
||||
|
|
@ -140,6 +143,7 @@
|
|||
<script setup lang="ts">
|
||||
import { ref, onMounted, reactive, onBeforeUnmount } from 'vue'
|
||||
import { useRouter, useRoute } from 'vue-router'
|
||||
import { ElTable } from 'element-plus'
|
||||
import documentApi from '@/api/document'
|
||||
import { numberFormat } from '@/utils/utils'
|
||||
import { datetimeFormat } from '@/utils/time'
|
||||
|
|
@ -165,6 +169,13 @@ const paginationConfig = reactive({
|
|||
total: 0
|
||||
})
|
||||
|
||||
const multipleTableRef = ref<InstanceType<typeof ElTable>>()
|
||||
const multipleSelection = ref<any[]>([])
|
||||
|
||||
const handleSelectionChange = (val: any[]) => {
|
||||
multipleSelection.value = val
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化轮询
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue