2025-08-05 18:00:45 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="file-table-container">
|
|
|
|
|
|
<div class="panel-header">
|
2026-01-04 22:47:39 +08:00
|
|
|
|
<div class="upload-btn-group">
|
|
|
|
|
|
<a-dropdown trigger="click">
|
|
|
|
|
|
<a-button type="primary" size="small" class="upload-btn">
|
|
|
|
|
|
<FileUp size="14" style="margin-left: 4px;" />
|
|
|
|
|
|
上传
|
|
|
|
|
|
<ChevronDown size="14" style="margin-left: 4px;" />
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
<template #overlay>
|
|
|
|
|
|
<a-menu>
|
|
|
|
|
|
<a-menu-item key="upload-file" @click="showAddFilesModal({ isFolder: false })" :icon="h(FileUp, { size: 16 })">
|
|
|
|
|
|
上传文件
|
|
|
|
|
|
</a-menu-item>
|
|
|
|
|
|
<a-menu-item key="upload-folder" @click="showAddFilesModal({ isFolder: true })" :icon="h(FolderUp, { size: 16 })">
|
|
|
|
|
|
上传文件夹
|
|
|
|
|
|
</a-menu-item>
|
|
|
|
|
|
</a-menu>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</a-dropdown>
|
|
|
|
|
|
|
|
|
|
|
|
<a-button class="panel-action-btn" type="text" size="small" @click="showCreateFolderModal" title="新建文件夹">
|
|
|
|
|
|
<template #icon><FolderPlus size="16" /></template>
|
|
|
|
|
|
</a-button>
|
2025-08-05 18:00:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<div class="panel-actions">
|
2025-10-25 16:01:50 +08:00
|
|
|
|
<a-input
|
|
|
|
|
|
v-model:value="filenameFilter"
|
2026-01-04 22:47:39 +08:00
|
|
|
|
placeholder="搜索"
|
2025-10-25 16:01:50 +08:00
|
|
|
|
size="small"
|
|
|
|
|
|
class="action-searcher"
|
|
|
|
|
|
allow-clear
|
|
|
|
|
|
@change="onFilterChange"
|
2026-01-04 22:47:39 +08:00
|
|
|
|
>
|
|
|
|
|
|
<template #prefix>
|
|
|
|
|
|
<Search size="14" style="color: var(--gray-400);" />
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</a-input>
|
|
|
|
|
|
|
|
|
|
|
|
<a-dropdown trigger="click">
|
|
|
|
|
|
<a-button type="text" class="panel-action-btn" title="排序">
|
|
|
|
|
|
<template #icon><ArrowUpDown size="16" /></template>
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
<template #overlay>
|
|
|
|
|
|
<a-menu :selectedKeys="[sortField]" @click="handleSortMenuClick">
|
|
|
|
|
|
<a-menu-item v-for="opt in sortOptions" :key="opt.value">
|
|
|
|
|
|
{{ opt.label }}
|
|
|
|
|
|
</a-menu-item>
|
|
|
|
|
|
</a-menu>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</a-dropdown>
|
|
|
|
|
|
|
|
|
|
|
|
<a-dropdown trigger="click">
|
|
|
|
|
|
<a-button type="text" class="panel-action-btn" :class="{ 'active': statusFilter }" title="筛选状态">
|
|
|
|
|
|
<template #icon><Filter size="16" /></template>
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
<template #overlay>
|
|
|
|
|
|
<a-menu :selectedKeys="statusFilter ? [statusFilter] : []" @click="handleStatusMenuClick">
|
|
|
|
|
|
<a-menu-item key="all">全部状态</a-menu-item>
|
|
|
|
|
|
<a-menu-item v-for="opt in statusOptions" :key="opt.value">
|
|
|
|
|
|
{{ opt.label }}
|
|
|
|
|
|
</a-menu-item>
|
|
|
|
|
|
</a-menu>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</a-dropdown>
|
|
|
|
|
|
|
2025-08-05 18:00:45 +08:00
|
|
|
|
<a-button
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
@click="handleRefresh"
|
|
|
|
|
|
:loading="refreshing"
|
|
|
|
|
|
title="刷新"
|
2025-10-25 16:01:50 +08:00
|
|
|
|
class="panel-action-btn"
|
2026-01-04 22:47:39 +08:00
|
|
|
|
>
|
|
|
|
|
|
<template #icon><RotateCw size="16" /></template>
|
|
|
|
|
|
</a-button>
|
2026-01-02 15:02:04 +08:00
|
|
|
|
<a-button
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
@click="toggleSelectionMode"
|
|
|
|
|
|
title="多选"
|
|
|
|
|
|
class="panel-action-btn"
|
|
|
|
|
|
:class="{ 'active': isSelectionMode }"
|
2026-01-04 22:47:39 +08:00
|
|
|
|
>
|
|
|
|
|
|
<template #icon><CheckSquare size="16" /></template>
|
|
|
|
|
|
</a-button>
|
2025-09-06 14:04:33 +08:00
|
|
|
|
<!-- <a-button
|
2025-08-05 18:00:45 +08:00
|
|
|
|
@click="toggleAutoRefresh"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
:type="autoRefresh ? 'primary' : 'default'"
|
|
|
|
|
|
title="自动刷新文件状态"
|
|
|
|
|
|
class="auto-refresh-btn panel-action-btn"
|
|
|
|
|
|
>
|
|
|
|
|
|
Auto
|
2025-09-06 14:04:33 +08:00
|
|
|
|
</a-button> -->
|
2025-10-25 16:01:50 +08:00
|
|
|
|
<a-button
|
2025-08-05 18:00:45 +08:00
|
|
|
|
type="text"
|
|
|
|
|
|
@click="toggleRightPanel"
|
|
|
|
|
|
title="切换右侧面板"
|
|
|
|
|
|
class="panel-action-btn expand"
|
|
|
|
|
|
:class="{ 'expanded': props.rightPanelVisible }"
|
2026-01-04 22:47:39 +08:00
|
|
|
|
>
|
|
|
|
|
|
<template #icon><ChevronLast size="16" /></template>
|
|
|
|
|
|
</a-button>
|
2025-08-05 18:00:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-01-06 19:32:27 +08:00
|
|
|
|
<div class="batch-actions" v-if="isSelectionMode">
|
2025-08-05 18:00:45 +08:00
|
|
|
|
<div class="batch-info">
|
2026-01-06 19:32:27 +08:00
|
|
|
|
<a-checkbox
|
|
|
|
|
|
:checked="isAllSelected"
|
|
|
|
|
|
:indeterminate="isPartiallySelected"
|
|
|
|
|
|
@change="onSelectAllChange"
|
|
|
|
|
|
style="margin-right: 8px;"
|
|
|
|
|
|
/>
|
2025-08-05 18:00:45 +08:00
|
|
|
|
<span>{{ selectedRowKeys.length }} 项</span>
|
|
|
|
|
|
</div>
|
2026-01-07 11:16:08 +08:00
|
|
|
|
<div style="display: flex; gap: 8px;">
|
2025-11-12 09:14:07 +08:00
|
|
|
|
<a-button
|
2025-11-14 00:56:24 +08:00
|
|
|
|
type="link"
|
2026-01-04 21:35:25 +08:00
|
|
|
|
@click="handleBatchParse"
|
|
|
|
|
|
:loading="batchParsing"
|
|
|
|
|
|
:disabled="!canBatchParse"
|
2026-01-04 22:47:39 +08:00
|
|
|
|
:icon="h(FileText, { size: 16 })"
|
2026-01-07 11:16:08 +08:00
|
|
|
|
>
|
|
|
|
|
|
批量解析
|
|
|
|
|
|
</a-button>
|
2026-01-04 21:35:25 +08:00
|
|
|
|
<a-button
|
|
|
|
|
|
type="link"
|
|
|
|
|
|
@click="handleBatchIndex"
|
|
|
|
|
|
:loading="batchIndexing"
|
|
|
|
|
|
:disabled="!canBatchIndex"
|
2026-01-04 22:47:39 +08:00
|
|
|
|
:icon="h(Database, { size: 16 })"
|
2026-01-07 11:16:08 +08:00
|
|
|
|
>
|
|
|
|
|
|
批量入库
|
|
|
|
|
|
</a-button>
|
2025-11-12 09:14:07 +08:00
|
|
|
|
<a-button
|
2025-11-14 00:56:24 +08:00
|
|
|
|
type="link"
|
2025-11-12 09:14:07 +08:00
|
|
|
|
danger
|
|
|
|
|
|
@click="handleBatchDelete"
|
|
|
|
|
|
:loading="batchDeleting"
|
|
|
|
|
|
:disabled="!canBatchDelete"
|
2026-01-04 22:47:39 +08:00
|
|
|
|
:icon="h(Trash2, { size: 16 })"
|
2026-01-07 11:16:08 +08:00
|
|
|
|
>
|
|
|
|
|
|
批量删除
|
|
|
|
|
|
</a-button>
|
2025-11-12 09:14:07 +08:00
|
|
|
|
</div>
|
2025-08-05 18:00:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
<!-- 入库/重新入库参数配置模态框 -->
|
2025-11-12 09:14:07 +08:00
|
|
|
|
<a-modal
|
2026-01-04 21:35:25 +08:00
|
|
|
|
v-model:open="indexConfigModalVisible"
|
|
|
|
|
|
:title="indexConfigModalTitle"
|
|
|
|
|
|
:confirm-loading="indexConfigModalLoading"
|
2025-11-12 09:14:07 +08:00
|
|
|
|
width="600px"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #footer>
|
2026-01-04 21:35:25 +08:00
|
|
|
|
<a-button key="back" @click="handleIndexConfigCancel">取消</a-button>
|
|
|
|
|
|
<a-button key="submit" type="primary" @click="handleIndexConfigConfirm">确定</a-button>
|
2025-11-12 09:14:07 +08:00
|
|
|
|
</template>
|
2026-01-04 21:35:25 +08:00
|
|
|
|
<div class="index-params">
|
2025-11-12 09:14:07 +08:00
|
|
|
|
<ChunkParamsConfig
|
2026-01-04 21:35:25 +08:00
|
|
|
|
:temp-chunk-params="indexParams"
|
2025-11-12 09:14:07 +08:00
|
|
|
|
:show-qa-split="true"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</a-modal>
|
|
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
<!-- 新建文件夹模态框 -->
|
|
|
|
|
|
<a-modal
|
|
|
|
|
|
v-model:open="createFolderModalVisible"
|
|
|
|
|
|
title="新建文件夹"
|
|
|
|
|
|
:confirm-loading="createFolderLoading"
|
|
|
|
|
|
@ok="handleCreateFolder"
|
|
|
|
|
|
>
|
|
|
|
|
|
<a-input
|
|
|
|
|
|
v-model:value="newFolderName"
|
|
|
|
|
|
placeholder="请输入文件夹名称"
|
|
|
|
|
|
@pressEnter="handleCreateFolder"
|
|
|
|
|
|
/>
|
|
|
|
|
|
</a-modal>
|
|
|
|
|
|
|
2025-08-05 18:00:45 +08:00
|
|
|
|
<a-table
|
|
|
|
|
|
:columns="columnsCompact"
|
|
|
|
|
|
:data-source="filteredFiles"
|
|
|
|
|
|
row-key="file_id"
|
2025-11-06 21:59:48 +08:00
|
|
|
|
class="my-table"
|
2025-08-05 18:00:45 +08:00
|
|
|
|
size="small"
|
2026-01-04 21:35:25 +08:00
|
|
|
|
:show-header="false"
|
2026-01-05 00:46:34 +08:00
|
|
|
|
:pagination="false"
|
2025-12-30 14:28:48 +08:00
|
|
|
|
v-model:expandedRowKeys="expandedRowKeys"
|
|
|
|
|
|
:custom-row="customRow"
|
2026-01-02 15:02:04 +08:00
|
|
|
|
:row-selection="isSelectionMode ? {
|
2025-08-05 18:00:45 +08:00
|
|
|
|
selectedRowKeys: selectedRowKeys,
|
|
|
|
|
|
onChange: onSelectChange,
|
|
|
|
|
|
getCheckboxProps: getCheckboxProps
|
2026-01-02 15:02:04 +08:00
|
|
|
|
} : null"
|
2025-08-05 18:00:45 +08:00
|
|
|
|
:locale="{
|
|
|
|
|
|
emptyText: emptyText
|
|
|
|
|
|
}">
|
|
|
|
|
|
<template #bodyCell="{ column, text, record }">
|
2025-12-30 14:28:48 +08:00
|
|
|
|
<div v-if="column.key === 'filename'">
|
|
|
|
|
|
<template v-if="record.is_folder">
|
2025-12-30 23:57:20 +08:00
|
|
|
|
<span class="folder-row" @click="toggleExpand(record)">
|
|
|
|
|
|
<component :is="expandedRowKeys.includes(record.file_id) ? h(FolderOpenFilled) : h(FolderFilled)" style="margin-right: 12px; color: #ffb800;" />
|
2025-12-30 14:28:48 +08:00
|
|
|
|
{{ record.filename }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</template>
|
2026-01-05 00:46:34 +08:00
|
|
|
|
<a-popover v-else placement="right" overlayClassName="file-info-popover" :mouseEnterDelay="0.5">
|
2026-01-04 21:35:25 +08:00
|
|
|
|
<template #content>
|
|
|
|
|
|
<div class="file-info-card">
|
|
|
|
|
|
<div class="info-row"><span class="label">ID:</span> <span class="value">{{ record.file_id }}</span></div>
|
|
|
|
|
|
<div class="info-row"><span class="label">状态:</span> <span class="value">{{ getStatusText(record.status) }}</span></div>
|
|
|
|
|
|
<div class="info-row"><span class="label">时间:</span> <span class="value">{{ formatRelativeTime(record.created_at) }}</span></div>
|
|
|
|
|
|
<div v-if="record.error_message" class="info-row error"><span class="label">错误:</span> <span class="value">{{ record.error_message }}</span></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<a-button class="main-btn" type="link" @click="openFileDetail(record)">
|
|
|
|
|
|
<component :is="getFileIcon(record.displayName || text)" :style="{ marginRight: '6px', color: getFileIconColor(record.displayName || text) }" />
|
|
|
|
|
|
{{ record.displayName || text }}
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
</a-popover>
|
2025-12-30 14:28:48 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<span v-else-if="column.key === 'type'">
|
|
|
|
|
|
<span v-if="!record.is_folder" :class="['span-type', text]">{{ text?.toUpperCase() }}</span>
|
|
|
|
|
|
</span>
|
2025-08-05 18:00:45 +08:00
|
|
|
|
<div v-else-if="column.key === 'status'" style="display: flex; align-items: center; justify-content: flex-end;">
|
2025-12-30 14:28:48 +08:00
|
|
|
|
<template v-if="!record.is_folder">
|
2026-01-04 21:35:25 +08:00
|
|
|
|
<a-tooltip :title="getStatusText(text)">
|
|
|
|
|
|
<span v-if="text === 'done' || text === 'indexed'" style="color: var(--color-success-500);"><CheckCircleFilled /></span>
|
|
|
|
|
|
<span v-else-if="text === 'failed' || text === 'error_parsing' || text === 'error_indexing'" style="color: var(--color-error-500);"><CloseCircleFilled /></span>
|
|
|
|
|
|
<span v-else-if="text === 'processing' || text === 'parsing' || text === 'indexing'" style="color: var(--color-info-500);"><HourglassFilled /></span>
|
|
|
|
|
|
<span v-else-if="text === 'waiting' || text === 'uploaded'" style="color: var(--color-warning-500);"><ClockCircleFilled /></span>
|
|
|
|
|
|
<span v-else-if="text === 'parsed'" style="color: var(--color-primary-500);"><FileTextFilled /></span>
|
|
|
|
|
|
<span v-else>{{ text }}</span>
|
|
|
|
|
|
</a-tooltip>
|
2025-12-30 14:28:48 +08:00
|
|
|
|
</template>
|
2025-08-05 18:00:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2025-11-14 00:56:24 +08:00
|
|
|
|
<div v-else-if="column.key === 'action'" class="table-row-actions">
|
2026-01-04 21:35:25 +08:00
|
|
|
|
<a-popover placement="bottomRight" trigger="click" overlayClassName="file-action-popover" v-model:open="popoverVisibleMap[record.file_id]">
|
2025-12-18 11:47:54 +08:00
|
|
|
|
<template #content>
|
|
|
|
|
|
<div class="file-action-list">
|
2025-12-30 14:28:48 +08:00
|
|
|
|
<template v-if="record.is_folder">
|
|
|
|
|
|
<a-button type="text" block @click="showCreateFolderModal(record.file_id)">
|
2026-01-04 22:47:39 +08:00
|
|
|
|
<template #icon><component :is="h(FolderPlus)" size="14" /></template>
|
2025-12-30 14:28:48 +08:00
|
|
|
|
新建子文件夹
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
<a-button type="text" block danger @click="handleDeleteFolder(record)">
|
2026-01-04 22:47:39 +08:00
|
|
|
|
<template #icon><component :is="h(Trash2)" size="14" /></template>
|
2025-12-30 14:28:48 +08:00
|
|
|
|
删除文件夹
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<template v-else>
|
2026-01-04 21:35:25 +08:00
|
|
|
|
<a-button type="text" block @click="handleDownloadFile(record)" :disabled="lock || !['done', 'indexed', 'parsed', 'error_indexing'].includes(record.status)">
|
2026-01-04 22:47:39 +08:00
|
|
|
|
<template #icon><component :is="h(Download)" size="14" /></template>
|
2025-12-30 14:28:48 +08:00
|
|
|
|
下载文件
|
|
|
|
|
|
</a-button>
|
2026-01-04 21:35:25 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- Parse Action -->
|
|
|
|
|
|
<a-button v-if="record.status === 'uploaded' || record.status === 'error_parsing'" type="text" block @click="handleParseFile(record)" :disabled="lock">
|
2026-01-04 22:47:39 +08:00
|
|
|
|
<template #icon><component :is="h(FileText)" size="14" /></template>
|
2026-01-04 21:35:25 +08:00
|
|
|
|
{{ record.status === 'error_parsing' ? '重试解析' : '解析文件' }}
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Index Action -->
|
|
|
|
|
|
<a-button v-if="record.status === 'parsed' || record.status === 'error_indexing'" type="text" block @click="handleIndexFile(record)" :disabled="lock">
|
2026-01-04 22:47:39 +08:00
|
|
|
|
<template #icon><component :is="h(Database)" size="14" /></template>
|
2026-01-04 21:35:25 +08:00
|
|
|
|
{{ record.status === 'error_indexing' ? '重试入库' : '入库' }}
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- Reindex Action -->
|
|
|
|
|
|
<a-button v-if="!isLightRAG && (record.status === 'done' || record.status === 'indexed')" type="text" block @click="handleReindexFile(record)" :disabled="lock">
|
2026-01-04 22:47:39 +08:00
|
|
|
|
<template #icon><component :is="h(RotateCw)" size="14" /></template>
|
2026-01-04 21:35:25 +08:00
|
|
|
|
重新入库
|
2025-12-30 14:28:48 +08:00
|
|
|
|
</a-button>
|
2026-01-04 21:35:25 +08:00
|
|
|
|
|
|
|
|
|
|
<a-button type="text" block danger @click="handleDeleteFile(record.file_id)" :disabled="lock || ['processing', 'parsing', 'indexing'].includes(record.status)">
|
2026-01-04 22:47:39 +08:00
|
|
|
|
<template #icon><component :is="h(Trash2)" size="14" /></template>
|
2025-12-30 14:28:48 +08:00
|
|
|
|
删除文件
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
</template>
|
2025-12-18 11:47:54 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
<a-button type="text" :icon="h(Ellipsis)" class="action-trigger-btn" />
|
|
|
|
|
|
</a-popover>
|
2025-08-05 18:00:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<span v-else>{{ text }}</span>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</a-table>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
|
import { ref, computed, watch, h } from 'vue';
|
|
|
|
|
|
import { useDatabaseStore } from '@/stores/database';
|
2025-12-30 14:28:48 +08:00
|
|
|
|
import { message, Modal } from 'ant-design-vue';
|
2025-09-21 23:48:56 +08:00
|
|
|
|
import { useUserStore } from '@/stores/user';
|
|
|
|
|
|
import { documentApi } from '@/apis/knowledge_api';
|
2025-08-05 18:00:45 +08:00
|
|
|
|
import {
|
|
|
|
|
|
CheckCircleFilled,
|
|
|
|
|
|
HourglassFilled,
|
|
|
|
|
|
CloseCircleFilled,
|
|
|
|
|
|
ClockCircleFilled,
|
2025-12-30 23:57:20 +08:00
|
|
|
|
FolderFilled,
|
|
|
|
|
|
FolderOpenFilled,
|
2026-01-04 21:35:25 +08:00
|
|
|
|
FileTextFilled,
|
2025-08-05 18:00:45 +08:00
|
|
|
|
} from '@ant-design/icons-vue';
|
2025-11-14 00:56:24 +08:00
|
|
|
|
import {
|
|
|
|
|
|
Trash2,
|
|
|
|
|
|
Download,
|
2026-01-04 22:47:39 +08:00
|
|
|
|
RotateCw,
|
2025-11-14 00:56:24 +08:00
|
|
|
|
ChevronLast,
|
2025-12-18 11:47:54 +08:00
|
|
|
|
Ellipsis,
|
2025-12-30 23:57:20 +08:00
|
|
|
|
FolderPlus,
|
2026-01-02 15:02:04 +08:00
|
|
|
|
CheckSquare,
|
2026-01-04 21:35:25 +08:00
|
|
|
|
FileText,
|
|
|
|
|
|
FileCheck,
|
|
|
|
|
|
Plus,
|
|
|
|
|
|
Database,
|
2026-01-04 22:47:39 +08:00
|
|
|
|
FileUp,
|
|
|
|
|
|
FolderUp,
|
|
|
|
|
|
Search,
|
|
|
|
|
|
Filter,
|
|
|
|
|
|
ArrowUpDown,
|
|
|
|
|
|
ChevronDown,
|
2025-11-14 00:56:24 +08:00
|
|
|
|
} from 'lucide-vue-next';
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
|
|
|
|
|
const store = useDatabaseStore();
|
2025-09-21 23:48:56 +08:00
|
|
|
|
const userStore = useUserStore();
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2026-01-04 22:47:39 +08:00
|
|
|
|
const sortField = ref('filename');
|
|
|
|
|
|
const sortOptions = [
|
|
|
|
|
|
{ label: '文件名', value: 'filename' },
|
|
|
|
|
|
{ label: '创建时间', value: 'created_at' },
|
|
|
|
|
|
{ label: '状态', value: 'status' },
|
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
const handleSortMenuClick = (e) => {
|
|
|
|
|
|
sortField.value = e.key;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleStatusMenuClick = (e) => {
|
|
|
|
|
|
if (e.key === 'all') {
|
|
|
|
|
|
statusFilter.value = null;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
statusFilter.value = e.key;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
// Status text mapping
|
|
|
|
|
|
const getStatusText = (status) => {
|
|
|
|
|
|
const map = {
|
|
|
|
|
|
'uploaded': '已上传',
|
|
|
|
|
|
'parsing': '解析中',
|
|
|
|
|
|
'parsed': '已解析',
|
|
|
|
|
|
'error_parsing': '解析失败',
|
|
|
|
|
|
'indexing': '入库中',
|
|
|
|
|
|
'indexed': '已入库',
|
|
|
|
|
|
'error_indexing': '入库失败',
|
|
|
|
|
|
'done': '已入库',
|
|
|
|
|
|
'failed': '入库失败',
|
|
|
|
|
|
'processing': '处理中',
|
|
|
|
|
|
'waiting': '等待中',
|
|
|
|
|
|
};
|
|
|
|
|
|
return map[status] || status;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-08-05 18:00:45 +08:00
|
|
|
|
const props = defineProps({
|
|
|
|
|
|
rightPanelVisible: {
|
|
|
|
|
|
type: Boolean,
|
|
|
|
|
|
default: true
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const emit = defineEmits([
|
|
|
|
|
|
'showAddFilesModal',
|
|
|
|
|
|
'toggleRightPanel',
|
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
|
|
const files = computed(() => Object.values(store.database.files || {}));
|
2025-12-18 11:47:54 +08:00
|
|
|
|
const isLightRAG = computed(() => store.database?.kb_type?.toLowerCase() === 'lightrag');
|
2025-08-05 18:00:45 +08:00
|
|
|
|
const refreshing = computed(() => store.state.refrashing);
|
|
|
|
|
|
const lock = computed(() => store.state.lock);
|
|
|
|
|
|
const batchDeleting = computed(() => store.state.batchDeleting);
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const batchParsing = computed(() => store.state.chunkLoading);
|
|
|
|
|
|
const batchIndexing = computed(() => store.state.chunkLoading);
|
2025-08-05 18:00:45 +08:00
|
|
|
|
const autoRefresh = computed(() => store.state.autoRefresh);
|
|
|
|
|
|
const selectedRowKeys = computed({
|
|
|
|
|
|
get: () => store.selectedRowKeys,
|
|
|
|
|
|
set: (keys) => store.selectedRowKeys = keys,
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2026-01-02 15:02:04 +08:00
|
|
|
|
const isSelectionMode = ref(false);
|
|
|
|
|
|
|
2026-01-06 19:32:27 +08:00
|
|
|
|
const allSelectableFiles = computed(() => {
|
|
|
|
|
|
const nameFilter = filenameFilter.value.trim().toLowerCase();
|
|
|
|
|
|
const status = statusFilter.value;
|
|
|
|
|
|
|
|
|
|
|
|
return files.value.filter(file => {
|
|
|
|
|
|
if (file.is_folder) return false;
|
|
|
|
|
|
// Follow getCheckboxProps logic
|
|
|
|
|
|
if (lock.value || file.status === 'processing' || file.status === 'waiting') return false;
|
|
|
|
|
|
|
|
|
|
|
|
if (nameFilter || status) {
|
|
|
|
|
|
const nameMatch = !nameFilter || (file.filename && file.filename.toLowerCase().includes(nameFilter));
|
|
|
|
|
|
const statusMatch = !status || file.status === status ||
|
|
|
|
|
|
(status === 'indexed' && file.status === 'done') ||
|
|
|
|
|
|
(status === 'error_indexing' && file.status === 'failed');
|
|
|
|
|
|
return nameMatch && statusMatch;
|
|
|
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const isAllSelected = computed(() => {
|
|
|
|
|
|
const selectableIds = allSelectableFiles.value.map(f => f.file_id);
|
|
|
|
|
|
if (selectableIds.length === 0) return false;
|
|
|
|
|
|
return selectableIds.every(id => selectedRowKeys.value.includes(id));
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const isPartiallySelected = computed(() => {
|
|
|
|
|
|
const selectableIds = allSelectableFiles.value.map(f => f.file_id);
|
|
|
|
|
|
const selectedCount = selectableIds.filter(id => selectedRowKeys.value.includes(id)).length;
|
|
|
|
|
|
return selectedCount > 0 && selectedCount < selectableIds.length;
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const onSelectAllChange = (e) => {
|
|
|
|
|
|
if (e.target.checked) {
|
|
|
|
|
|
selectedRowKeys.value = allSelectableFiles.value.map(f => f.file_id);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
selectedRowKeys.value = [];
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
const expandedRowKeys = ref([]);
|
|
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const popoverVisibleMap = ref({});
|
|
|
|
|
|
const closePopover = (fileId) => {
|
|
|
|
|
|
if (fileId) {
|
|
|
|
|
|
popoverVisibleMap.value[fileId] = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
// 新建文件夹相关
|
|
|
|
|
|
const createFolderModalVisible = ref(false);
|
|
|
|
|
|
const newFolderName = ref('');
|
|
|
|
|
|
const createFolderLoading = ref(false);
|
|
|
|
|
|
const currentParentId = ref(null);
|
|
|
|
|
|
|
|
|
|
|
|
const showCreateFolderModal = (parentId = null) => {
|
2026-01-04 21:35:25 +08:00
|
|
|
|
if (typeof parentId === 'string') {
|
|
|
|
|
|
closePopover(parentId);
|
|
|
|
|
|
}
|
2025-12-30 14:28:48 +08:00
|
|
|
|
newFolderName.value = '';
|
|
|
|
|
|
// 如果是事件对象(来自顶部按钮点击),则设为null
|
|
|
|
|
|
if (parentId && typeof parentId === 'object') {
|
|
|
|
|
|
parentId = null;
|
|
|
|
|
|
}
|
|
|
|
|
|
currentParentId.value = parentId;
|
|
|
|
|
|
createFolderModalVisible.value = true;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const toggleExpand = (record) => {
|
|
|
|
|
|
if (!record.is_folder) return;
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
const index = expandedRowKeys.value.indexOf(record.file_id);
|
|
|
|
|
|
if (index > -1) {
|
|
|
|
|
|
expandedRowKeys.value.splice(index, 1);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
expandedRowKeys.value.push(record.file_id);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-02 15:02:04 +08:00
|
|
|
|
const toggleSelectionMode = () => {
|
|
|
|
|
|
isSelectionMode.value = !isSelectionMode.value;
|
|
|
|
|
|
if (!isSelectionMode.value) {
|
|
|
|
|
|
selectedRowKeys.value = [];
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
const handleCreateFolder = async () => {
|
|
|
|
|
|
if (!newFolderName.value.trim()) {
|
|
|
|
|
|
message.warning('请输入文件夹名称');
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
createFolderLoading.value = true;
|
|
|
|
|
|
try {
|
|
|
|
|
|
await documentApi.createFolder(store.databaseId, newFolderName.value, currentParentId.value);
|
|
|
|
|
|
message.success('创建成功');
|
|
|
|
|
|
createFolderModalVisible.value = false;
|
|
|
|
|
|
handleRefresh();
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error(error);
|
|
|
|
|
|
message.error('创建失败: ' + (error.message || '未知错误'));
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
createFolderLoading.value = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 拖拽相关逻辑
|
|
|
|
|
|
const customRow = (record) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
draggable: true,
|
2026-01-04 21:35:25 +08:00
|
|
|
|
onClick: () => {
|
|
|
|
|
|
console.log('Clicked file record:', record);
|
|
|
|
|
|
},
|
2025-12-30 14:28:48 +08:00
|
|
|
|
onDragstart: (event) => {
|
|
|
|
|
|
// 检查是否是真实文件/文件夹(存在于 store 中)
|
|
|
|
|
|
const files = store.database?.files || {};
|
|
|
|
|
|
if (!files[record.file_id]) {
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
event.dataTransfer.setData('application/json', JSON.stringify({
|
|
|
|
|
|
file_id: record.file_id,
|
|
|
|
|
|
filename: record.filename
|
|
|
|
|
|
}));
|
|
|
|
|
|
event.dataTransfer.effectAllowed = 'move';
|
|
|
|
|
|
// 可以设置一个更好看的拖拽图像
|
|
|
|
|
|
},
|
|
|
|
|
|
onDragover: (event) => {
|
|
|
|
|
|
// 仅允许放置到真实文件夹中
|
|
|
|
|
|
if (record.is_folder) {
|
|
|
|
|
|
const files = store.database?.files || {};
|
|
|
|
|
|
// 确保是真实的文件夹(有 ID 且在 store 中)
|
|
|
|
|
|
if (files[record.file_id]) {
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
event.dataTransfer.dropEffect = 'move';
|
|
|
|
|
|
event.currentTarget.classList.add('drop-over-folder');
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
onDragleave: (event) => {
|
|
|
|
|
|
event.currentTarget.classList.remove('drop-over-folder');
|
|
|
|
|
|
},
|
|
|
|
|
|
onDrop: async (event) => {
|
|
|
|
|
|
event.preventDefault();
|
|
|
|
|
|
event.currentTarget.classList.remove('drop-over-folder');
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
const data = event.dataTransfer.getData('application/json');
|
|
|
|
|
|
if (!data) return;
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
try {
|
|
|
|
|
|
const { file_id, filename } = JSON.parse(data);
|
|
|
|
|
|
if (file_id === record.file_id) return;
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
// 确认移动
|
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
|
title: '移动文件',
|
|
|
|
|
|
content: `确定要将 "${filename}" 移动到 "${record.filename}" 吗?`,
|
|
|
|
|
|
onOk: async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
await store.moveFile(file_id, record.file_id);
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
// error handled in store
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.error('Drop error:', e);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
// 入库/重新入库参数配置相关
|
|
|
|
|
|
const indexConfigModalVisible = ref(false);
|
|
|
|
|
|
const indexConfigModalLoading = computed(() => store.state.chunkLoading);
|
|
|
|
|
|
const indexConfigModalTitle = ref('入库参数配置');
|
2025-11-12 23:14:56 +08:00
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const indexParams = ref({
|
2025-11-12 09:14:07 +08:00
|
|
|
|
chunk_size: 1000,
|
|
|
|
|
|
chunk_overlap: 200,
|
2026-01-04 21:35:25 +08:00
|
|
|
|
qa_separator: ''
|
2025-11-12 09:14:07 +08:00
|
|
|
|
});
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const currentIndexFileIds = ref([]);
|
|
|
|
|
|
const isBatchIndexOperation = ref(false);
|
2025-11-12 09:14:07 +08:00
|
|
|
|
|
2025-08-05 18:00:45 +08:00
|
|
|
|
// 文件名过滤
|
|
|
|
|
|
const filenameFilter = ref('');
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const statusFilter = ref(null);
|
|
|
|
|
|
const statusOptions = [
|
|
|
|
|
|
{ label: '已上传', value: 'uploaded' },
|
|
|
|
|
|
{ label: '解析中', value: 'parsing' },
|
|
|
|
|
|
{ label: '已解析', value: 'parsed' },
|
|
|
|
|
|
{ label: '解析失败', value: 'error_parsing' },
|
|
|
|
|
|
{ label: '入库中', value: 'indexing' },
|
|
|
|
|
|
{ label: '已入库', value: 'indexed' },
|
|
|
|
|
|
{ label: '入库失败', value: 'error_indexing' },
|
|
|
|
|
|
];
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
|
|
|
|
|
// 紧凑表格列定义
|
|
|
|
|
|
const columnsCompact = [
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '文件名',
|
|
|
|
|
|
dataIndex: 'filename',
|
|
|
|
|
|
key: 'filename',
|
|
|
|
|
|
ellipsis: true,
|
|
|
|
|
|
width: undefined, // 不设置宽度,让它占据剩余空间
|
2025-12-30 14:28:48 +08:00
|
|
|
|
sorter: (a, b) => {
|
|
|
|
|
|
if (a.is_folder && !b.is_folder) return -1;
|
|
|
|
|
|
if (!a.is_folder && b.is_folder) return 1;
|
|
|
|
|
|
return (a.filename || '').localeCompare(b.filename || '');
|
|
|
|
|
|
},
|
2025-08-05 18:00:45 +08:00
|
|
|
|
sortDirections: ['ascend', 'descend']
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '状态',
|
|
|
|
|
|
dataIndex: 'status',
|
|
|
|
|
|
key: 'status',
|
|
|
|
|
|
width: 60,
|
|
|
|
|
|
align: 'right',
|
|
|
|
|
|
sorter: (a, b) => {
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const statusOrder = {
|
|
|
|
|
|
'done': 1, 'indexed': 1,
|
|
|
|
|
|
'processing': 2, 'indexing': 2, 'parsing': 2,
|
|
|
|
|
|
'waiting': 3, 'uploaded': 3, 'parsed': 3,
|
|
|
|
|
|
'failed': 4, 'error_indexing': 4, 'error_parsing': 4
|
|
|
|
|
|
};
|
2025-08-05 18:00:45 +08:00
|
|
|
|
return (statusOrder[a.status] || 5) - (statusOrder[b.status] || 5);
|
|
|
|
|
|
},
|
|
|
|
|
|
sortDirections: ['ascend', 'descend']
|
|
|
|
|
|
},
|
2025-12-18 11:47:54 +08:00
|
|
|
|
{ title: '', key: 'action', dataIndex: 'file_id', width: 40, align: 'center' }
|
2025-08-05 18:00:45 +08:00
|
|
|
|
];
|
|
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
// 构建文件树
|
|
|
|
|
|
const buildFileTree = (fileList) => {
|
|
|
|
|
|
const nodeMap = new Map();
|
|
|
|
|
|
const roots = [];
|
|
|
|
|
|
const processedIds = new Set();
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
// 1. 初始化节点映射,确保 explicit folder 有 children
|
|
|
|
|
|
fileList.forEach(file => {
|
|
|
|
|
|
const item = { ...file, displayName: file.filename };
|
|
|
|
|
|
if (item.is_folder && !item.children) {
|
|
|
|
|
|
item.children = [];
|
|
|
|
|
|
}
|
|
|
|
|
|
nodeMap.set(item.file_id, item);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 处理 parent_id (强关联)
|
|
|
|
|
|
fileList.forEach(file => {
|
|
|
|
|
|
if (file.parent_id && nodeMap.has(file.parent_id)) {
|
|
|
|
|
|
const parent = nodeMap.get(file.parent_id);
|
|
|
|
|
|
const child = nodeMap.get(file.file_id);
|
|
|
|
|
|
if (parent && child) {
|
|
|
|
|
|
if (!parent.children) parent.children = [];
|
|
|
|
|
|
parent.children.push(child);
|
|
|
|
|
|
processedIds.add(file.file_id);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 3. 处理剩余项 (Roots 或 路径解析)
|
|
|
|
|
|
fileList.forEach(file => {
|
|
|
|
|
|
if (processedIds.has(file.file_id)) return;
|
|
|
|
|
|
|
|
|
|
|
|
const item = nodeMap.get(file.file_id);
|
|
|
|
|
|
const normalizedName = file.filename.replace(/\\/g, '/');
|
|
|
|
|
|
const parts = normalizedName.split('/');
|
|
|
|
|
|
|
|
|
|
|
|
if (parts.length === 1) {
|
|
|
|
|
|
// Root item
|
|
|
|
|
|
// Check if it's an explicit folder that should merge with an existing implicit one?
|
|
|
|
|
|
if (item.is_folder) {
|
|
|
|
|
|
const existingIndex = roots.findIndex(n => n.is_folder && n.filename === item.filename);
|
|
|
|
|
|
if (existingIndex !== -1) {
|
|
|
|
|
|
const existing = roots[existingIndex];
|
|
|
|
|
|
// Merge children from implicit to explicit
|
|
|
|
|
|
if (existing.children && existing.children.length > 0) {
|
|
|
|
|
|
item.children = [...(item.children || []), ...existing.children];
|
|
|
|
|
|
}
|
|
|
|
|
|
// Replace implicit with explicit
|
|
|
|
|
|
roots[existingIndex] = item;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
roots.push(item);
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
roots.push(item);
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// Path based logic for files like "A/B.txt"
|
|
|
|
|
|
let currentLevel = roots;
|
|
|
|
|
|
let currentPath = '';
|
|
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < parts.length - 1; i++) {
|
|
|
|
|
|
const part = parts[i];
|
|
|
|
|
|
currentPath = currentPath ? `${currentPath}/${part}` : part;
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
// Find existing node in currentLevel
|
|
|
|
|
|
let node = currentLevel.find(n => n.filename === part && n.is_folder);
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
if (!node) {
|
|
|
|
|
|
node = {
|
|
|
|
|
|
file_id: `folder-${currentPath}`,
|
|
|
|
|
|
filename: part,
|
|
|
|
|
|
displayName: part,
|
|
|
|
|
|
is_folder: true,
|
|
|
|
|
|
children: [],
|
|
|
|
|
|
created_at: file.created_at,
|
|
|
|
|
|
status: 'done',
|
|
|
|
|
|
};
|
|
|
|
|
|
currentLevel.push(node);
|
|
|
|
|
|
}
|
|
|
|
|
|
currentLevel = node.children;
|
|
|
|
|
|
}
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
const fileName = parts[parts.length - 1];
|
|
|
|
|
|
item.displayName = fileName;
|
|
|
|
|
|
currentLevel.push(item);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 排序:文件夹在前,文件在后,按名称排序
|
|
|
|
|
|
const sortNodes = (nodes) => {
|
|
|
|
|
|
nodes.sort((a, b) => {
|
|
|
|
|
|
if (a.is_folder && !b.is_folder) return -1;
|
|
|
|
|
|
if (!a.is_folder && b.is_folder) return 1;
|
2026-01-04 22:47:39 +08:00
|
|
|
|
|
|
|
|
|
|
if (sortField.value === 'filename') {
|
|
|
|
|
|
return (a.filename || '').localeCompare(b.filename || '');
|
|
|
|
|
|
} else if (sortField.value === 'created_at') {
|
|
|
|
|
|
return new Date(b.created_at || 0) - new Date(a.created_at || 0);
|
|
|
|
|
|
} else if (sortField.value === 'status') {
|
|
|
|
|
|
const statusOrder = {
|
|
|
|
|
|
'done': 1, 'indexed': 1,
|
|
|
|
|
|
'processing': 2, 'indexing': 2, 'parsing': 2,
|
|
|
|
|
|
'waiting': 3, 'uploaded': 3, 'parsed': 3,
|
|
|
|
|
|
'failed': 4, 'error_indexing': 4, 'error_parsing': 4
|
|
|
|
|
|
};
|
|
|
|
|
|
return (statusOrder[a.status] || 5) - (statusOrder[b.status] || 5);
|
|
|
|
|
|
}
|
|
|
|
|
|
return 0;
|
2025-12-30 14:28:48 +08:00
|
|
|
|
});
|
|
|
|
|
|
nodes.forEach(node => {
|
|
|
|
|
|
if (node.children) sortNodes(node.children);
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
sortNodes(roots);
|
|
|
|
|
|
return roots;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-08-05 18:00:45 +08:00
|
|
|
|
// 过滤后的文件列表
|
|
|
|
|
|
const filteredFiles = computed(() => {
|
|
|
|
|
|
let filtered = files.value;
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const nameFilter = filenameFilter.value.trim().toLowerCase();
|
|
|
|
|
|
const status = statusFilter.value;
|
|
|
|
|
|
|
|
|
|
|
|
// 应用过滤
|
|
|
|
|
|
if (nameFilter || status) {
|
|
|
|
|
|
// 搜索/过滤模式下使用扁平列表
|
|
|
|
|
|
return files.value.filter(file => {
|
|
|
|
|
|
const nameMatch = !nameFilter || (file.filename && file.filename.toLowerCase().includes(nameFilter));
|
|
|
|
|
|
const statusMatch = !status || file.status === status ||
|
|
|
|
|
|
(status === 'indexed' && file.status === 'done') ||
|
|
|
|
|
|
(status === 'error_indexing' && file.status === 'failed');
|
|
|
|
|
|
return nameMatch && statusMatch;
|
|
|
|
|
|
}).map(f => ({ ...f, displayName: f.filename }));
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
return buildFileTree(filtered);
|
2025-08-05 18:00:45 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 空状态文本
|
|
|
|
|
|
const emptyText = computed(() => {
|
|
|
|
|
|
return filenameFilter.value ? `没有找到包含"${filenameFilter.value}"的文件` : '暂无文件';
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 计算是否可以批量删除
|
|
|
|
|
|
const canBatchDelete = computed(() => {
|
|
|
|
|
|
return selectedRowKeys.value.some(key => {
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const file = files.value.find(f => f.file_id === key);
|
2025-08-05 18:00:45 +08:00
|
|
|
|
return file && !(lock.value || file.status === 'processing' || file.status === 'waiting');
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
// 计算是否可以批量解析
|
|
|
|
|
|
const canBatchParse = computed(() => {
|
2025-11-12 09:14:07 +08:00
|
|
|
|
return selectedRowKeys.value.some(key => {
|
|
|
|
|
|
const file = filteredFiles.value.find(f => f.file_id === key);
|
2026-01-04 21:35:25 +08:00
|
|
|
|
return file && !lock.value && (file.status === 'uploaded' || file.status === 'error_parsing');
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
// 计算是否可以批量入库
|
|
|
|
|
|
const canBatchIndex = computed(() => {
|
|
|
|
|
|
return selectedRowKeys.value.some(key => {
|
|
|
|
|
|
const file = filteredFiles.value.find(f => f.file_id === key);
|
|
|
|
|
|
return file && !lock.value && (
|
2026-01-04 22:47:39 +08:00
|
|
|
|
file.status === 'parsed' ||
|
|
|
|
|
|
file.status === 'error_indexing' ||
|
2026-01-04 21:35:25 +08:00
|
|
|
|
(!isLightRAG.value && (file.status === 'done' || file.status === 'indexed'))
|
|
|
|
|
|
);
|
2025-11-12 09:14:07 +08:00
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
|
2026-01-04 22:47:39 +08:00
|
|
|
|
const showAddFilesModal = (options = {}) => {
|
|
|
|
|
|
emit('showAddFilesModal', options);
|
2025-08-05 18:00:45 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleRefresh = () => {
|
2025-11-06 19:47:22 +08:00
|
|
|
|
store.getDatabaseInfo(undefined, true); // Skip query params for manual refresh
|
2025-08-05 18:00:45 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const toggleAutoRefresh = () => {
|
|
|
|
|
|
store.toggleAutoRefresh();
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const toggleRightPanel = () => {
|
|
|
|
|
|
console.log(props.rightPanelVisible);
|
|
|
|
|
|
emit('toggleRightPanel');
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
const onSelectChange = (keys, selectedRows) => {
|
|
|
|
|
|
// 只保留非文件夹的文件ID
|
|
|
|
|
|
const fileKeys = selectedRows
|
|
|
|
|
|
.filter(row => !row.is_folder)
|
|
|
|
|
|
.map(row => row.file_id);
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
selectedRowKeys.value = fileKeys;
|
2025-08-05 18:00:45 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const getCheckboxProps = (record) => ({
|
2025-12-30 14:28:48 +08:00
|
|
|
|
disabled: lock.value || record.status === 'processing' || record.status === 'waiting' || record.is_folder,
|
2025-08-05 18:00:45 +08:00
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
const onFilterChange = (e) => {
|
|
|
|
|
|
filenameFilter.value = e.target.value;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleDeleteFile = (fileId) => {
|
|
|
|
|
|
store.handleDeleteFile(fileId);
|
2026-01-04 21:35:25 +08:00
|
|
|
|
closePopover(fileId);
|
2025-08-05 18:00:45 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
const handleDeleteFolder = (record) => {
|
2026-01-04 21:35:25 +08:00
|
|
|
|
closePopover(record.file_id);
|
2025-12-30 14:28:48 +08:00
|
|
|
|
Modal.confirm({
|
|
|
|
|
|
title: '删除文件夹',
|
|
|
|
|
|
content: `确定要删除文件夹 "${record.filename}" 及其包含的所有内容吗?`,
|
|
|
|
|
|
okText: '确认',
|
|
|
|
|
|
cancelText: '取消',
|
|
|
|
|
|
onOk: async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
await store.deleteFile(record.file_id);
|
|
|
|
|
|
message.success('删除成功');
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
// Error handled in store but we can add extra handling if needed
|
|
|
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
});
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-08-05 18:00:45 +08:00
|
|
|
|
const handleBatchDelete = () => {
|
|
|
|
|
|
store.handleBatchDelete();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const handleBatchParse = async () => {
|
|
|
|
|
|
const validKeys = selectedRowKeys.value.filter(key => {
|
|
|
|
|
|
const file = files.value.find(f => f.file_id === key);
|
|
|
|
|
|
return file && (file.status === 'uploaded' || file.status === 'error_parsing');
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (validKeys.length === 0) {
|
|
|
|
|
|
message.warning('没有可解析的文件');
|
2025-11-12 09:14:07 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
await store.parseFiles(validKeys);
|
|
|
|
|
|
selectedRowKeys.value = [];
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const handleBatchIndex = async () => {
|
|
|
|
|
|
const validKeys = selectedRowKeys.value.filter(key => {
|
|
|
|
|
|
const file = files.value.find(f => f.file_id === key);
|
|
|
|
|
|
return file && (
|
2026-01-04 22:47:39 +08:00
|
|
|
|
file.status === 'parsed' ||
|
|
|
|
|
|
file.status === 'error_indexing' ||
|
2026-01-04 21:35:25 +08:00
|
|
|
|
(!isLightRAG.value && (file.status === 'done' || file.status === 'indexed'))
|
|
|
|
|
|
);
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (validKeys.length === 0) {
|
|
|
|
|
|
message.warning('没有可入库的文件');
|
2025-11-12 09:14:07 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
if (isLightRAG.value) {
|
|
|
|
|
|
await store.indexFiles(validKeys);
|
|
|
|
|
|
selectedRowKeys.value = [];
|
|
|
|
|
|
return;
|
2025-11-12 09:14:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
currentIndexFileIds.value = [...validKeys];
|
|
|
|
|
|
isBatchIndexOperation.value = true;
|
|
|
|
|
|
indexConfigModalTitle.value = '批量入库参数配置';
|
|
|
|
|
|
indexConfigModalVisible.value = true;
|
2025-08-05 18:00:45 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const openFileDetail = (record) => {
|
2025-09-21 23:48:56 +08:00
|
|
|
|
console.log('openFileDetail', record);
|
2025-08-05 18:00:45 +08:00
|
|
|
|
store.openFileDetail(record);
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2025-09-21 23:48:56 +08:00
|
|
|
|
const handleDownloadFile = async (record) => {
|
2026-01-04 21:35:25 +08:00
|
|
|
|
closePopover(record.file_id);
|
2025-09-21 23:48:56 +08:00
|
|
|
|
const dbId = store.databaseId;
|
|
|
|
|
|
if (!dbId) {
|
|
|
|
|
|
console.error('无法获取数据库ID,数据库ID:', store.databaseId, '记录:', record);
|
|
|
|
|
|
message.error('无法获取数据库ID,请刷新页面后重试');
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
console.log('开始下载文件:', { dbId, fileId: record.file_id, record });
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
const response = await documentApi.downloadDocument(dbId, record.file_id);
|
|
|
|
|
|
|
|
|
|
|
|
// 获取文件名
|
|
|
|
|
|
const contentDisposition = response.headers.get('content-disposition');
|
|
|
|
|
|
let filename = record.filename;
|
|
|
|
|
|
if (contentDisposition) {
|
|
|
|
|
|
// 首先尝试匹配RFC 2231格式 filename*=UTF-8''...
|
|
|
|
|
|
const rfc2231Match = contentDisposition.match(/filename\*=UTF-8''([^;]+)/);
|
|
|
|
|
|
if (rfc2231Match) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
filename = decodeURIComponent(rfc2231Match[1]);
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.warn('Failed to decode RFC2231 filename:', rfc2231Match[1], error);
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 回退到标准格式 filename="..."
|
|
|
|
|
|
const filenameMatch = contentDisposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);
|
|
|
|
|
|
if (filenameMatch && filenameMatch[1]) {
|
|
|
|
|
|
filename = filenameMatch[1].replace(/['"]/g, '');
|
|
|
|
|
|
// 解码URL编码的文件名
|
|
|
|
|
|
try {
|
|
|
|
|
|
filename = decodeURIComponent(filename);
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.warn('Failed to decode filename:', filename, error);
|
|
|
|
|
|
// 如果解码失败,使用原文件名
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 创建blob并下载
|
|
|
|
|
|
const blob = await response.blob();
|
|
|
|
|
|
const url = window.URL.createObjectURL(blob);
|
|
|
|
|
|
const link = document.createElement('a');
|
|
|
|
|
|
link.href = url;
|
|
|
|
|
|
link.download = filename;
|
|
|
|
|
|
link.style.display = 'none';
|
|
|
|
|
|
document.body.appendChild(link);
|
|
|
|
|
|
link.click();
|
|
|
|
|
|
document.body.removeChild(link);
|
|
|
|
|
|
window.URL.revokeObjectURL(url);
|
|
|
|
|
|
} catch (error) {
|
|
|
|
|
|
console.error('下载文件时出错:', error);
|
|
|
|
|
|
const errorMessage = error.message || '下载失败,请稍后重试';
|
|
|
|
|
|
message.error(errorMessage);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const handleParseFile = async (record) => {
|
|
|
|
|
|
closePopover(record.file_id);
|
|
|
|
|
|
await store.parseFiles([record.file_id]);
|
|
|
|
|
|
};
|
2025-11-12 09:14:07 +08:00
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const handleIndexFile = async (record) => {
|
|
|
|
|
|
closePopover(record.file_id);
|
|
|
|
|
|
if (isLightRAG.value) {
|
|
|
|
|
|
await store.indexFiles([record.file_id]);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2025-11-12 23:14:56 +08:00
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
// 打开参数配置弹窗
|
|
|
|
|
|
currentIndexFileIds.value = [record.file_id];
|
|
|
|
|
|
isBatchIndexOperation.value = false;
|
|
|
|
|
|
indexConfigModalTitle.value = '入库参数配置';
|
|
|
|
|
|
|
|
|
|
|
|
if (record?.processing_params) {
|
|
|
|
|
|
Object.assign(indexParams.value, record.processing_params);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// Reset to defaults if no existing params
|
|
|
|
|
|
Object.assign(indexParams.value, {
|
|
|
|
|
|
chunk_size: 1000,
|
|
|
|
|
|
chunk_overlap: 200,
|
|
|
|
|
|
qa_separator: ''
|
|
|
|
|
|
});
|
2025-11-12 09:14:07 +08:00
|
|
|
|
}
|
2026-01-04 21:35:25 +08:00
|
|
|
|
|
|
|
|
|
|
indexConfigModalVisible.value = true;
|
2025-11-12 09:14:07 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const handleReindexFile = async (record) => {
|
|
|
|
|
|
closePopover(record.file_id);
|
|
|
|
|
|
currentIndexFileIds.value = [record.file_id];
|
|
|
|
|
|
isBatchIndexOperation.value = false;
|
|
|
|
|
|
indexConfigModalTitle.value = '重新入库参数配置';
|
|
|
|
|
|
|
|
|
|
|
|
if (record?.processing_params) {
|
|
|
|
|
|
Object.assign(indexParams.value, record.processing_params);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 显示参数配置模态框
|
|
|
|
|
|
indexConfigModalVisible.value = true;
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// 入库确认 (统一处理 Index 和 Reindex)
|
|
|
|
|
|
const handleIndexConfigConfirm = async () => {
|
2025-11-12 09:14:07 +08:00
|
|
|
|
try {
|
2026-01-04 21:35:25 +08:00
|
|
|
|
// 调用 indexFiles 接口 (支持 params)
|
|
|
|
|
|
const result = await store.indexFiles(currentIndexFileIds.value, indexParams.value);
|
2025-11-12 23:14:56 +08:00
|
|
|
|
if (result) {
|
2026-01-04 21:35:25 +08:00
|
|
|
|
currentIndexFileIds.value = [];
|
2025-11-12 09:14:07 +08:00
|
|
|
|
// 清空选择
|
2026-01-04 21:35:25 +08:00
|
|
|
|
if (isBatchIndexOperation.value) {
|
2025-11-12 09:14:07 +08:00
|
|
|
|
selectedRowKeys.value = [];
|
|
|
|
|
|
}
|
|
|
|
|
|
// 关闭模态框
|
2026-01-04 21:35:25 +08:00
|
|
|
|
indexConfigModalVisible.value = false;
|
2025-11-12 23:14:56 +08:00
|
|
|
|
|
|
|
|
|
|
// 重置参数为默认值
|
2026-01-04 21:35:25 +08:00
|
|
|
|
Object.assign(indexParams.value, {
|
2025-11-12 23:14:56 +08:00
|
|
|
|
chunk_size: 1000,
|
|
|
|
|
|
chunk_overlap: 200,
|
2026-01-04 21:35:25 +08:00
|
|
|
|
qa_separator: ''
|
|
|
|
|
|
});
|
2025-11-12 09:14:07 +08:00
|
|
|
|
} else {
|
2026-01-04 21:35:25 +08:00
|
|
|
|
// message.error(`入库失败: ${result.message}`); // store already shows message
|
2025-11-12 09:14:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
} catch (error) {
|
2026-01-04 21:35:25 +08:00
|
|
|
|
console.error('入库失败:', error);
|
|
|
|
|
|
const errorMessage = error.message || '入库失败,请稍后重试';
|
2025-11-12 09:14:07 +08:00
|
|
|
|
message.error(errorMessage);
|
|
|
|
|
|
}
|
|
|
|
|
|
};
|
|
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
// 入库取消
|
|
|
|
|
|
const handleIndexConfigCancel = () => {
|
|
|
|
|
|
indexConfigModalVisible.value = false;
|
|
|
|
|
|
currentIndexFileIds.value = [];
|
|
|
|
|
|
isBatchIndexOperation.value = false;
|
2025-11-12 09:14:07 +08:00
|
|
|
|
// 重置参数为默认值
|
2026-01-04 21:35:25 +08:00
|
|
|
|
Object.assign(indexParams.value, {
|
2025-11-12 09:14:07 +08:00
|
|
|
|
chunk_size: 1000,
|
|
|
|
|
|
chunk_overlap: 200,
|
2026-01-04 21:35:25 +08:00
|
|
|
|
qa_separator: ''
|
|
|
|
|
|
});
|
2025-11-12 09:14:07 +08:00
|
|
|
|
};
|
|
|
|
|
|
|
2025-08-05 18:00:45 +08:00
|
|
|
|
// 导入工具函数
|
|
|
|
|
|
import { getFileIcon, getFileIconColor, formatRelativeTime } from '@/utils/file_utils';
|
2025-10-13 15:08:54 +08:00
|
|
|
|
import { parseToShanghai } from '@/utils/time';
|
2025-11-12 09:14:07 +08:00
|
|
|
|
import ChunkParamsConfig from '@/components/ChunkParamsConfig.vue';
|
2025-08-05 18:00:45 +08:00
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
|
|
.file-table-container {
|
|
|
|
|
|
display: flex;
|
2025-11-06 22:46:25 +08:00
|
|
|
|
flex-grow: 1;
|
2025-08-05 18:00:45 +08:00
|
|
|
|
flex-direction: column;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
max-height: 100%;
|
2025-11-23 01:39:44 +08:00
|
|
|
|
background: var(--gray-10);
|
2025-11-06 21:59:48 +08:00
|
|
|
|
overflow: hidden;
|
2025-11-06 19:47:22 +08:00
|
|
|
|
border-radius: 12px;
|
|
|
|
|
|
border: 1px solid var(--gray-150);
|
2025-12-07 23:38:20 +08:00
|
|
|
|
/* padding-top: 6px; */
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.panel-header {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
flex-shrink: 0;
|
2026-01-04 22:47:39 +08:00
|
|
|
|
padding: 8px 8px;
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.panel-actions {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2026-01-07 11:16:08 +08:00
|
|
|
|
gap: 4px;
|
2025-10-25 16:01:50 +08:00
|
|
|
|
|
|
|
|
|
|
.action-searcher {
|
|
|
|
|
|
width: 120px;
|
|
|
|
|
|
margin-right: 8px;
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
padding: 4px 8px;
|
|
|
|
|
|
border: none;
|
|
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 21:59:48 +08:00
|
|
|
|
.batch-actions {
|
2025-08-05 18:00:45 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: space-between;
|
2026-01-07 11:16:08 +08:00
|
|
|
|
padding: 4px 12px;
|
2025-11-06 21:59:48 +08:00
|
|
|
|
background-color: var(--main-10);
|
2025-08-05 18:00:45 +08:00
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
margin-bottom: 4px;
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.batch-info {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 8px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.batch-info span {
|
2025-11-06 21:59:48 +08:00
|
|
|
|
font-size: 12px;
|
2025-08-05 18:00:45 +08:00
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
color: var(--gray-700);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 21:59:48 +08:00
|
|
|
|
.batch-actions .ant-btn {
|
|
|
|
|
|
font-size: 12px;
|
2026-01-07 11:16:08 +08:00
|
|
|
|
padding: 4px 8px;
|
|
|
|
|
|
height: auto;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 4px;
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2025-11-14 00:56:24 +08:00
|
|
|
|
svg {
|
|
|
|
|
|
width: 14px;
|
|
|
|
|
|
height: 14px;
|
|
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-14 00:56:24 +08:00
|
|
|
|
|
2025-11-06 21:59:48 +08:00
|
|
|
|
.my-table {
|
2025-08-05 18:00:45 +08:00
|
|
|
|
flex: 1;
|
|
|
|
|
|
overflow: auto;
|
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
|
min-height: 0; /* 让 flex 子项可以正确缩小 */
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 21:59:48 +08:00
|
|
|
|
.my-table .main-btn {
|
2025-08-05 18:00:45 +08:00
|
|
|
|
padding: 0;
|
|
|
|
|
|
height: auto;
|
|
|
|
|
|
line-height: 1.4;
|
|
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
|
color: var(--color-text);
|
|
|
|
|
|
text-decoration: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 21:59:48 +08:00
|
|
|
|
.my-table .main-btn:hover {
|
2025-08-05 18:00:45 +08:00
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
color: var(--main-color);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-14 00:56:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
2025-11-06 21:59:48 +08:00
|
|
|
|
.my-table .del-btn {
|
2025-08-05 18:00:45 +08:00
|
|
|
|
color: var(--gray-500);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 21:59:48 +08:00
|
|
|
|
.my-table .download-btn {
|
2025-09-21 23:48:56 +08:00
|
|
|
|
color: var(--gray-500);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 21:59:48 +08:00
|
|
|
|
.my-table .download-btn:hover {
|
2025-09-21 23:48:56 +08:00
|
|
|
|
color: var(--main-color);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-12 09:14:07 +08:00
|
|
|
|
.my-table .rechunk-btn {
|
|
|
|
|
|
color: var(--gray-500);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-14 00:56:24 +08:00
|
|
|
|
/* 统一设置表格操作按钮的图标尺寸 */
|
|
|
|
|
|
.my-table .table-row-actions {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.my-table .table-row-actions button {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.my-table .table-row-actions button svg {
|
|
|
|
|
|
width: 16px;
|
|
|
|
|
|
height: 16px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-12 09:14:07 +08:00
|
|
|
|
.my-table .rechunk-btn:hover {
|
2025-11-25 22:34:44 +08:00
|
|
|
|
color: var(--color-warning-500);
|
2025-11-12 09:14:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 21:59:48 +08:00
|
|
|
|
.my-table .del-btn:hover {
|
2025-11-25 22:34:44 +08:00
|
|
|
|
color: var(--color-error-500);
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 21:59:48 +08:00
|
|
|
|
.my-table .del-btn:disabled {
|
2025-08-05 18:00:45 +08:00
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-11-06 21:59:48 +08:00
|
|
|
|
.my-table .span-type {
|
2025-08-05 18:00:45 +08:00
|
|
|
|
display: inline-block;
|
|
|
|
|
|
padding: 1px 5px;
|
|
|
|
|
|
font-size: 10px;
|
|
|
|
|
|
font-weight: bold;
|
2025-11-23 01:39:44 +08:00
|
|
|
|
color: var(--gray-0);
|
2025-08-05 18:00:45 +08:00
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
text-transform: uppercase;
|
|
|
|
|
|
opacity: 0.9;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.auto-refresh-btn {
|
|
|
|
|
|
height: 24px;
|
|
|
|
|
|
padding: 0 8px;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.panel-action-btn {
|
2025-10-25 16:01:50 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
2025-08-05 18:00:45 +08:00
|
|
|
|
border-radius: 6px;
|
2026-01-07 11:16:08 +08:00
|
|
|
|
padding: 0 4px;
|
2025-08-05 18:00:45 +08:00
|
|
|
|
color: var(--gray-700);
|
|
|
|
|
|
transition: all 0.1s ease;
|
2025-10-25 16:01:50 +08:00
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
|
|
|
|
|
|
svg {
|
|
|
|
|
|
height: 16px;
|
|
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
|
|
|
|
|
&.expand {
|
|
|
|
|
|
transform: scaleX(-1);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-25 16:01:50 +08:00
|
|
|
|
&.expanded {
|
|
|
|
|
|
transform: scaleX(1);
|
|
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.panel-action-btn.auto-refresh-btn.ant-btn-primary {
|
|
|
|
|
|
background-color: var(--main-color);
|
|
|
|
|
|
border-color: var(--main-color);
|
2025-11-23 01:39:44 +08:00
|
|
|
|
color: var(--gray-0);
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.panel-action-btn:hover {
|
2025-11-14 00:56:24 +08:00
|
|
|
|
background-color: var(--gray-50);
|
2025-08-05 18:00:45 +08:00
|
|
|
|
color: var(--main-color);
|
2025-11-14 00:56:24 +08:00
|
|
|
|
/* border: 1px solid var(--main-100); */
|
2026-01-02 15:02:04 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.panel-action-btn.active {
|
|
|
|
|
|
color: var(--main-color);
|
2026-01-07 11:16:08 +08:00
|
|
|
|
background-color: var(--gray-100);
|
|
|
|
|
|
font-weight: 600;
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-12-18 11:47:54 +08:00
|
|
|
|
.action-trigger-btn {
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
width: 24px;
|
|
|
|
|
|
height: 24px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
|
color: var(--gray-500);
|
|
|
|
|
|
transition: all 0.2s;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
background-color: var(--gray-100);
|
|
|
|
|
|
color: var(--main-color);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
svg {
|
|
|
|
|
|
width: 16px;
|
|
|
|
|
|
height: 16px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
|
|
|
|
|
/* Table row selection styling */
|
|
|
|
|
|
:deep(.ant-table-tbody > tr.ant-table-row-selected > td) {
|
|
|
|
|
|
background-color: var(--main-5);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-25 16:01:50 +08:00
|
|
|
|
:deep(.ant-table-tbody > tr.ant-table-row-selected.ant-table-row:hover > td) {
|
|
|
|
|
|
background-color: var(--main-20);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-05 18:00:45 +08:00
|
|
|
|
:deep(.ant-table-tbody > tr:hover > td) {
|
|
|
|
|
|
background-color: var(--main-5);
|
|
|
|
|
|
}
|
2025-12-30 14:28:48 +08:00
|
|
|
|
|
|
|
|
|
|
.folder-row {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2025-12-30 23:57:20 +08:00
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
&:hover {
|
|
|
|
|
|
color: var(--main-color);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
:deep(.drop-over-folder) {
|
|
|
|
|
|
background-color: var(--primary-50) !important;
|
2026-01-04 22:47:39 +08:00
|
|
|
|
outline: 2px dashed var(--main-color);
|
|
|
|
|
|
outline-offset: -2px;
|
|
|
|
|
|
z-index: 10;
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2026-01-04 22:47:39 +08:00
|
|
|
|
td {
|
|
|
|
|
|
background-color: transparent !important;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.upload-btn-group {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 8px;
|
|
|
|
|
|
|
|
|
|
|
|
.upload-btn {
|
|
|
|
|
|
height: 28px;
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
justify-content: center;
|
|
|
|
|
|
gap: 4px;
|
|
|
|
|
|
}
|
2025-12-30 14:28:48 +08:00
|
|
|
|
}
|
2025-10-13 15:08:54 +08:00
|
|
|
|
</style>
|
2025-12-18 11:47:54 +08:00
|
|
|
|
|
|
|
|
|
|
<style lang="less">
|
|
|
|
|
|
.file-action-popover {
|
|
|
|
|
|
.ant-popover-inner {
|
|
|
|
|
|
padding: 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.ant-popover-inner {
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
border: 1px solid var(--gray-150);
|
|
|
|
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.ant-popover-arrow {
|
|
|
|
|
|
display: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.file-action-list {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
gap: 2px;
|
|
|
|
|
|
|
|
|
|
|
|
.ant-btn {
|
|
|
|
|
|
text-align: left;
|
2026-01-04 21:35:25 +08:00
|
|
|
|
height: 30px;
|
2025-12-18 11:47:54 +08:00
|
|
|
|
font-size: 14px;
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
border-radius: 6px;
|
2026-01-04 21:35:25 +08:00
|
|
|
|
padding: 0 8px;
|
2025-12-18 11:47:54 +08:00
|
|
|
|
border: none;
|
|
|
|
|
|
box-shadow: none;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
background-color: var(--gray-50);
|
|
|
|
|
|
color: var(--main-color);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&.ant-btn-dangerous:hover {
|
|
|
|
|
|
background-color: var(--color-error-50);
|
|
|
|
|
|
color: var(--color-error-500);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.anticon, .lucide {
|
|
|
|
|
|
margin-right: 10px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
span {
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.ant-btn:disabled {
|
|
|
|
|
|
background-color: transparent;
|
|
|
|
|
|
color: var(--gray-300);
|
|
|
|
|
|
cursor: not-allowed;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-01-04 21:35:25 +08:00
|
|
|
|
|
|
|
|
|
|
.file-info-popover {
|
|
|
|
|
|
.ant-popover-inner {
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// .ant-popover-inner-content {
|
|
|
|
|
|
// padding: 16px;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
.file-info-card {
|
|
|
|
|
|
min-width: 120px;
|
|
|
|
|
|
max-width: 320px;
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
|
|
|
|
|
|
.info-row {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
margin-bottom: 8px;
|
|
|
|
|
|
line-height: 1.5;
|
|
|
|
|
|
align-items: flex-start;
|
|
|
|
|
|
|
|
|
|
|
|
&:last-child {
|
|
|
|
|
|
margin-bottom: 0;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.label {
|
|
|
|
|
|
color: var(--gray-500);
|
|
|
|
|
|
width: 40px;
|
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
|
text-align: right;
|
|
|
|
|
|
margin-right: 12px;
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.value {
|
|
|
|
|
|
color: var(--gray-900);
|
|
|
|
|
|
word-break: break-all;
|
|
|
|
|
|
flex: 1;
|
|
|
|
|
|
font-family: monospace; /* Optional: for ID and numbers */
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&.error {
|
|
|
|
|
|
.label {
|
|
|
|
|
|
color: var(--color-error-500);
|
|
|
|
|
|
}
|
|
|
|
|
|
.value {
|
|
|
|
|
|
color: var(--color-error-500);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-12-18 11:47:54 +08:00
|
|
|
|
</style>
|