From e24ca3ef6afa7d5513d67eacf3038318cc5e765f Mon Sep 17 00:00:00 2001 From: limengnan <420004014@qq.com> Date: Tue, 27 Jan 2026 18:24:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AE=BE=E8=AE=A1=E5=88=86?= =?UTF-8?q?=E6=9E=90=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../frontend/src/components/antvx6/index.vue | 38 ++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/business-css/frontend/src/components/antvx6/index.vue b/business-css/frontend/src/components/antvx6/index.vue index b5b80b2..4fd6ba1 100644 --- a/business-css/frontend/src/components/antvx6/index.vue +++ b/business-css/frontend/src/components/antvx6/index.vue @@ -13,6 +13,7 @@ import { Stencil, Transform } from '@antv/x6' + // @ts-ignore import insertCss from 'insert-css' import { updateProjects} from "@/api/business/project"; @@ -195,12 +196,44 @@ onMounted(() => { }, }, ], + layoutOptions: { columns: 2, columnWidth: 140, rowHeight: 100, }, + getDragNode: (sourceNode:any) => { + let node:any = sourceNode + if (node.data && node.data.lineStyle) { + // 应用管线样式到连接线 + const lineStyle = node.data.lineStyle + graph.options.connecting.createEdge = () => { + return new Shape.Edge({ + attrs: { + line: { + stroke: '#A2B1C3', + strokeWidth: 2, + strokeDasharray: lineStyle.strokeDasharray, + targetMarker: lineStyle.targetMarker, + sourceMarker: lineStyle.sourceMarker + } + }, + zIndex: 0 + }) + } + // 移除管线节点,因为它只是一个样式选择器 + setTimeout(() => { + graph.removeNode(node) + }, 100) + return + } + return sourceNode.clone({ deep: true }) + }, + getDropNode: (draggingNode) => { + return draggingNode.clone({ deep: true }) + }, }) + graph.on('node:contextmenu', ({ e, node }) => { selectedNode.value = node e.preventDefault() @@ -1007,7 +1040,6 @@ function closeEditdevice(e:any){ // 关闭编辑设备弹窗 selectedDevice.value = e let retrievedNode:any = graph.getCellById(nodeId.value) retrievedNode.store.data.deviceInfo = e - retrievedNode.attr('label/refY', 160) retrievedNode.attr('text/text', e.name) retrievedNode.attr('label/text', e.name) isEditdevice.value = false; @@ -1741,4 +1773,8 @@ function saveDesign() { // 保存设计 color: #808080; padding-right: 10px; } + +.x6-widget-stencil .x6-node.x6-node-immovable{ + cursor: pointer; +} \ No newline at end of file