fix: 补充被覆盖掉的更新
This commit is contained in:
parent
0ef003e0b1
commit
c0a3c956aa
|
|
@ -88,6 +88,7 @@
|
||||||
:header-row-style="{ height: '50px' }"
|
:header-row-style="{ height: '50px' }"
|
||||||
@selection-change="handleSelectionChange"
|
@selection-change="handleSelectionChange"
|
||||||
@row-dblclick="handleRowDoubleClick"
|
@row-dblclick="handleRowDoubleClick"
|
||||||
|
@sort-change="handleSortChange"
|
||||||
>
|
>
|
||||||
<el-table-column type="selection" width="55" />
|
<el-table-column type="selection" width="55" />
|
||||||
<el-table-column
|
<el-table-column
|
||||||
|
|
@ -97,7 +98,7 @@
|
||||||
type="index"
|
type="index"
|
||||||
:index="indexMethod"
|
:index="indexMethod"
|
||||||
/>
|
/>
|
||||||
<el-table-column prop="fileName" :label="t('vabI18n.knowledge.document.table.fileName')" min-width="250">
|
<el-table-column prop="fileName" :label="t('vabI18n.knowledge.document.table.fileName')" min-width="250" sortable="custom" :sort-orders="['ascending', 'descending']">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="file-name-cell">
|
<div class="file-name-cell">
|
||||||
<img
|
<img
|
||||||
|
|
@ -132,14 +133,14 @@
|
||||||
<span v-else class="folder-status">--</span>
|
<span v-else class="folder-status">--</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="createDate" :label="t('vabI18n.knowledge.document.table.createDate')" width="180" />
|
<el-table-column prop="createDate" :label="t('vabI18n.knowledge.document.table.createDate')" width="180" sortable="custom" :sort-orders="['ascending', 'descending']" />
|
||||||
<el-table-column prop="charCount" :label="t('vabI18n.knowledge.document.table.charCount')" width="120" align="right">
|
<el-table-column prop="charCount" :label="t('vabI18n.knowledge.document.table.charCount')" width="120" align="right" sortable="custom" :sort-orders="['ascending', 'descending']">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<span class="char-count" v-if="row.type === 'file'">{{ formatFileSize(row.charCount) }}</span>
|
<span class="char-count" v-if="row.type === 'file'">{{ formatFileSize(row.charCount) }}</span>
|
||||||
<span v-else class="folder-indicator">--</span>
|
<span v-else class="folder-indicator">--</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column :label="t('vabI18n.knowledge.document.table.actions')" width="320" fixed="right">
|
<el-table-column :label="t('vabI18n.knowledge.document.table.actions')" width="380" fixed="right">
|
||||||
<template #default="{ row }">
|
<template #default="{ row }">
|
||||||
<div class="action-buttons">
|
<div class="action-buttons">
|
||||||
<!-- 文件操作 -->
|
<!-- 文件操作 -->
|
||||||
|
|
@ -166,6 +167,15 @@
|
||||||
>
|
>
|
||||||
{{t('vabI18n.knowledge.document.buttons.download')}}
|
{{t('vabI18n.knowledge.document.buttons.download')}}
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
:icon="Upload"
|
||||||
|
text
|
||||||
|
class="action-btn"
|
||||||
|
@click="handleFileReplaceFromRow(row)"
|
||||||
|
>
|
||||||
|
替换
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
<!-- 文件夹操作 -->
|
<!-- 文件夹操作 -->
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
|
@ -235,6 +245,43 @@
|
||||||
/>
|
/>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
<!-- 文件替换对话框 -->
|
||||||
|
<el-dialog
|
||||||
|
v-model="replaceDialogVisible"
|
||||||
|
title="替换文件"
|
||||||
|
width="900px"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
class="upload-dialog"
|
||||||
|
>
|
||||||
|
<div v-if="replaceTargetFile" class="replace-info">
|
||||||
|
<div class="target-file-info">
|
||||||
|
<h4>将要替换的文件:</h4>
|
||||||
|
<div class="file-info-card">
|
||||||
|
<img
|
||||||
|
:src="getFileTypeIcon(replaceTargetFile.fileType)"
|
||||||
|
alt="文件图标"
|
||||||
|
class="file-icon"
|
||||||
|
/>
|
||||||
|
<div class="file-details">
|
||||||
|
<div class="file-name">{{ replaceTargetFile.fileName }}</div>
|
||||||
|
<div class="file-meta">
|
||||||
|
<span>大小:{{ formatFileSize(replaceTargetFile.charCount) }}</span>
|
||||||
|
<span>创建时间:{{ replaceTargetFile.createDate }}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<DocUpload
|
||||||
|
:visible="replaceDialogVisible"
|
||||||
|
:dataset-id="datasetId"
|
||||||
|
:parent-id="currentParentId"
|
||||||
|
:replace-file-id="replaceTargetFile?.id"
|
||||||
|
@update:visible="replaceDialogVisible = $event"
|
||||||
|
@success="handleReplaceSuccess"
|
||||||
|
/>
|
||||||
|
</el-dialog>
|
||||||
|
|
||||||
<!-- 预览抽屉 -->
|
<!-- 预览抽屉 -->
|
||||||
|
|
||||||
<el-drawer
|
<el-drawer
|
||||||
|
|
@ -312,7 +359,7 @@
|
||||||
|
|
||||||
<el-dialog
|
<el-dialog
|
||||||
v-model="previewDialogVisible"
|
v-model="previewDialogVisible"
|
||||||
:title="分段详情"
|
title="分段详情"
|
||||||
:direction="'rtl'"
|
:direction="'rtl'"
|
||||||
size="80%"
|
size="80%"
|
||||||
class="preview-drawer"
|
class="preview-drawer"
|
||||||
|
|
@ -513,7 +560,7 @@ const segmentIsLoading = ref(false)
|
||||||
const segmentPage = ref(2)
|
const segmentPage = ref(2)
|
||||||
const segmentPageSize = ref(10)
|
const segmentPageSize = ref(10)
|
||||||
const segmentdocId = ref('')
|
const segmentdocId = ref('')
|
||||||
const previewSegment = ref("")
|
const previewSegment = ref<any>({})
|
||||||
const previewDialogVisible = ref(false)
|
const previewDialogVisible = ref(false)
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -522,6 +569,8 @@ const datasetName = ref('');
|
||||||
const previewLoading = ref(true)
|
const previewLoading = ref(true)
|
||||||
|
|
||||||
const uploadDialogVisible = ref(false)
|
const uploadDialogVisible = ref(false)
|
||||||
|
const replaceDialogVisible = ref(false)
|
||||||
|
const replaceTargetFile = ref<FileItem | null>(null)
|
||||||
|
|
||||||
// 重命名相关
|
// 重命名相关
|
||||||
const renameDialogVisible = ref(false)
|
const renameDialogVisible = ref(false)
|
||||||
|
|
@ -577,6 +626,8 @@ const handleClose = () => {
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
// 清理右键菜单事件监听器
|
// 清理右键菜单事件监听器
|
||||||
document.removeEventListener('click', hideContextMenu)
|
document.removeEventListener('click', hideContextMenu)
|
||||||
|
// 停止自动刷新定时器
|
||||||
|
stopAutoRefresh()
|
||||||
})
|
})
|
||||||
|
|
||||||
const getFileTypeIcon = (fileType: string) => {
|
const getFileTypeIcon = (fileType: string) => {
|
||||||
|
|
@ -829,6 +880,12 @@ const triggerFileInput = () => {
|
||||||
uploadDialogVisible.value = true
|
uploadDialogVisible.value = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 文件替换处理 - 从行操作触发
|
||||||
|
const handleFileReplaceFromRow = (row: FileItem) => {
|
||||||
|
replaceTargetFile.value = row
|
||||||
|
replaceDialogVisible.value = true
|
||||||
|
}
|
||||||
|
|
||||||
const indexMethod = (index: number) => {
|
const indexMethod = (index: number) => {
|
||||||
return (pagination.current - 1) * pagination.size + index + 1
|
return (pagination.current - 1) * pagination.size + index + 1
|
||||||
}
|
}
|
||||||
|
|
@ -839,9 +896,22 @@ return (pagination.current - 1) * pagination.size + index + 1
|
||||||
const handleUploadSuccess = async () => {
|
const handleUploadSuccess = async () => {
|
||||||
uploadDialogVisible.value = false
|
uploadDialogVisible.value = false
|
||||||
await fetchDocuments()
|
await fetchDocuments()
|
||||||
|
// ElNotification({
|
||||||
|
// title: t('vabI18n.knowledge.document.messages.uploadSuccess'),
|
||||||
|
// message: t('vabI18n.knowledge.document.messages.uploadSuccessEnd'),
|
||||||
|
// type: 'success'
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
|
||||||
|
// 处理文件替换成功回调
|
||||||
|
const handleReplaceSuccess = async () => {
|
||||||
|
replaceDialogVisible.value = false
|
||||||
|
replaceTargetFile.value = null
|
||||||
|
selectedRows.value = [] // 清空选择
|
||||||
|
await fetchDocuments()
|
||||||
ElNotification({
|
ElNotification({
|
||||||
title: t('vabI18n.knowledge.document.messages.uploadSuccess'),
|
title: '替换成功',
|
||||||
message: t('vabI18n.knowledge.document.messages.uploadSuccessEnd'),
|
message: '文件替换成功',
|
||||||
type: 'success'
|
type: 'success'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -971,6 +1041,34 @@ const handlePreview = async (row: FileItem) => {
|
||||||
// 在script setup部分添加loading状态
|
// 在script setup部分添加loading状态
|
||||||
const tableLoading = ref(false)
|
const tableLoading = ref(false)
|
||||||
|
|
||||||
|
// 定时器相关
|
||||||
|
const refreshTimer = ref<NodeJS.Timeout | null>(null)
|
||||||
|
|
||||||
|
// 排序数据
|
||||||
|
const sortConfig = reactive({
|
||||||
|
orderBy: 'name',
|
||||||
|
orderDirection: 'ASC'
|
||||||
|
})
|
||||||
|
|
||||||
|
// 启动定时器
|
||||||
|
const startAutoRefresh = () => {
|
||||||
|
stopAutoRefresh() // 先清除可能存在的定时器
|
||||||
|
refreshTimer.value = setInterval(() => {
|
||||||
|
// 只有在非加载状态下才自动刷新
|
||||||
|
if (!tableLoading.value) {
|
||||||
|
fetchDocuments()
|
||||||
|
}
|
||||||
|
}, 30000) // 30秒刷新一次
|
||||||
|
}
|
||||||
|
|
||||||
|
// 停止定时器
|
||||||
|
const stopAutoRefresh = () => {
|
||||||
|
if (refreshTimer.value) {
|
||||||
|
clearInterval(refreshTimer.value)
|
||||||
|
refreshTimer.value = null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 修改fetchDocuments函数
|
// 修改fetchDocuments函数
|
||||||
const fetchDocuments = async () => {
|
const fetchDocuments = async () => {
|
||||||
tableLoading.value = true
|
tableLoading.value = true
|
||||||
|
|
@ -979,8 +1077,8 @@ try {
|
||||||
difyDatasetId: datasetId.value,
|
difyDatasetId: datasetId.value,
|
||||||
parentId: currentParentId.value, // 使用当前文件夹ID
|
parentId: currentParentId.value, // 使用当前文件夹ID
|
||||||
fileName: searchKeyword.value || undefined,
|
fileName: searchKeyword.value || undefined,
|
||||||
orderBy: 'name',
|
orderBy: sortConfig.orderBy,
|
||||||
orderDirection: 'ASC',
|
orderDirection: sortConfig.orderDirection,
|
||||||
pageNo: pagination.current,
|
pageNo: pagination.current,
|
||||||
pageSize: pagination.size
|
pageSize: pagination.size
|
||||||
}
|
}
|
||||||
|
|
@ -1119,6 +1217,8 @@ datasetId.value = route.params.id as string
|
||||||
datasetName.value = route.query.name as string
|
datasetName.value = route.query.name as string
|
||||||
// 这里可以调用API获取详细数据
|
// 这里可以调用API获取详细数据
|
||||||
await fetchDocuments()
|
await fetchDocuments()
|
||||||
|
// 启动自动刷新定时器
|
||||||
|
startAutoRefresh()
|
||||||
})
|
})
|
||||||
|
|
||||||
// 分页变化处理
|
// 分页变化处理
|
||||||
|
|
@ -1132,6 +1232,25 @@ pagination.current = 1
|
||||||
fetchDocuments()
|
fetchDocuments()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 排序变化处理
|
||||||
|
const handleSortChange = (sortInfo: any) => {
|
||||||
|
if (sortInfo.prop && sortInfo.order) {
|
||||||
|
// 映射前端字段到后端字段
|
||||||
|
const fieldMapping: Record<string, string> = {
|
||||||
|
'fileName': 'name',
|
||||||
|
'createDate': 'created_at',
|
||||||
|
'charCount': 'size'
|
||||||
|
}
|
||||||
|
|
||||||
|
sortConfig.orderBy = fieldMapping[sortInfo.prop] || sortInfo.prop
|
||||||
|
sortConfig.orderDirection = sortInfo.order === 'ascending' ? 'ASC' : 'DESC'
|
||||||
|
|
||||||
|
// 重置到第一页并刷新数据
|
||||||
|
pagination.current = 1
|
||||||
|
fetchDocuments()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 处理文件夹打开
|
// 处理文件夹打开
|
||||||
const handleOpenFolder = (row: FileItem) => {
|
const handleOpenFolder = (row: FileItem) => {
|
||||||
// 设置当前文件夹ID并更新面包屑路径
|
// 设置当前文件夹ID并更新面包屑路径
|
||||||
|
|
@ -2346,6 +2465,7 @@ transform: scale(0.9) translateY(-5px);
|
||||||
line-height: 1.6;
|
line-height: 1.6;
|
||||||
display: -webkit-box;
|
display: -webkit-box;
|
||||||
-webkit-line-clamp: 4;
|
-webkit-line-clamp: 4;
|
||||||
|
line-clamp: 4;
|
||||||
-webkit-box-orient: vertical;
|
-webkit-box-orient: vertical;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
|
|
@ -2442,4 +2562,64 @@ transform: scale(0.9) translateY(-5px);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 文件替换信息样式
|
||||||
|
.replace-info {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
padding: 20px;
|
||||||
|
background: #f8f9fa;
|
||||||
|
border-radius: 8px;
|
||||||
|
border-left: 4px solid #e6a23c;
|
||||||
|
|
||||||
|
.target-file-info {
|
||||||
|
h4 {
|
||||||
|
margin: 0 0 16px 0;
|
||||||
|
color: #303133;
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-info-card {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 16px;
|
||||||
|
background: white;
|
||||||
|
border-radius: 6px;
|
||||||
|
border: 1px solid #ebeef5;
|
||||||
|
|
||||||
|
.file-icon {
|
||||||
|
width: 32px;
|
||||||
|
height: 32px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
object-fit: contain;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-details {
|
||||||
|
flex: 1;
|
||||||
|
|
||||||
|
.file-name {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #303133;
|
||||||
|
margin-bottom: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.file-meta {
|
||||||
|
display: flex;
|
||||||
|
gap: 16px;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #909399;
|
||||||
|
|
||||||
|
span {
|
||||||
|
&:not(:last-child)::after {
|
||||||
|
content: '•';
|
||||||
|
margin-left: 8px;
|
||||||
|
color: #dcdfe6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ public class DifyDatasetApiServiceImpl implements DifyDatasetApiService {
|
||||||
|
|
||||||
|
|
||||||
// 5. 如果是深度解析,提交到队列处理
|
// 5. 如果是深度解析,提交到队列处理
|
||||||
if (DifyConstants.ANALYSIS_STRATEGY_DEEP.equals(request.getAnalysisStrategyType())) {
|
if (DifyConstants.ANALYSIS_STRATEGY_DEEP.equals(request.getAnalysisStrategyType()) && "pdf".equals(fileExtension)) {
|
||||||
stepStartTime = System.currentTimeMillis();
|
stepStartTime = System.currentTimeMillis();
|
||||||
logger.info("开始PDF深度解析队列处理");
|
logger.info("开始PDF深度解析队列处理");
|
||||||
|
|
||||||
|
|
@ -630,7 +630,7 @@ public class DifyDatasetApiServiceImpl implements DifyDatasetApiService {
|
||||||
}
|
}
|
||||||
return strategy;
|
return strategy;
|
||||||
} else {
|
} else {
|
||||||
List<DocAnalysisStrategy> strategies = docAnalysisStrategyService.queryByName(analysisStrategyType);
|
List<DocAnalysisStrategy> strategies = docAnalysisStrategyService.queryByName("adaption");
|
||||||
if (strategies == null || strategies.isEmpty()) {
|
if (strategies == null || strategies.isEmpty()) {
|
||||||
throw new DifyServiceException(DifyConstants.ERROR_STRATEGY_NULL);
|
throw new DifyServiceException(DifyConstants.ERROR_STRATEGY_NULL);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue