From 06edac27385668523a96e70a293c3cd12b9540e9 Mon Sep 17 00:00:00 2001
From: wanghanlin <1533525126@qq.com>
Date: Thu, 3 Sep 2026 15:54:11 +0800
Subject: [PATCH] =?UTF-8?q?feat(frontend):=20=E6=96=87=E6=A1=A3=E5=88=97?=
=?UTF-8?q?=E8=A1=A8=E4=BD=8D=E7=BD=AE=E5=88=97=E6=98=BE=E7=A4=BA=E7=9B=AE?=
=?UTF-8?q?=E5=BD=95=E8=B7=AF=E5=BE=84=E5=B9=B6=E4=BF=AE=E5=A4=8D=E4=B8=80?=
=?UTF-8?q?=E5=B1=8F=E6=BB=9A=E5=8A=A8=E5=B8=83=E5=B1=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 文档列表分类列改为「位置」列:沿 folderMap 回溯 parentId 拼出目录路径(不含分类名),直接挂分类根显示 —,长路径省略号截断+悬停 title 看全
- 修复文档卡片一屏高度布局:补 .t-loading__parent 参与 flex 高度链,目录树/表格在面板内滚动不再撑高整页
---
frontend/src/views/DocList.vue | 35 ++++++++++++++++++++++++++++++----
1 file changed, 31 insertions(+), 4 deletions(-)
diff --git a/frontend/src/views/DocList.vue b/frontend/src/views/DocList.vue
index 3e958f8..09e2192 100644
--- a/frontend/src/views/DocList.vue
+++ b/frontend/src/views/DocList.vue
@@ -82,7 +82,9 @@
{{ row.fileType }}
{{ formatSize(row.fileSize) }}
- {{ categoryStore.getCategoryName(row.categoryId) }}
+
+ {{ docPath(row) }}
+
{{ statusLabel(row.status) }}
@@ -189,6 +191,8 @@ const isResizing = ref(false)
const MIN_TREE_WIDTH = 200
const MAX_TREE_WIDTH = 480
let resizeCleanup: (() => void) | null = null
+// 目录 id → { name, parentId },位置列据此沿 parentId 回溯拼目录路径
+const folderMap = ref>({})
// 表格排序状态(服务端排序)
const sortInfo = ref<{ sortBy: string; descending: boolean } | null>(null)
@@ -232,7 +236,7 @@ const columns = [
{ colKey: 'title', title: '标题', width: 220, sorter: true },
{ colKey: 'fileType', title: '类型', width: 70, sorter: true },
{ colKey: 'fileSize', title: '大小', width: 80, sorter: true },
- { colKey: 'categoryId', title: '分类', width: 100 },
+ { colKey: 'categoryId', title: '位置', width: 200 },
{ colKey: 'status', title: '状态', width: 80 },
{ colKey: 'enabled', title: '启用', width: 60 },
{ colKey: 'chunkCount', title: '分块', width: 60, sorter: true },
@@ -262,6 +266,20 @@ function getDocTags(doc: any): string[] {
function statusLabel(s: string) { return s === 'READY' ? '已完成' : s === 'PROCESSING' ? '处理中' : s === 'FAILED' ? '失败' : s }
function formatSize(b: number) { return b ? formatBytes(b) : '-' }
+/** 计算文档所在目录路径(不含分类名);直接挂分类根/无目录时返回「—」 */
+function docPath(row: any): string {
+ let fid = row.folderId != null ? String(row.folderId) : '0'
+ const chain: string[] = []
+ let guard = 0
+ while (fid && fid !== '0' && guard++ < 20) {
+ const f = folderMap.value[fid]
+ if (!f) break
+ chain.unshift(f.name)
+ fid = String(f.parentId ?? '0')
+ }
+ return chain.length ? chain.join(' / ') : '—'
+}
+
// ==================== 搜索防抖 ====================
const debouncedLoad = debounce(() => load(1))
@@ -342,6 +360,9 @@ async function loadTreeData() {
const cats = catRes.success ? (catRes.data || []) : []
const folders = folderRes.success ? (folderRes.data || []) : []
treeData.value = buildTree(cats, folders)
+ // 目录映射:位置列只回溯目录链,无需分类链映射
+ folderMap.value = {}
+ for (const f of folders || []) folderMap.value[String(f.id)] = { name: f.name, parentId: f.parentId }
} catch (e: any) {
toast('加载目录树失败:' + e.message, 'error')
} finally {
@@ -626,10 +647,16 @@ loadData()