From 7fef9e2bb252a2be2f813be4849a6516b5c2f7f6 Mon Sep 17 00:00:00 2001 From: cat_shark <1716967236@qq.com> Date: Sat, 4 Jul 2026 00:03:18 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E5=A4=8D=E4=B9=A0)=EF=BC=9Amind-elixir=20?= =?UTF-8?q?=E6=80=9D=E7=BB=B4=E5=AF=BC=E5=9B=BE=E5=8F=AF=E8=A7=86=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - MindMapViewer 组件封装 mind-elixir:展示/编辑/对比着色三种形态 - 对比结果以导图呈现:绿=命中、红=遗漏,点击带标签节点回看原文 - 标准导图展开后以导图渲染,编辑改为图上直接操作(Tab/Enter/双击) - 保存时从导图导出缩进大纲,与后端 MindMapTreeTool 格式一致 --- src/components/MindMapViewer.vue | 158 +++++++++++++++++++++++++++++++ src/components/ReviewRecall.vue | 54 +++++++++-- 2 files changed, 205 insertions(+), 7 deletions(-) create mode 100644 src/components/MindMapViewer.vue diff --git a/src/components/MindMapViewer.vue b/src/components/MindMapViewer.vue new file mode 100644 index 0000000..2e04c54 --- /dev/null +++ b/src/components/MindMapViewer.vue @@ -0,0 +1,158 @@ + + + + + diff --git a/src/components/ReviewRecall.vue b/src/components/ReviewRecall.vue index b9e7b29..6235585 100644 --- a/src/components/ReviewRecall.vue +++ b/src/components/ReviewRecall.vue @@ -11,6 +11,7 @@ import { type RecallRecord, } from "@/api/standardMindMap"; import { ElMessage, ElMessageBox } from "element-plus"; +import MindMapViewer, { type MindMapTreeNode } from "@/components/MindMapViewer.vue"; const route = useRoute(); const router = useRouter(); @@ -30,11 +31,34 @@ const standardExpanded = ref(false); const editingStandard = ref(false); const editOutline = ref(""); const savingStandard = ref(false); +const editViewer = ref | null>(null); // 回忆历史 const historyRecords = ref([]); const showHistory = ref(false); +// 解析标准导图 JSON 为树节点 +const standardTree = computed(() => { + if (!standard.value?.content) return null; + try { + return JSON.parse(standard.value.content) as MindMapTreeNode; + } catch { + return null; + } +}); + +// 对比结果树(带 MATCHED/MISSED 标注) +const compareTree = computed(() => { + return (lastResult.value?.matchedTree as MindMapTreeNode) || null; +}); + +// 点击着色节点跳转原文 +const goToNodeSource = (node: { sourceType: string; sourceId: number }) => { + if (node.sourceType === "REPORT" || node.sourceType === "FRAGMENT") { + router.push(`/review/detail/${node.sourceType.toLowerCase()}/${node.sourceId}`); + } +}; + // 格式化覆盖率 const ratioPercent = computed(() => { if (!lastResult.value?.recallRatio) return "0%"; @@ -130,6 +154,17 @@ const saveStandardEdit = async () => { } }; +// 从导图编辑器导出大纲并保存 +const saveStandardEditFromViewer = async () => { + const outline = editViewer.value?.toOutline() || ""; + if (!outline.trim()) { + ElMessage.warning("导图内容不可为空"); + return; + } + editOutline.value = outline; + await saveStandardEdit(); +}; + const cancelStandardEdit = () => { editingStandard.value = false; editOutline.value = ""; @@ -297,9 +332,14 @@ onMounted(() => { -
+

📊 对比结果

-
{{ resultText }}
+

绿色=回忆命中,红色=遗漏。点击带标签的节点可回看原文。

+
@@ -339,12 +379,11 @@ onMounted(() => {
-

编辑大纲文本,保存后标准导图将被更新。

- -

{{ standard.summary }}

+

直接在导图上编辑(Tab 加子节点 / Enter 加同级 / 双击改文字),保存后生效。

+
取消 - + 保存更新
@@ -355,7 +394,8 @@ onMounted(() => { 来源:{{ standard.generator }} 参考:{{ standard.sourceReportCount }} 份报告 + {{ standard.sourceFragmentCount }} 份残片
-
{{ standard.outline || standard.content }}
+ +
{{ standard.outline || standard.content }}

{{ standard.summary }}