You've already forked DataMate
refactor(KnowledgeManagement): 调整知识库详情页面文件列表展示逻辑
- 移除未使用的 Tag 组件导入 - 将文件标题列改为文件名列,并调整数据源为 sourceFileId - 修改文件名显示逻辑,统一返回 "文件" 作为默认值 - 移除负责人列的显示 - 更新搜索框占位符文本为 "搜索文件名或内容" - 调整文件名列宽度从 220px 增加到 260px - 优化文件名解析逻辑,根据文件类型返回对应的预览文件名
This commit is contained in:
@@ -8,7 +8,6 @@ import {
|
|||||||
Empty,
|
Empty,
|
||||||
Modal,
|
Modal,
|
||||||
Table,
|
Table,
|
||||||
Tag,
|
|
||||||
Tooltip,
|
Tooltip,
|
||||||
} from "antd";
|
} from "antd";
|
||||||
import { DeleteOutlined, DownloadOutlined, EditOutlined, EyeOutlined, PlusOutlined } from "@ant-design/icons";
|
import { DeleteOutlined, DownloadOutlined, EditOutlined, EyeOutlined, PlusOutlined } from "@ant-design/icons";
|
||||||
@@ -148,7 +147,7 @@ const KnowledgeSetDetail = () => {
|
|||||||
return lastSegment;
|
return lastSegment;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return record.title || "文件";
|
return "文件";
|
||||||
};
|
};
|
||||||
|
|
||||||
const handlePreviewItemFile = async (record: KnowledgeItemView) => {
|
const handlePreviewItemFile = async (record: KnowledgeItemView) => {
|
||||||
@@ -268,21 +267,21 @@ const KnowledgeSetDetail = () => {
|
|||||||
|
|
||||||
const itemColumns = [
|
const itemColumns = [
|
||||||
{
|
{
|
||||||
title: "标题",
|
title: "文件名",
|
||||||
dataIndex: "title",
|
dataIndex: "sourceFileId",
|
||||||
key: "title",
|
key: "sourceFileId",
|
||||||
fixed: "left" as const,
|
fixed: "left" as const,
|
||||||
width: 220,
|
width: 260,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
|
render: (_: string, record: KnowledgeItemView) => {
|
||||||
|
if (
|
||||||
|
record.contentType === KnowledgeContentType.FILE ||
|
||||||
|
record.sourceType === KnowledgeSourceType.FILE_UPLOAD
|
||||||
|
) {
|
||||||
|
return resolvePreviewFileName(record);
|
||||||
|
}
|
||||||
|
return record.sourceFileId || "-";
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: "状态",
|
|
||||||
dataIndex: "status",
|
|
||||||
key: "status",
|
|
||||||
width: 120,
|
|
||||||
render: (status: KnowledgeItemView["status"]) => (
|
|
||||||
<Tag color={status?.color}>{status?.label}</Tag>
|
|
||||||
),
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "类型",
|
title: "类型",
|
||||||
@@ -293,13 +292,6 @@ const KnowledgeSetDetail = () => {
|
|||||||
knowledgeContentTypeOptions.find((opt) => opt.value === contentType)?.label ||
|
knowledgeContentTypeOptions.find((opt) => opt.value === contentType)?.label ||
|
||||||
contentType,
|
contentType,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: "负责人",
|
|
||||||
dataIndex: "owner",
|
|
||||||
key: "owner",
|
|
||||||
width: 120,
|
|
||||||
ellipsis: true,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
title: "来源",
|
title: "来源",
|
||||||
dataIndex: "sourceType",
|
dataIndex: "sourceType",
|
||||||
@@ -474,7 +466,7 @@ const KnowledgeSetDetail = () => {
|
|||||||
<SearchControls
|
<SearchControls
|
||||||
searchTerm={searchParams.keyword}
|
searchTerm={searchParams.keyword}
|
||||||
onSearchChange={handleKeywordChange}
|
onSearchChange={handleKeywordChange}
|
||||||
searchPlaceholder="搜索标题或内容"
|
searchPlaceholder="搜索文件名或内容"
|
||||||
filters={[]}
|
filters={[]}
|
||||||
onFiltersChange={handleFiltersChange}
|
onFiltersChange={handleFiltersChange}
|
||||||
onClearFilters={() => setSearchParams({ ...searchParams, filter: { type: [], status: [], tags: [] } })}
|
onClearFilters={() => setSearchParams({ ...searchParams, filter: { type: [], status: [], tags: [] } })}
|
||||||
|
|||||||
Reference in New Issue
Block a user