From 1b764e4e7c85b82c00d44992cdf975a2a74e53a0 Mon Sep 17 00:00:00 2001 From: hanyuqing <1106611654@qq.com> Date: Wed, 14 Jan 2026 14:34:52 +0800 Subject: [PATCH 1/2] all --- vue/src/system/GraphBuilder.vue | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vue/src/system/GraphBuilder.vue b/vue/src/system/GraphBuilder.vue index e5db356..80cf9ba 100644 --- a/vue/src/system/GraphBuilder.vue +++ b/vue/src/system/GraphBuilder.vue @@ -335,11 +335,13 @@ export default { allSelect(msg){ if (msg.entities && msg.entities.length > 0) { msg.entities.forEach(ent => { + ent.selected=true this.selectedEntities.push(ent); }); } if (msg.relations && msg.relations.length > 0) { msg.relations.forEach(rel => { + rel.selected=true this.selectedRelations.push(rel); }); } From 4e2e024f2b9308d2d8818aad29274e948253048e Mon Sep 17 00:00:00 2001 From: hanyuqing <1106611654@qq.com> Date: Wed, 14 Jan 2026 15:00:50 +0800 Subject: [PATCH 2/2] all --- vue/src/system/GraphDemo.vue | 303 ++++++++++----------------- vue/src/system/GraphQA.vue | 480 +++++++++++++++++++------------------------ 2 files changed, 328 insertions(+), 455 deletions(-) diff --git a/vue/src/system/GraphDemo.vue b/vue/src/system/GraphDemo.vue index f80e6ee..1439871 100644 --- a/vue/src/system/GraphDemo.vue +++ b/vue/src/system/GraphDemo.vue @@ -4,113 +4,113 @@ -
-
-
- - -
-
-
-
+
+
+ + +
+
+
+
- {{ item.label }} + class="color-block" + @click="toggleCategory(item.key)" + >
+ {{ item.label }} +
+
+
+
+
+
+
+
+ 疾病信息 + 药品信息 + 检查信息
+
{{diseaseCount.toLocaleString()}}种
+
{{ drugCount.toLocaleString() }}种
+
{{checkCount.toLocaleString()}}种
- -
-
-
-
-
- 疾病信息 - 药品信息 - 检查信息 -
-
{{diseaseCount.toLocaleString()}}种
-
{{ drugCount.toLocaleString() }}种
-
{{checkCount.toLocaleString()}}种
-
-
- -
- -
+
+ +
+ +
{{ currentTypeLabel }} - -
- - -
-
- {{ item.label }} -
-
+ +
+ + +
+
+ {{ item.label }}
-
- - - - - - - - - - - - - - - - - -
- - ICD10 - 科室 - 首字母 - + +
+
+ + + + + + + + + + + + + + + + + +
+ + ICD10 + 科室 + 首字母 + -
-
- - 药物分类 - 首字母 - +
+
+ + 药物分类 + 首字母 + -
-
+
+
-
@@ -162,17 +155,14 @@ import { import {Graph, Tooltip} from '@antv/g6'; import Menu from "@/components/Menu.vue"; import {a} from "vue-router/dist/devtools-EWN81iOl.mjs"; -import GraphToolbar from "@/components/GraphToolbar.vue"; import Fuse from 'fuse.js'; -import {ElMessage} from "element-plus"; import {getGraphStyleActive} from "@/api/style"; export default { name: 'Display', - components: {Menu,GraphToolbar}, + components: {Menu}, data() { return { - _graph: null, G6: null, // 添加这个 // 节点样式 nodeShowLabel: true, @@ -1174,18 +1164,18 @@ export default { label:node.name, type:node.label } - getGraph(data).then(response => { + getGraph(data).then(response=>{ console.log(response) this.formatData(response) }); // 等待 Promise 解析 }); graph.once('afterlayout', () => { if (!graph.destroyed) { - graph.fitCenter({padding: 40, duration: 1000}); + graph.fitCenter({ padding: 40, duration: 1000 }); } }); this._graph = graph - this._graph.setPlugins([{ + this._graph.setPlugins([ { type: 'tooltip', // 只对节点启用,边不显示tooltip enable: (e) => e.targetType === 'edge', @@ -1194,7 +1184,7 @@ export default { console.log(e) const edge = items[0]; // 当前悬停的边 if (!edge) return ''; - const data = items[0].data + const data=items[0].data const sourceId = edge.source; const targetId = edge.target; @@ -1211,72 +1201,10 @@ export default { ${sourceName} — ${rel} —> ${targetName}
`; }, - }, - { - type: 'toolbar', - onClick: (id) => - { - if (id === 'reset') { - // 1. 如果是重置,直接在本地执行方法 - this.localResetGraph(); - } - else if (this.$refs.toolbarRef) { - // 2. 其他功能(放大、导出等)继续交给组件处理 - this.$refs.toolbarRef.handleToolbarAction(id); - } - }, - getItems: () => { - return [ - { id: 'zoom-in', value: 'zoom-in', title: '放大' }, - { id: 'zoom-out', value: 'zoom-out', title: '缩小' }, - { id: 'undo', value: 'undo', title: '撤销' }, - { id: 'redo', value: 'redo', title: '重做' }, - { id: 'auto-fit', value: 'auto-fit', title: '聚焦' }, - { id: 'reset', value: 'reset', title: '重置' }, - { id: 'export', value: 'export', title: '导出图谱' }, - ]; - }, - }, - // 如果需要撤销重做功能,必须加上 history 插件 - { type: 'history', key: 'history' }]) + },]) } - }, - localResetGraph() { - // 1. 检查图表实例和数据是否存在 - if (!this._graph) return; - - if (!this.defaultData || !this.defaultData.nodes) { - this.$message.warning("未找到可重置的数据源"); - return; - } - - try { - // 2. 彻底清理鼠标指针状态 - const canvas = this._graph.getCanvas(); - if (canvas && typeof canvas.setCursor === 'function') { - canvas.setCursor('default'); - } - - // 3. 彻底销毁当前图谱实例 - // 销毁会移除所有 DOM 节点和事件监听,彻底解决 EventBoundary 问题 - this._graph.destroy(); - this._graph = null; - // 4. 重新初始化 - this.$nextTick(() => { - // initGraph 内部会自动读取 this.defaultData - this.initGraph(); - - // 5. 重新构建分类索引(因为 destroy 也会清空之前的交互索引) - this.buildCategoryIndex(); - this.$message.success("图谱已重置"); - }); - } catch (err) { - console.error('重置图谱失败:', err); - // 降级处理:如果销毁失败,尝试刷新页面(可选) - // location.reload(); - } }, updateGraph(data) { @@ -1313,7 +1241,7 @@ export default { if (!this._graph) return const updatedEdges = this.defaultData.edges.map(edge => ({ ...edge, - type: this.edgeType, + type:this.edgeType, style: { endArrow: this.edgeEndArrow, stroke: this.edgeStroke, @@ -1596,14 +1524,12 @@ button:hover { padding: 0 2px 0px 15px; justify-content: space-between; } - -.d-title { +.d-title{ display: flex; align-items: center; font-size: 13px; } - -.d-count { +.d-count{ font-size: 9px; background-color: #5989F0; border-radius: 7px; @@ -1650,21 +1576,19 @@ button:hover { text-align: left; font-size: 12px; } - -.disease-body { +.disease-body{ width: 360px; overflow: scroll; height: 74vh; } - /* 隐藏滚动条,但允许滚动 */ .disease-body { /* Firefox */ scrollbar-width: none; /* 'auto' | 'thin' | 'none' */ /* Webkit (Chrome, Safari, Edge) */ - -ms-overflow-style: none; /* IE and Edge */ - scrollbar-width: none; /* Firefox */ + -ms-overflow-style: none; /* IE and Edge */ + scrollbar-width: none; /* Firefox */ padding-bottom: 9px; } @@ -1682,12 +1606,12 @@ button:hover { /deep/ .radio-drug .el-radio__input.is-checked .el-radio__inner { background: #52c41a; /* 检查的颜色 */ - border-color: #52c41a; + border-color:#52c41a; } /deep/ .radio-check .el-radio__input.is-checked .el-radio__inner { background: #1890ff; /* 药品的颜色 */ - border-color: #1890ff; + border-color:#1890ff; } @@ -1700,26 +1624,25 @@ button:hover { /deep/ .radio-drug .el-radio__input.is-checked .el-radio__inner:hover { background: #52c41a; /* 检查的颜色 */ - border-color: #52c41a; + border-color:#52c41a; } /deep/ .radio-check .el-radio__input.is-checked .el-radio__inner:hover { background: #1890ff; /* 药品的颜色 */ - border-color: #1890ff; + border-color:#1890ff; } /* 自定义选中后的样式 */ -/deep/ .radio-disease .el-radio__input.is-checked + .el-radio__label { +/deep/ .radio-disease .el-radio__input.is-checked+.el-radio__label { color: rgb(153, 10, 0); } -/deep/ .radio-drug .el-radio__input.is-checked + .el-radio__label { +/deep/ .radio-drug .el-radio__input.is-checked+.el-radio__label { color: #52c41a; } - -/deep/ .radio-check .el-radio__input.is-checked + .el-radio__label { +/deep/ .radio-check .el-radio__input.is-checked+.el-radio__label { color: #1890ff; } /* 自定义下拉样式 */ diff --git a/vue/src/system/GraphQA.vue b/vue/src/system/GraphQA.vue index 5c1860f..badd374 100644 --- a/vue/src/system/GraphQA.vue +++ b/vue/src/system/GraphQA.vue @@ -33,7 +33,7 @@
-{{queryRecord}} + {{queryRecord}}

问答结果

@@ -63,12 +63,6 @@
- -
@@ -79,21 +73,21 @@ \ No newline at end of file