2025-08-05 18:00:45 +08:00
|
|
|
|
<template>
|
|
|
|
|
|
<div class="file-table-container">
|
|
|
|
|
|
<div class="panel-header">
|
|
|
|
|
|
<div class="panel-actions">
|
2026-05-18 23:53:35 +08:00
|
|
|
|
<slot name="toolbar-extra" />
|
2026-05-17 18:06:25 +08:00
|
|
|
|
<div class="panel-actions-default">
|
|
|
|
|
|
<a-input
|
|
|
|
|
|
v-model:value="filenameFilter"
|
|
|
|
|
|
placeholder="搜索"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
class="action-searcher"
|
|
|
|
|
|
allow-clear
|
|
|
|
|
|
@change="onFilterChange"
|
|
|
|
|
|
>
|
|
|
|
|
|
<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"
|
|
|
|
|
|
:class="{ active: statusFilter !== 'all' }"
|
|
|
|
|
|
title="筛选状态"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #icon><Filter size="16" /></template>
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
<template #overlay>
|
|
|
|
|
|
<a-menu :selectedKeys="[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>
|
2026-01-04 22:47:39 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
<a-button
|
|
|
|
|
|
type="text"
|
2026-05-17 18:06:25 +08:00
|
|
|
|
@click="handleRefresh"
|
|
|
|
|
|
:loading="refreshing"
|
|
|
|
|
|
title="刷新"
|
2026-01-15 06:01:34 +08:00
|
|
|
|
class="panel-action-btn"
|
|
|
|
|
|
>
|
2026-05-17 18:06:25 +08:00
|
|
|
|
<template #icon><RotateCw size="16" /></template>
|
2026-01-04 22:47:39 +08:00
|
|
|
|
</a-button>
|
2026-01-15 06:01:34 +08:00
|
|
|
|
<a-button
|
|
|
|
|
|
type="text"
|
2026-05-17 18:06:25 +08:00
|
|
|
|
@click="toggleSelectionMode"
|
|
|
|
|
|
title="多选"
|
2026-01-15 06:01:34 +08:00
|
|
|
|
class="panel-action-btn"
|
2026-05-17 18:06:25 +08:00
|
|
|
|
:class="{ active: isSelectionMode }"
|
2026-01-15 06:01:34 +08:00
|
|
|
|
>
|
2026-05-17 18:06:25 +08:00
|
|
|
|
<template #icon><CheckSquare size="16" /></template>
|
|
|
|
|
|
</a-button>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<a-dropdown
|
|
|
|
|
|
trigger="click"
|
|
|
|
|
|
v-model:open="overflowMenuOpen"
|
|
|
|
|
|
:overlayStyle="{ minWidth: '220px' }"
|
|
|
|
|
|
overlayClassName="panel-overflow-popover"
|
|
|
|
|
|
>
|
|
|
|
|
|
<a-button type="text" class="panel-action-btn overflow-trigger" title="更多">
|
|
|
|
|
|
<template #icon><MoreHorizontal size="16" /></template>
|
2026-01-04 22:47:39 +08:00
|
|
|
|
</a-button>
|
|
|
|
|
|
<template #overlay>
|
2026-05-17 18:06:25 +08:00
|
|
|
|
<div class="overflow-menu-panel" @click.stop>
|
|
|
|
|
|
<div class="overflow-search">
|
|
|
|
|
|
<a-input
|
|
|
|
|
|
v-model:value="filenameFilter"
|
|
|
|
|
|
placeholder="搜索文件名"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
allow-clear
|
|
|
|
|
|
@change="onFilterChange"
|
|
|
|
|
|
>
|
|
|
|
|
|
<template #prefix>
|
|
|
|
|
|
<Search size="14" style="color: var(--gray-400)" />
|
|
|
|
|
|
</template>
|
|
|
|
|
|
</a-input>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<div class="overflow-actions">
|
|
|
|
|
|
<a-dropdown trigger="click" placement="bottomLeft">
|
|
|
|
|
|
<div class="overflow-action-item" :class="{ active: statusFilter !== 'all' }">
|
|
|
|
|
|
<Filter size="16" />
|
|
|
|
|
|
<span>筛选</span>
|
|
|
|
|
|
<span class="overflow-action-hint">{{ currentStatusLabel }}</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<template #overlay>
|
|
|
|
|
|
<a-menu :selectedKeys="[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>
|
|
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
|
class="overflow-action-item"
|
|
|
|
|
|
:class="{ 'is-loading': refreshing }"
|
|
|
|
|
|
@click="handleRefresh"
|
|
|
|
|
|
>
|
|
|
|
|
|
<RotateCw size="16" :class="{ spin: refreshing }" />
|
|
|
|
|
|
<span>刷新</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
|
class="overflow-action-item"
|
|
|
|
|
|
:class="{ active: isSelectionMode }"
|
|
|
|
|
|
@click="toggleSelectionMode"
|
|
|
|
|
|
>
|
|
|
|
|
|
<CheckSquare size="16" />
|
|
|
|
|
|
<span>多选</span>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
2026-01-04 22:47:39 +08:00
|
|
|
|
</template>
|
|
|
|
|
|
</a-dropdown>
|
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"
|
2026-01-15 06:01:34 +08:00
|
|
|
|
style="margin-right: 8px"
|
2026-01-06 19:32:27 +08:00
|
|
|
|
/>
|
2025-08-05 18:00:45 +08:00
|
|
|
|
<span>{{ selectedRowKeys.length }} 项</span>
|
|
|
|
|
|
</div>
|
2026-01-15 06:01:34 +08:00
|
|
|
|
<div style="display: flex; gap: 2px">
|
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">
|
2026-02-20 19:35:43 +08:00
|
|
|
|
<ChunkParamsConfig
|
|
|
|
|
|
:temp-chunk-params="indexParams"
|
|
|
|
|
|
:show-qa-split="true"
|
2026-05-17 13:06:25 +08:00
|
|
|
|
:show-chunk-size-overlap="true"
|
2026-02-20 19:35:43 +08:00
|
|
|
|
:show-preset="true"
|
|
|
|
|
|
:allow-preset-follow-default="true"
|
|
|
|
|
|
:database-preset-id="store.database?.additional_params?.chunk_preset_id || 'general'"
|
|
|
|
|
|
/>
|
2025-11-12 09:14:07 +08:00
|
|
|
|
</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
|
2026-01-15 06:01:34 +08:00
|
|
|
|
:columns="columnsCompact"
|
|
|
|
|
|
:data-source="paginatedFiles"
|
|
|
|
|
|
row-key="file_id"
|
|
|
|
|
|
class="my-table"
|
|
|
|
|
|
size="small"
|
|
|
|
|
|
:pagination="tablePagination"
|
|
|
|
|
|
@change="handleTableChange"
|
|
|
|
|
|
v-model:expandedRowKeys="expandedRowKeys"
|
|
|
|
|
|
:custom-row="customRow"
|
|
|
|
|
|
:row-selection="
|
|
|
|
|
|
isSelectionMode
|
|
|
|
|
|
? {
|
|
|
|
|
|
selectedRowKeys: selectedRowKeys,
|
|
|
|
|
|
onChange: onSelectChange,
|
|
|
|
|
|
getCheckboxProps: getCheckboxProps
|
|
|
|
|
|
}
|
|
|
|
|
|
: null
|
|
|
|
|
|
"
|
|
|
|
|
|
:locale="{
|
|
|
|
|
|
emptyText: emptyText
|
|
|
|
|
|
}"
|
|
|
|
|
|
>
|
2025-08-05 18:00:45 +08:00
|
|
|
|
<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)">
|
2026-01-15 06:01:34 +08:00
|
|
|
|
<component
|
|
|
|
|
|
:is="
|
|
|
|
|
|
expandedRowKeys.includes(record.file_id) ? h(FolderOpenFilled) : h(FolderFilled)
|
|
|
|
|
|
"
|
|
|
|
|
|
style="margin-right: 8px; color: #ffb800; font-size: 16px"
|
|
|
|
|
|
/>
|
2025-12-30 14:28:48 +08:00
|
|
|
|
{{ record.filename }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
</template>
|
2026-05-18 23:53:35 +08:00
|
|
|
|
<a-button v-else class="main-btn" type="link" @click="openFileDetail(record)">
|
|
|
|
|
|
<component
|
|
|
|
|
|
:is="getFileIcon(record.displayName || text)"
|
|
|
|
|
|
:style="{
|
|
|
|
|
|
marginRight: '0',
|
|
|
|
|
|
color: getFileIconColor(record.displayName || text),
|
|
|
|
|
|
fontSize: '16px'
|
|
|
|
|
|
}"
|
|
|
|
|
|
/>
|
|
|
|
|
|
{{ record.displayName || text }}
|
|
|
|
|
|
</a-button>
|
2025-12-30 14:28:48 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
<span v-else-if="column.key === 'type'">
|
2026-01-15 06:01:34 +08:00
|
|
|
|
<span v-if="!record.is_folder" :class="['span-type', text]">{{
|
|
|
|
|
|
text?.toUpperCase()
|
|
|
|
|
|
}}</span>
|
2025-12-30 14:28:48 +08:00
|
|
|
|
</span>
|
2026-05-18 23:53:35 +08:00
|
|
|
|
<div v-else-if="column.key === 'status'" class="file-status-cell">
|
2025-12-30 14:28:48 +08:00
|
|
|
|
<template v-if="!record.is_folder">
|
2026-05-18 23:53:35 +08:00
|
|
|
|
<span
|
|
|
|
|
|
v-if="text === 'done' || text === 'indexed'"
|
|
|
|
|
|
class="file-status-icon status-success"
|
|
|
|
|
|
><CheckCircleFilled
|
|
|
|
|
|
/></span>
|
|
|
|
|
|
<span
|
|
|
|
|
|
v-else-if="text === 'failed' || text === 'error_parsing' || text === 'error_indexing'"
|
|
|
|
|
|
class="file-status-icon status-error"
|
|
|
|
|
|
><CloseCircleFilled
|
|
|
|
|
|
/></span>
|
|
|
|
|
|
<span
|
|
|
|
|
|
v-else-if="text === 'processing' || text === 'parsing' || text === 'indexing'"
|
|
|
|
|
|
class="file-status-icon status-info"
|
|
|
|
|
|
><HourglassFilled
|
|
|
|
|
|
/></span>
|
|
|
|
|
|
<span
|
|
|
|
|
|
v-else-if="text === 'waiting' || text === 'uploaded'"
|
|
|
|
|
|
class="file-status-icon status-warning"
|
|
|
|
|
|
><ClockCircleFilled
|
|
|
|
|
|
/></span>
|
|
|
|
|
|
<span v-else-if="text === 'parsed'" class="file-status-icon status-primary"
|
|
|
|
|
|
><FileTextFilled
|
|
|
|
|
|
/></span>
|
|
|
|
|
|
<span>{{ getStatusText(text) }}</span>
|
2025-12-30 14:28:48 +08:00
|
|
|
|
</template>
|
2025-08-05 18:00:45 +08:00
|
|
|
|
</div>
|
|
|
|
|
|
|
2026-05-18 23:53:35 +08:00
|
|
|
|
<span v-else-if="column.key === 'created_at'" class="file-time-cell">
|
|
|
|
|
|
{{ record.is_folder ? '-' : formatStandardTime(text) }}
|
|
|
|
|
|
</span>
|
|
|
|
|
|
|
2025-11-14 00:56:24 +08:00
|
|
|
|
<div v-else-if="column.key === 'action'" class="table-row-actions">
|
2026-01-15 06:01:34 +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-15 06:01:34 +08:00
|
|
|
|
<a-button
|
|
|
|
|
|
type="text"
|
|
|
|
|
|
block
|
|
|
|
|
|
@click="handleDownloadFile(record)"
|
|
|
|
|
|
:disabled="
|
|
|
|
|
|
lock ||
|
2026-01-27 15:42:48 +08:00
|
|
|
|
record.file_type === 'url' ||
|
2026-01-15 06:01:34 +08:00
|
|
|
|
!['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 -->
|
2026-01-15 06:01:34 +08:00
|
|
|
|
<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 -->
|
2026-01-15 06:01:34 +08:00
|
|
|
|
<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 -->
|
2026-01-15 06:01:34 +08:00
|
|
|
|
<a-button
|
2026-05-17 13:06:25 +08:00
|
|
|
|
v-if="record.status === 'done' || record.status === 'indexed'"
|
2026-01-15 06:01:34 +08:00
|
|
|
|
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
|
|
|
|
|
2026-01-15 06:01:34 +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>
|
2026-03-26 13:53:35 +08:00
|
|
|
|
import { ref, computed, h } from 'vue'
|
2026-01-15 06:01:34 +08:00
|
|
|
|
import { useDatabaseStore } from '@/stores/database'
|
|
|
|
|
|
import { message, Modal } from 'ant-design-vue'
|
|
|
|
|
|
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-15 06:01:34 +08:00
|
|
|
|
FileTextFilled
|
|
|
|
|
|
} 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-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,
|
|
|
|
|
|
Database,
|
2026-01-04 22:47:39 +08:00
|
|
|
|
Search,
|
|
|
|
|
|
Filter,
|
2026-05-17 18:06:25 +08:00
|
|
|
|
MoreHorizontal
|
2026-01-15 06:01:34 +08:00
|
|
|
|
} from 'lucide-vue-next'
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const store = useDatabaseStore()
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2026-01-04 22:47:39 +08:00
|
|
|
|
const handleStatusMenuClick = (e) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
statusFilter.value = e.key
|
2026-01-15 02:38:02 +08:00
|
|
|
|
// 状态筛选变化时重置到第一页
|
2026-01-15 06:01:34 +08:00
|
|
|
|
paginationConfig.value.current = 1
|
|
|
|
|
|
}
|
2026-01-04 22:47:39 +08:00
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
// Status text mapping
|
|
|
|
|
|
const getStatusText = (status) => {
|
|
|
|
|
|
const map = {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
uploaded: '已上传',
|
|
|
|
|
|
parsing: '解析中',
|
|
|
|
|
|
parsed: '已解析',
|
|
|
|
|
|
error_parsing: '解析失败',
|
|
|
|
|
|
indexing: '入库中',
|
|
|
|
|
|
indexed: '已入库',
|
|
|
|
|
|
error_indexing: '入库失败',
|
|
|
|
|
|
done: '已入库',
|
|
|
|
|
|
failed: '入库失败',
|
|
|
|
|
|
processing: '处理中',
|
|
|
|
|
|
waiting: '等待中'
|
|
|
|
|
|
}
|
|
|
|
|
|
return map[status] || status
|
|
|
|
|
|
}
|
2026-01-04 21:35:25 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const files = computed(() => Object.values(store.database.files || {}))
|
|
|
|
|
|
const refreshing = computed(() => store.state.refrashing)
|
|
|
|
|
|
const lock = computed(() => store.state.lock)
|
|
|
|
|
|
const batchDeleting = computed(() => store.state.batchDeleting)
|
|
|
|
|
|
const batchParsing = computed(() => store.state.chunkLoading)
|
|
|
|
|
|
const batchIndexing = computed(() => store.state.chunkLoading)
|
2025-08-05 18:00:45 +08:00
|
|
|
|
const selectedRowKeys = computed({
|
|
|
|
|
|
get: () => store.selectedRowKeys,
|
2026-01-15 06:01:34 +08:00
|
|
|
|
set: (keys) => (store.selectedRowKeys = keys)
|
|
|
|
|
|
})
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const isSelectionMode = ref(false)
|
2026-05-17 18:06:25 +08:00
|
|
|
|
const overflowMenuOpen = ref(false)
|
|
|
|
|
|
|
|
|
|
|
|
const currentStatusLabel = computed(() => {
|
|
|
|
|
|
if (statusFilter.value === 'all') return ''
|
|
|
|
|
|
const opt = statusOptions.find((o) => o.value === statusFilter.value)
|
|
|
|
|
|
return opt ? opt.label : ''
|
|
|
|
|
|
})
|
2026-01-02 15:02:04 +08:00
|
|
|
|
|
2026-01-06 19:32:27 +08:00
|
|
|
|
const allSelectableFiles = computed(() => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const nameFilter = filenameFilter.value.trim().toLowerCase()
|
|
|
|
|
|
const status = statusFilter.value
|
2026-01-06 19:32:27 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
return files.value.filter((file) => {
|
|
|
|
|
|
if (file.is_folder) return false
|
2026-01-06 19:32:27 +08:00
|
|
|
|
// Follow getCheckboxProps logic
|
2026-01-15 06:01:34 +08:00
|
|
|
|
if (lock.value || file.status === 'processing' || file.status === 'waiting') return false
|
2026-01-06 19:32:27 +08:00
|
|
|
|
|
2026-01-15 04:54:53 +08:00
|
|
|
|
if (nameFilter || status !== 'all') {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const nameMatch =
|
|
|
|
|
|
!nameFilter || (file.filename && file.filename.toLowerCase().includes(nameFilter))
|
|
|
|
|
|
const statusMatch =
|
|
|
|
|
|
status === 'all' ||
|
|
|
|
|
|
file.status === status ||
|
|
|
|
|
|
(status === 'indexed' && file.status === 'done') ||
|
|
|
|
|
|
(status === 'error_indexing' && file.status === 'failed')
|
|
|
|
|
|
return nameMatch && statusMatch
|
2026-01-06 19:32:27 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
return true
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
2026-01-06 19:32:27 +08:00
|
|
|
|
|
|
|
|
|
|
const isAllSelected = computed(() => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const selectableIds = allSelectableFiles.value.map((f) => f.file_id)
|
|
|
|
|
|
if (selectableIds.length === 0) return false
|
|
|
|
|
|
return selectableIds.every((id) => selectedRowKeys.value.includes(id))
|
|
|
|
|
|
})
|
2026-01-06 19:32:27 +08:00
|
|
|
|
|
|
|
|
|
|
const isPartiallySelected = computed(() => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
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
|
|
|
|
|
|
})
|
2026-01-06 19:32:27 +08:00
|
|
|
|
|
|
|
|
|
|
const onSelectAllChange = (e) => {
|
|
|
|
|
|
if (e.target.checked) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
selectedRowKeys.value = allSelectableFiles.value.map((f) => f.file_id)
|
2026-01-06 19:32:27 +08:00
|
|
|
|
} else {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
selectedRowKeys.value = []
|
2026-01-06 19:32:27 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
}
|
2026-01-06 19:32:27 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const expandedRowKeys = ref([])
|
2025-12-30 14:28:48 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const popoverVisibleMap = ref({})
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const closePopover = (fileId) => {
|
|
|
|
|
|
if (fileId) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
popoverVisibleMap.value[fileId] = false
|
2026-01-04 21:35:25 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
}
|
2026-01-04 21:35:25 +08:00
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
// 新建文件夹相关
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const createFolderModalVisible = ref(false)
|
|
|
|
|
|
const newFolderName = ref('')
|
|
|
|
|
|
const createFolderLoading = ref(false)
|
|
|
|
|
|
const currentParentId = ref(null)
|
2025-12-30 14:28:48 +08:00
|
|
|
|
|
|
|
|
|
|
const showCreateFolderModal = (parentId = null) => {
|
2026-01-04 21:35:25 +08:00
|
|
|
|
if (typeof parentId === 'string') {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
closePopover(parentId)
|
2026-01-04 21:35:25 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
newFolderName.value = ''
|
2025-12-30 14:28:48 +08:00
|
|
|
|
// 如果是事件对象(来自顶部按钮点击),则设为null
|
|
|
|
|
|
if (parentId && typeof parentId === 'object') {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
parentId = null
|
2025-12-30 14:28:48 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
currentParentId.value = parentId
|
|
|
|
|
|
createFolderModalVisible.value = true
|
|
|
|
|
|
}
|
2025-12-30 14:28:48 +08:00
|
|
|
|
|
2026-05-18 23:53:35 +08:00
|
|
|
|
defineExpose({
|
|
|
|
|
|
showCreateFolderModal
|
|
|
|
|
|
})
|
|
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
const toggleExpand = (record) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
if (!record.is_folder) return
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const index = expandedRowKeys.value.indexOf(record.file_id)
|
2025-12-30 14:28:48 +08:00
|
|
|
|
if (index > -1) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
expandedRowKeys.value.splice(index, 1)
|
2025-12-30 14:28:48 +08:00
|
|
|
|
} else {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
expandedRowKeys.value.push(record.file_id)
|
2025-12-30 14:28:48 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
}
|
2025-12-30 14:28:48 +08:00
|
|
|
|
|
2026-01-02 15:02:04 +08:00
|
|
|
|
const toggleSelectionMode = () => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
isSelectionMode.value = !isSelectionMode.value
|
2026-01-02 15:02:04 +08:00
|
|
|
|
if (!isSelectionMode.value) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
selectedRowKeys.value = []
|
2026-01-02 15:02:04 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
}
|
2026-01-02 15:02:04 +08:00
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
const handleCreateFolder = async () => {
|
|
|
|
|
|
if (!newFolderName.value.trim()) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
message.warning('请输入文件夹名称')
|
|
|
|
|
|
return
|
2025-12-30 14:28:48 +08:00
|
|
|
|
}
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
createFolderLoading.value = true
|
2025-12-30 14:28:48 +08:00
|
|
|
|
try {
|
2026-05-21 19:33:00 +08:00
|
|
|
|
await documentApi.createFolder(store.kbId, newFolderName.value, currentParentId.value)
|
2026-01-15 06:01:34 +08:00
|
|
|
|
message.success('创建成功')
|
|
|
|
|
|
createFolderModalVisible.value = false
|
|
|
|
|
|
handleRefresh()
|
2025-12-30 14:28:48 +08:00
|
|
|
|
} catch (error) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
console.error(error)
|
|
|
|
|
|
message.error('创建失败: ' + (error.message || '未知错误'))
|
2025-12-30 14:28:48 +08:00
|
|
|
|
} finally {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
createFolderLoading.value = false
|
2025-12-30 14:28:48 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
}
|
2025-12-30 14:28:48 +08:00
|
|
|
|
|
|
|
|
|
|
// 拖拽相关逻辑
|
|
|
|
|
|
const customRow = (record) => {
|
|
|
|
|
|
return {
|
|
|
|
|
|
draggable: true,
|
2026-01-04 21:35:25 +08:00
|
|
|
|
onClick: () => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
console.log('Clicked file record:', record)
|
2026-01-04 21:35:25 +08:00
|
|
|
|
},
|
2025-12-30 14:28:48 +08:00
|
|
|
|
onDragstart: (event) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
// 检查是否是真实文件/文件夹(存在于 store 中)
|
|
|
|
|
|
const files = store.database?.files || {}
|
|
|
|
|
|
if (!files[record.file_id]) {
|
|
|
|
|
|
event.preventDefault()
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
event.dataTransfer.setData(
|
|
|
|
|
|
'application/json',
|
|
|
|
|
|
JSON.stringify({
|
|
|
|
|
|
file_id: record.file_id,
|
|
|
|
|
|
filename: record.filename
|
|
|
|
|
|
})
|
|
|
|
|
|
)
|
|
|
|
|
|
event.dataTransfer.effectAllowed = 'move'
|
|
|
|
|
|
// 可以设置一个更好看的拖拽图像
|
2025-12-30 14:28:48 +08:00
|
|
|
|
},
|
|
|
|
|
|
onDragover: (event) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
// 仅允许放置到真实文件夹中
|
|
|
|
|
|
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')
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-12-30 14:28:48 +08:00
|
|
|
|
},
|
|
|
|
|
|
onDragleave: (event) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
event.currentTarget.classList.remove('drop-over-folder')
|
2025-12-30 14:28:48 +08:00
|
|
|
|
},
|
|
|
|
|
|
onDrop: async (event) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
event.preventDefault()
|
|
|
|
|
|
event.currentTarget.classList.remove('drop-over-folder')
|
|
|
|
|
|
|
|
|
|
|
|
const data = event.dataTransfer.getData('application/json')
|
|
|
|
|
|
if (!data) return
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
const { file_id, filename } = JSON.parse(data)
|
|
|
|
|
|
if (file_id === record.file_id) return
|
|
|
|
|
|
|
|
|
|
|
|
// 确认移动
|
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
|
title: '移动文件',
|
|
|
|
|
|
content: `确定要将 "${filename}" 移动到 "${record.filename}" 吗?`,
|
|
|
|
|
|
onOk: async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
await store.moveFile(file_id, record.file_id)
|
2026-03-26 13:53:35 +08:00
|
|
|
|
} catch {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
// error handled in store
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
} catch (e) {
|
|
|
|
|
|
console.error('Drop error:', e)
|
|
|
|
|
|
}
|
2025-12-30 14:28:48 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-12-30 14:28:48 +08:00
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
// 入库/重新入库参数配置相关
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const indexConfigModalVisible = ref(false)
|
|
|
|
|
|
const indexConfigModalLoading = computed(() => store.state.chunkLoading)
|
|
|
|
|
|
const indexConfigModalTitle = ref('入库参数配置')
|
2025-11-12 23:14:56 +08:00
|
|
|
|
|
2026-05-16 17:21:27 +08:00
|
|
|
|
const createDefaultIndexParams = () => ({
|
|
|
|
|
|
chunk_preset_id: '',
|
|
|
|
|
|
chunk_parser_config: {}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
})
|
2026-02-20 19:35:43 +08:00
|
|
|
|
|
2026-05-16 17:21:27 +08:00
|
|
|
|
const indexParams = ref(createDefaultIndexParams())
|
2026-02-20 19:35:43 +08:00
|
|
|
|
|
2026-05-16 17:21:27 +08:00
|
|
|
|
const buildIndexParamsPayload = () => {
|
|
|
|
|
|
return buildChunkParamsPayload(indexParams.value, {
|
2026-05-17 13:06:25 +08:00
|
|
|
|
includeSizeOverlap: true
|
2026-05-16 17:21:27 +08:00
|
|
|
|
})
|
2026-02-20 19:35:43 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const currentIndexFileIds = ref([])
|
|
|
|
|
|
const isBatchIndexOperation = ref(false)
|
2025-11-12 09:14:07 +08:00
|
|
|
|
|
2026-01-15 02:38:02 +08:00
|
|
|
|
// 分页配置
|
|
|
|
|
|
const paginationConfig = ref({
|
|
|
|
|
|
current: 1,
|
|
|
|
|
|
pageSize: 100,
|
|
|
|
|
|
pageSizeOptions: ['100', '300', '500', '1000']
|
2026-01-15 06:01:34 +08:00
|
|
|
|
})
|
2026-01-15 02:38:02 +08:00
|
|
|
|
|
|
|
|
|
|
// 文件总数
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const totalFiles = computed(() => files.value.length)
|
2026-01-15 02:38:02 +08:00
|
|
|
|
|
|
|
|
|
|
// 是否显示分页
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const showPagination = computed(() => totalFiles.value > paginationConfig.value.pageSize)
|
2026-01-15 02:38:02 +08:00
|
|
|
|
|
|
|
|
|
|
// 分页后的数据
|
|
|
|
|
|
const paginatedFiles = computed(() => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const list = filteredFiles.value
|
|
|
|
|
|
if (!showPagination.value) return list
|
2026-01-15 02:38:02 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const start = (paginationConfig.value.current - 1) * paginationConfig.value.pageSize
|
|
|
|
|
|
const end = start + paginationConfig.value.pageSize
|
|
|
|
|
|
return list.slice(start, end)
|
|
|
|
|
|
})
|
2026-01-15 02:38:02 +08:00
|
|
|
|
|
|
|
|
|
|
// 表格分页配置
|
|
|
|
|
|
const tablePagination = computed(() => ({
|
|
|
|
|
|
current: paginationConfig.value.current,
|
|
|
|
|
|
pageSize: paginationConfig.value.pageSize,
|
|
|
|
|
|
total: filteredFiles.value.length,
|
|
|
|
|
|
showSizeChanger: true,
|
|
|
|
|
|
showTotal: (total) => `共 ${total} 项`,
|
|
|
|
|
|
pageSizeOptions: paginationConfig.value.pageSizeOptions,
|
|
|
|
|
|
hideOnSinglePage: true
|
2026-01-15 06:01:34 +08:00
|
|
|
|
}))
|
2026-01-15 02:38:02 +08:00
|
|
|
|
|
|
|
|
|
|
// 处理表格变化(分页、每页条数切换)
|
|
|
|
|
|
const handleTableChange = (pagination) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
paginationConfig.value.current = pagination.current
|
|
|
|
|
|
paginationConfig.value.pageSize = pagination.pageSize
|
|
|
|
|
|
}
|
2026-01-15 02:38:02 +08:00
|
|
|
|
|
2025-08-05 18:00:45 +08:00
|
|
|
|
// 文件名过滤
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const filenameFilter = ref('')
|
|
|
|
|
|
const statusFilter = ref('all')
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const statusOptions = [
|
|
|
|
|
|
{ label: '已上传', value: 'uploaded' },
|
|
|
|
|
|
{ label: '解析中', value: 'parsing' },
|
|
|
|
|
|
{ label: '已解析', value: 'parsed' },
|
|
|
|
|
|
{ label: '解析失败', value: 'error_parsing' },
|
|
|
|
|
|
{ label: '入库中', value: 'indexing' },
|
|
|
|
|
|
{ label: '已入库', value: 'indexed' },
|
2026-01-15 06:01:34 +08:00
|
|
|
|
{ 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) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
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-12-30 14:28:48 +08:00
|
|
|
|
},
|
2025-08-05 18:00:45 +08:00
|
|
|
|
sortDirections: ['ascend', 'descend']
|
|
|
|
|
|
},
|
|
|
|
|
|
{
|
|
|
|
|
|
title: '状态',
|
|
|
|
|
|
dataIndex: 'status',
|
|
|
|
|
|
key: 'status',
|
2026-05-18 23:53:35 +08:00
|
|
|
|
width: 90,
|
2025-08-05 18:00:45 +08:00
|
|
|
|
sorter: (a, b) => {
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const statusOrder = {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
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)
|
2025-08-05 18:00:45 +08:00
|
|
|
|
},
|
|
|
|
|
|
sortDirections: ['ascend', 'descend']
|
|
|
|
|
|
},
|
2026-05-18 23:53:35 +08:00
|
|
|
|
{
|
|
|
|
|
|
title: '时间',
|
|
|
|
|
|
dataIndex: 'created_at',
|
|
|
|
|
|
key: 'created_at',
|
|
|
|
|
|
width: 180,
|
|
|
|
|
|
sorter: (a, b) => new Date(b.created_at || 0) - new Date(a.created_at || 0),
|
|
|
|
|
|
sortDirections: ['ascend', 'descend']
|
|
|
|
|
|
},
|
|
|
|
|
|
{ title: '操作', key: 'action', dataIndex: 'file_id', width: 64, align: 'center' }
|
2026-01-15 06:01:34 +08:00
|
|
|
|
]
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
// 构建文件树
|
|
|
|
|
|
const buildFileTree = (fileList) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
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
|
2026-01-15 06:01:34 +08:00
|
|
|
|
fileList.forEach((file) => {
|
|
|
|
|
|
const item = { ...file, displayName: file.filename }
|
2025-12-30 14:28:48 +08:00
|
|
|
|
if (item.is_folder && !item.children) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
item.children = []
|
2025-12-30 14:28:48 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
nodeMap.set(item.file_id, item)
|
|
|
|
|
|
})
|
2025-12-30 14:28:48 +08:00
|
|
|
|
|
|
|
|
|
|
// 2. 处理 parent_id (强关联)
|
2026-01-15 06:01:34 +08:00
|
|
|
|
fileList.forEach((file) => {
|
2025-12-30 14:28:48 +08:00
|
|
|
|
if (file.parent_id && nodeMap.has(file.parent_id)) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const parent = nodeMap.get(file.parent_id)
|
|
|
|
|
|
const child = nodeMap.get(file.file_id)
|
2025-12-30 14:28:48 +08:00
|
|
|
|
if (parent && child) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
if (!parent.children) parent.children = []
|
|
|
|
|
|
parent.children.push(child)
|
|
|
|
|
|
processedIds.add(file.file_id)
|
2025-12-30 14:28:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
})
|
2025-12-30 14:28:48 +08:00
|
|
|
|
|
|
|
|
|
|
// 3. 处理剩余项 (Roots 或 路径解析)
|
2026-01-15 06:01:34 +08:00
|
|
|
|
fileList.forEach((file) => {
|
|
|
|
|
|
if (processedIds.has(file.file_id)) return
|
2025-12-30 14:28:48 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const item = nodeMap.get(file.file_id)
|
|
|
|
|
|
const normalizedName = file.filename.replace(/\\/g, '/')
|
|
|
|
|
|
const parts = normalizedName.split('/')
|
2025-12-30 14:28:48 +08:00
|
|
|
|
|
2026-01-27 15:42:48 +08:00
|
|
|
|
// 检测是否是 URL(URL 不应该被解析为文件夹层级)
|
|
|
|
|
|
const isUrl = file.filename.startsWith('http://') || file.filename.startsWith('https://')
|
|
|
|
|
|
|
|
|
|
|
|
if (isUrl || parts.length === 1) {
|
2025-12-30 14:28:48 +08:00
|
|
|
|
// Root item
|
|
|
|
|
|
// Check if it's an explicit folder that should merge with an existing implicit one?
|
|
|
|
|
|
if (item.is_folder) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
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)
|
|
|
|
|
|
}
|
2025-12-30 14:28:48 +08:00
|
|
|
|
} else {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
roots.push(item)
|
2025-12-30 14:28:48 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// Path based logic for files like "A/B.txt"
|
2026-01-15 06:01:34 +08:00
|
|
|
|
let currentLevel = roots
|
|
|
|
|
|
let currentPath = ''
|
2025-12-30 14:28:48 +08:00
|
|
|
|
|
|
|
|
|
|
for (let i = 0; i < parts.length - 1; i++) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
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
|
2026-01-15 06:01:34 +08:00
|
|
|
|
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,
|
2026-01-15 06:01:34 +08:00
|
|
|
|
status: 'done'
|
|
|
|
|
|
}
|
|
|
|
|
|
currentLevel.push(node)
|
2025-12-30 14:28:48 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
currentLevel = node.children
|
2025-12-30 14:28:48 +08:00
|
|
|
|
}
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const fileName = parts[parts.length - 1]
|
|
|
|
|
|
item.displayName = fileName
|
|
|
|
|
|
currentLevel.push(item)
|
2025-12-30 14:28:48 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
})
|
2025-12-30 14:28:48 +08:00
|
|
|
|
|
|
|
|
|
|
// 排序:文件夹在前,文件在后,按名称排序
|
|
|
|
|
|
const sortNodes = (nodes) => {
|
|
|
|
|
|
nodes.sort((a, b) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
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
|
|
|
|
|
2026-05-18 23:53:35 +08:00
|
|
|
|
return (a.filename || '').localeCompare(b.filename || '')
|
2026-01-15 06:01:34 +08:00
|
|
|
|
})
|
|
|
|
|
|
nodes.forEach((node) => {
|
|
|
|
|
|
if (node.children) sortNodes(node.children)
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2025-12-30 14:28:48 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
sortNodes(roots)
|
|
|
|
|
|
return roots
|
|
|
|
|
|
}
|
2025-12-30 14:28:48 +08:00
|
|
|
|
|
2025-08-05 18:00:45 +08:00
|
|
|
|
// 过滤后的文件列表
|
|
|
|
|
|
const filteredFiles = computed(() => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
let filtered = files.value
|
|
|
|
|
|
const nameFilter = filenameFilter.value.trim().toLowerCase()
|
|
|
|
|
|
const status = statusFilter.value
|
2026-01-04 21:35:25 +08:00
|
|
|
|
|
|
|
|
|
|
// 应用过滤
|
2026-01-15 04:54:53 +08:00
|
|
|
|
if (nameFilter || status !== 'all') {
|
2026-01-04 21:35:25 +08:00
|
|
|
|
// 搜索/过滤模式下使用扁平列表
|
2026-01-15 06:01:34 +08:00
|
|
|
|
return files.value
|
|
|
|
|
|
.filter((file) => {
|
|
|
|
|
|
const nameMatch =
|
|
|
|
|
|
!nameFilter || (file.filename && file.filename.toLowerCase().includes(nameFilter))
|
|
|
|
|
|
const statusMatch =
|
|
|
|
|
|
status === 'all' ||
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
return buildFileTree(filtered)
|
|
|
|
|
|
})
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
|
|
|
|
|
// 空状态文本
|
|
|
|
|
|
const emptyText = computed(() => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
return filenameFilter.value ? `没有找到包含"${filenameFilter.value}"的文件` : '暂无文件'
|
|
|
|
|
|
})
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
|
|
|
|
|
// 计算是否可以批量删除
|
|
|
|
|
|
const canBatchDelete = computed(() => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
return selectedRowKeys.value.some((key) => {
|
|
|
|
|
|
const file = files.value.find((f) => f.file_id === key)
|
|
|
|
|
|
return file && !(lock.value || file.status === 'processing' || file.status === 'waiting')
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
// 计算是否可以批量解析
|
|
|
|
|
|
const canBatchParse = computed(() => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
return selectedRowKeys.value.some((key) => {
|
|
|
|
|
|
const file = filteredFiles.value.find((f) => f.file_id === key)
|
|
|
|
|
|
return file && !lock.value && (file.status === 'uploaded' || file.status === 'error_parsing')
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
2026-01-04 21:35:25 +08:00
|
|
|
|
|
|
|
|
|
|
// 计算是否可以批量入库
|
|
|
|
|
|
const canBatchIndex = computed(() => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
return selectedRowKeys.value.some((key) => {
|
|
|
|
|
|
const file = filteredFiles.value.find((f) => f.file_id === key)
|
|
|
|
|
|
return (
|
|
|
|
|
|
file &&
|
|
|
|
|
|
!lock.value &&
|
|
|
|
|
|
(file.status === 'parsed' ||
|
|
|
|
|
|
file.status === 'error_indexing' ||
|
2026-05-17 13:06:25 +08:00
|
|
|
|
file.status === 'done' ||
|
|
|
|
|
|
file.status === 'indexed')
|
2026-01-15 06:01:34 +08:00
|
|
|
|
)
|
|
|
|
|
|
})
|
|
|
|
|
|
})
|
2025-11-12 09:14:07 +08:00
|
|
|
|
|
2025-08-05 18:00:45 +08:00
|
|
|
|
const handleRefresh = () => {
|
2026-01-15 02:38:02 +08:00
|
|
|
|
// 刷新时重置分页
|
2026-01-15 06:01:34 +08:00
|
|
|
|
paginationConfig.value.current = 1
|
|
|
|
|
|
store.getDatabaseInfo(undefined, true) // Skip query params for manual refresh
|
|
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
const onSelectChange = (keys, selectedRows) => {
|
|
|
|
|
|
// 只保留非文件夹的文件ID
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const fileKeys = selectedRows.filter((row) => !row.is_folder).map((row) => row.file_id)
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
selectedRowKeys.value = fileKeys
|
|
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
|
|
|
|
|
const getCheckboxProps = (record) => ({
|
2026-01-15 06:01:34 +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) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
filenameFilter.value = e.target.value
|
2026-01-15 02:38:02 +08:00
|
|
|
|
// 过滤变化时重置到第一页
|
2026-01-15 06:01:34 +08:00
|
|
|
|
paginationConfig.value.current = 1
|
|
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
|
|
|
|
|
const handleDeleteFile = (fileId) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
store.handleDeleteFile(fileId)
|
|
|
|
|
|
closePopover(fileId)
|
|
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2025-12-30 14:28:48 +08:00
|
|
|
|
const handleDeleteFolder = (record) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
closePopover(record.file_id)
|
|
|
|
|
|
Modal.confirm({
|
|
|
|
|
|
title: '删除文件夹',
|
|
|
|
|
|
content: `确定要删除文件夹 "${record.filename}" 及其包含的所有内容吗?`,
|
|
|
|
|
|
okText: '确认',
|
|
|
|
|
|
cancelText: '取消',
|
|
|
|
|
|
onOk: async () => {
|
|
|
|
|
|
try {
|
|
|
|
|
|
await store.deleteFile(record.file_id)
|
|
|
|
|
|
message.success('删除成功')
|
2026-03-26 13:53:35 +08:00
|
|
|
|
} catch {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
// Error handled in store but we can add extra handling if needed
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
2025-12-30 14:28:48 +08:00
|
|
|
|
|
2025-08-05 18:00:45 +08:00
|
|
|
|
const handleBatchDelete = () => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
store.handleBatchDelete()
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const handleBatchParse = async () => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
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')
|
|
|
|
|
|
})
|
2026-01-04 21:35:25 +08:00
|
|
|
|
|
|
|
|
|
|
if (validKeys.length === 0) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
message.warning('没有可解析的文件')
|
|
|
|
|
|
return
|
2025-11-12 09:14:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
await store.parseFiles(validKeys)
|
|
|
|
|
|
selectedRowKeys.value = []
|
|
|
|
|
|
}
|
2026-01-04 21:35:25 +08:00
|
|
|
|
|
|
|
|
|
|
const handleBatchIndex = async () => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const validKeys = selectedRowKeys.value.filter((key) => {
|
|
|
|
|
|
const file = files.value.find((f) => f.file_id === key)
|
|
|
|
|
|
return (
|
|
|
|
|
|
file &&
|
|
|
|
|
|
(file.status === 'parsed' ||
|
|
|
|
|
|
file.status === 'error_indexing' ||
|
2026-05-17 13:06:25 +08:00
|
|
|
|
file.status === 'done' ||
|
|
|
|
|
|
file.status === 'indexed')
|
2026-01-15 06:01:34 +08:00
|
|
|
|
)
|
|
|
|
|
|
})
|
2026-01-04 21:35:25 +08:00
|
|
|
|
|
|
|
|
|
|
if (validKeys.length === 0) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
message.warning('没有可入库的文件')
|
|
|
|
|
|
return
|
2025-11-12 09:14:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
currentIndexFileIds.value = [...validKeys]
|
|
|
|
|
|
isBatchIndexOperation.value = true
|
|
|
|
|
|
indexConfigModalTitle.value = '批量入库参数配置'
|
|
|
|
|
|
indexConfigModalVisible.value = true
|
|
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
|
|
|
|
|
const openFileDetail = (record) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
console.log('openFileDetail', record)
|
|
|
|
|
|
store.openFileDetail(record)
|
|
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
|
2025-09-21 23:48:56 +08:00
|
|
|
|
const handleDownloadFile = async (record) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
closePopover(record.file_id)
|
2026-05-21 19:33:00 +08:00
|
|
|
|
const kbId = store.kbId
|
|
|
|
|
|
if (!kbId) {
|
|
|
|
|
|
console.error('无法获取数据库ID,数据库ID:', store.kbId, '记录:', record)
|
2026-01-15 06:01:34 +08:00
|
|
|
|
message.error('无法获取数据库ID,请刷新页面后重试')
|
|
|
|
|
|
return
|
2025-09-21 23:48:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-21 19:33:00 +08:00
|
|
|
|
console.log('开始下载文件:', { kbId, fileId: record.file_id, record })
|
2025-09-21 23:48:56 +08:00
|
|
|
|
|
|
|
|
|
|
try {
|
2026-05-21 19:33:00 +08:00
|
|
|
|
const response = await documentApi.downloadDocument(kbId, record.file_id)
|
2025-09-21 23:48:56 +08:00
|
|
|
|
|
|
|
|
|
|
// 获取文件名
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const contentDisposition = response.headers.get('content-disposition')
|
|
|
|
|
|
let filename = record.filename
|
2025-09-21 23:48:56 +08:00
|
|
|
|
if (contentDisposition) {
|
|
|
|
|
|
// 首先尝试匹配RFC 2231格式 filename*=UTF-8''...
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const rfc2231Match = contentDisposition.match(/filename\*=UTF-8''([^;]+)/)
|
2025-09-21 23:48:56 +08:00
|
|
|
|
if (rfc2231Match) {
|
|
|
|
|
|
try {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
filename = decodeURIComponent(rfc2231Match[1])
|
2025-09-21 23:48:56 +08:00
|
|
|
|
} catch (error) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
console.warn('Failed to decode RFC2231 filename:', rfc2231Match[1], error)
|
2025-09-21 23:48:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 回退到标准格式 filename="..."
|
2026-01-15 06:01:34 +08:00
|
|
|
|
const filenameMatch = contentDisposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/)
|
2025-09-21 23:48:56 +08:00
|
|
|
|
if (filenameMatch && filenameMatch[1]) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
filename = filenameMatch[1].replace(/['"]/g, '')
|
2025-09-21 23:48:56 +08:00
|
|
|
|
// 解码URL编码的文件名
|
|
|
|
|
|
try {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
filename = decodeURIComponent(filename)
|
2025-09-21 23:48:56 +08:00
|
|
|
|
} catch (error) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
console.warn('Failed to decode filename:', filename, error)
|
2025-09-21 23:48:56 +08:00
|
|
|
|
// 如果解码失败,使用原文件名
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 创建blob并下载
|
2026-01-15 06:01:34 +08:00
|
|
|
|
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)
|
2025-09-21 23:48:56 +08:00
|
|
|
|
} catch (error) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
console.error('下载文件时出错:', error)
|
|
|
|
|
|
const errorMessage = error.message || '下载失败,请稍后重试'
|
|
|
|
|
|
message.error(errorMessage)
|
2025-09-21 23:48:56 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
}
|
2025-09-21 23:48:56 +08:00
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const handleParseFile = async (record) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
closePopover(record.file_id)
|
|
|
|
|
|
await store.parseFiles([record.file_id])
|
|
|
|
|
|
}
|
2025-11-12 09:14:07 +08:00
|
|
|
|
|
2026-05-16 17:21:27 +08:00
|
|
|
|
const resetIndexParams = (processingParams = null) => {
|
|
|
|
|
|
if (!processingParams) {
|
|
|
|
|
|
indexParams.value = createDefaultIndexParams()
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const chunkParserConfig = processingParams.chunk_parser_config
|
|
|
|
|
|
indexParams.value = {
|
|
|
|
|
|
chunk_preset_id: processingParams.chunk_preset_id || '',
|
|
|
|
|
|
chunk_parser_config: isPlainObject(chunkParserConfig) ? { ...chunkParserConfig } : {}
|
|
|
|
|
|
}
|
2026-03-25 08:06:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const loadRecordProcessingParams = async (record) => {
|
|
|
|
|
|
if (record?.processing_params) {
|
|
|
|
|
|
return record.processing_params
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-21 19:33:00 +08:00
|
|
|
|
const detail = await documentApi.getDocumentInfo(store.kbId, record.file_id)
|
2026-03-25 08:06:25 +08:00
|
|
|
|
return detail?.processing_params || null
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
const handleIndexFile = async (record) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
closePopover(record.file_id)
|
|
|
|
|
|
currentIndexFileIds.value = [record.file_id]
|
|
|
|
|
|
isBatchIndexOperation.value = false
|
|
|
|
|
|
indexConfigModalTitle.value = '入库参数配置'
|
2026-01-04 21:35:25 +08:00
|
|
|
|
|
2026-03-25 08:06:25 +08:00
|
|
|
|
const processingParams = await loadRecordProcessingParams(record)
|
2026-05-16 17:21:27 +08:00
|
|
|
|
resetIndexParams(processingParams)
|
2026-01-04 21:35:25 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +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) => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
closePopover(record.file_id)
|
|
|
|
|
|
currentIndexFileIds.value = [record.file_id]
|
|
|
|
|
|
isBatchIndexOperation.value = false
|
|
|
|
|
|
indexConfigModalTitle.value = '重新入库参数配置'
|
2026-01-04 21:35:25 +08:00
|
|
|
|
|
2026-03-25 08:06:25 +08:00
|
|
|
|
const processingParams = await loadRecordProcessingParams(record)
|
2026-05-16 17:21:27 +08:00
|
|
|
|
resetIndexParams(processingParams)
|
2026-01-04 21:35:25 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
indexConfigModalVisible.value = true
|
|
|
|
|
|
}
|
2026-01-04 21:35:25 +08:00
|
|
|
|
|
|
|
|
|
|
// 入库确认 (统一处理 Index 和 Reindex)
|
|
|
|
|
|
const handleIndexConfigConfirm = async () => {
|
2025-11-12 09:14:07 +08:00
|
|
|
|
try {
|
2026-01-04 21:35:25 +08:00
|
|
|
|
// 调用 indexFiles 接口 (支持 params)
|
2026-02-20 19:35:43 +08:00
|
|
|
|
const result = await store.indexFiles(currentIndexFileIds.value, buildIndexParamsPayload())
|
2025-11-12 23:14:56 +08:00
|
|
|
|
if (result) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
currentIndexFileIds.value = []
|
2025-11-12 09:14:07 +08:00
|
|
|
|
// 清空选择
|
2026-01-04 21:35:25 +08:00
|
|
|
|
if (isBatchIndexOperation.value) {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
selectedRowKeys.value = []
|
2025-11-12 09:14:07 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 关闭模态框
|
2026-01-15 06:01:34 +08:00
|
|
|
|
indexConfigModalVisible.value = false
|
2025-11-12 23:14:56 +08:00
|
|
|
|
|
2026-05-16 17:21:27 +08:00
|
|
|
|
resetIndexParams()
|
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-15 06:01:34 +08:00
|
|
|
|
console.error('入库失败:', error)
|
|
|
|
|
|
const errorMessage = error.message || '入库失败,请稍后重试'
|
|
|
|
|
|
message.error(errorMessage)
|
2025-11-12 09:14:07 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +08:00
|
|
|
|
}
|
2025-11-12 09:14:07 +08:00
|
|
|
|
|
2026-01-04 21:35:25 +08:00
|
|
|
|
// 入库取消
|
|
|
|
|
|
const handleIndexConfigCancel = () => {
|
2026-01-15 06:01:34 +08:00
|
|
|
|
indexConfigModalVisible.value = false
|
|
|
|
|
|
currentIndexFileIds.value = []
|
|
|
|
|
|
isBatchIndexOperation.value = false
|
2026-05-16 17:21:27 +08:00
|
|
|
|
resetIndexParams()
|
2026-01-15 06:01:34 +08:00
|
|
|
|
}
|
2025-11-12 09:14:07 +08:00
|
|
|
|
|
2025-08-05 18:00:45 +08:00
|
|
|
|
// 导入工具函数
|
2026-05-18 23:53:35 +08:00
|
|
|
|
import { getFileIcon, getFileIconColor, formatStandardTime } from '@/utils/file_utils'
|
2026-05-16 17:21:27 +08:00
|
|
|
|
import { buildChunkParamsPayload, isPlainObject } from '@/utils/chunk_presets'
|
2026-01-15 06:01:34 +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);
|
2026-05-17 18:06:25 +08:00
|
|
|
|
container-type: inline-size;
|
|
|
|
|
|
container-name: file-table;
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.panel-header {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
flex-shrink: 0;
|
2026-05-18 23:53:35 +08:00
|
|
|
|
padding: 12px;
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.panel-actions {
|
2026-05-18 23:53:35 +08:00
|
|
|
|
width: 100%;
|
2025-08-05 18:00:45 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
2026-05-18 23:53:35 +08:00
|
|
|
|
gap: 8px;
|
2025-10-25 16:01:50 +08:00
|
|
|
|
|
2026-05-17 18:06:25 +08:00
|
|
|
|
.panel-actions-default {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 6px;
|
2026-05-18 23:53:35 +08:00
|
|
|
|
margin-left: auto;
|
2026-05-17 18:06:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.overflow-trigger {
|
|
|
|
|
|
display: none;
|
2026-05-18 23:53:35 +08:00
|
|
|
|
margin-left: auto;
|
2026-05-17 18:06:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-10-25 16:01:50 +08:00
|
|
|
|
.action-searcher {
|
|
|
|
|
|
width: 120px;
|
|
|
|
|
|
margin-right: 8px;
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
padding: 4px 8px;
|
|
|
|
|
|
border: none;
|
2026-01-15 04:54:53 +08:00
|
|
|
|
box-shadow: 0 0 0 1px var(--shadow-1);
|
2025-10-25 16:01:50 +08:00
|
|
|
|
}
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-17 18:06:25 +08:00
|
|
|
|
@container file-table (max-width: 480px) {
|
|
|
|
|
|
.panel-actions {
|
|
|
|
|
|
.panel-actions-default {
|
|
|
|
|
|
display: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.overflow-trigger {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
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-06 21:59:48 +08:00
|
|
|
|
.my-table {
|
2025-08-05 18:00:45 +08:00
|
|
|
|
flex: 1;
|
|
|
|
|
|
overflow: auto;
|
|
|
|
|
|
background-color: transparent;
|
2026-01-15 04:54:53 +08:00
|
|
|
|
min-height: 0;
|
|
|
|
|
|
table-layout: fixed;
|
2026-05-18 23:53:35 +08:00
|
|
|
|
padding: 0 8px;
|
2025-08-05 18:00:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
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-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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-05-18 23:53:35 +08:00
|
|
|
|
.file-status-cell {
|
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 6px;
|
|
|
|
|
|
color: var(--gray-700);
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.file-status-icon {
|
|
|
|
|
|
display: inline-flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.status-success {
|
|
|
|
|
|
color: var(--color-success-500);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.status-error {
|
|
|
|
|
|
color: var(--color-error-500);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.status-info {
|
|
|
|
|
|
color: var(--color-info-500);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.status-warning {
|
|
|
|
|
|
color: var(--color-warning-500);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.status-primary {
|
|
|
|
|
|
color: var(--color-primary-500);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.file-time-cell {
|
|
|
|
|
|
color: var(--gray-600);
|
|
|
|
|
|
white-space: nowrap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-15 04:54:53 +08:00
|
|
|
|
.my-table .span-type.md,
|
|
|
|
|
|
.my-table .span-type.markdown {
|
|
|
|
|
|
background-color: var(--gray-200);
|
|
|
|
|
|
color: var(--gray-800);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-05 18:00:45 +08:00
|
|
|
|
.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;
|
2026-01-15 04:54:53 +08:00
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
padding: 4px;
|
|
|
|
|
|
color: var(--gray-600);
|
2025-08-05 18:00:45 +08:00
|
|
|
|
transition: all 0.1s ease;
|
2025-10-25 16:01:50 +08:00
|
|
|
|
font-size: 12px;
|
2026-01-15 04:54:53 +08:00
|
|
|
|
width: auto;
|
|
|
|
|
|
height: auto;
|
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;
|
2026-01-15 04:54:53 +08:00
|
|
|
|
box-shadow: 0 0 0 1px var(--shadow-1);
|
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-15 06:01:34 +08:00
|
|
|
|
outline: 2px dashed var(--main-color);
|
|
|
|
|
|
outline-offset: -2px;
|
|
|
|
|
|
z-index: 10;
|
2025-12-30 23:57:20 +08:00
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
td {
|
|
|
|
|
|
background-color: transparent !important;
|
2026-01-04 22:47:39 +08:00
|
|
|
|
}
|
2026-01-15 06:01:34 +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);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-15 06:01:34 +08:00
|
|
|
|
.anticon,
|
|
|
|
|
|
.lucide {
|
2025-12-18 11:47:54 +08:00
|
|
|
|
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
|
|
|
|
|
2026-05-17 18:06:25 +08:00
|
|
|
|
.panel-overflow-popover {
|
|
|
|
|
|
.ant-popover-inner {
|
|
|
|
|
|
padding: 0;
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
border: 1px solid var(--gray-150);
|
|
|
|
|
|
background: var(--gray-0);
|
|
|
|
|
|
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
|
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.ant-popover-arrow {
|
|
|
|
|
|
display: none;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.overflow-menu-panel {
|
2026-05-17 19:55:29 +08:00
|
|
|
|
width: 160px;
|
2026-05-17 18:06:25 +08:00
|
|
|
|
background: var(--gray-0);
|
|
|
|
|
|
border: 1px solid var(--gray-150);
|
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
|
|
|
|
|
|
|
.overflow-search {
|
|
|
|
|
|
padding: 10px 12px 8px;
|
|
|
|
|
|
border-bottom: 1px solid var(--gray-100);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.overflow-actions {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
|
padding: 4px;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.overflow-action-item {
|
|
|
|
|
|
display: flex;
|
|
|
|
|
|
align-items: center;
|
|
|
|
|
|
gap: 10px;
|
|
|
|
|
|
padding: 8px 12px;
|
|
|
|
|
|
border-radius: 6px;
|
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
|
color: var(--gray-700);
|
|
|
|
|
|
transition: background-color 0.1s ease;
|
|
|
|
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
|
|
background-color: var(--gray-50);
|
|
|
|
|
|
color: var(--main-color);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
&.active {
|
|
|
|
|
|
color: var(--main-color);
|
|
|
|
|
|
background-color: var(--main-10);
|
|
|
|
|
|
font-weight: 500;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.overflow-action-hint {
|
|
|
|
|
|
margin-left: auto;
|
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
|
color: var(--gray-400);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
.spin {
|
|
|
|
|
|
animation: spin 1s linear infinite;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@keyframes spin {
|
|
|
|
|
|
from {
|
|
|
|
|
|
transform: rotate(0deg);
|
|
|
|
|
|
}
|
|
|
|
|
|
to {
|
|
|
|
|
|
transform: rotate(360deg);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-12-18 11:47:54 +08:00
|
|
|
|
</style>
|