diff --git a/gyxtp/src/view/graphPageCopy0926.vue b/gyxtp/src/view/graphPageCopy0926.vue index 7f86c1e..c978ef6 100644 --- a/gyxtp/src/view/graphPageCopy0926.vue +++ b/gyxtp/src/view/graphPageCopy0926.vue @@ -983,39 +983,56 @@ export default { }) }, onNodeClick(nodeObject, $event) { - console.log(nodeObject.id) + console.log('Clicked node:', nodeObject.id); const graphInstance = this.$refs.graphRef.getInstance(); - let node = graphInstance.getNodeById(nodeObject.id) - let relinks = graphInstance.getLinesByNode(node); - - // let links = graphInstance.getLinks(); - // - // for (let i=0;i { + line.lineWidth = 1; + }); + + // 获取起始节点 + const startNode = graphInstance.getNodeById(nodeObject.id); + if (!startNode) return; + + // 存储需要高亮的所有边(去重) + const highlightLines = new Set(); + + // BFS 遍历所有下级节点(包括自己) + const queue = [startNode]; + const visited = new Set([startNode.id]); // 防止环导致无限循环 + + while (queue.length > 0) { + const currentNode = queue.shift(); + + // 获取当前节点的所有出边(即从该节点出发的边) + const outEdges = graphInstance.getLinesByNode(currentNode).filter(line => line.from === currentNode.id); + + for (const edge of outEdges) { + highlightLines.add(edge); + + const childNodeId = edge.to; + if (!visited.has(childNodeId)) { + const childNode = graphInstance.getNodeById(childNodeId); + if (childNode) { + visited.add(childNodeId); + queue.push(childNode); + } } } - return - } - if (this.lastNodeL!=""){ - let a = graphInstance.getLinesByNode(this.lastNodeL); - for (let i=0;i { + line.lineWidth = 10; + }); + + // 可选:记录最后点击的节点(用于 UI 反馈) + this.lastNodeL = startNode; + + // 强制刷新图表(如果框架需要) + // graphInstance.refresh && graphInstance.refresh(); } }, created() { diff --git a/ruoyi-ui/src/views/system/fileManage/index.vue b/ruoyi-ui/src/views/system/fileManage/index.vue index 0a7ec5f..faa53d4 100644 --- a/ruoyi-ui/src/views/system/fileManage/index.vue +++ b/ruoyi-ui/src/views/system/fileManage/index.vue @@ -35,8 +35,8 @@ 新增 - 重置数据 - + + 导入 导出表格 - - 一键清除 - + + + 一键解锁