| | |
| | | this.graph.createNode({ |
| | | shape: 'image', |
| | | //imageUrl: `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getProductImg?token=${Cookies.get('token')}&id=${item.imgPath}`, |
| | | width: 100, |
| | | width: 60, |
| | | height: 70, |
| | | //id: item.dataId, // 手动设置节点的 ID |
| | | data: { |
| | |
| | | }, |
| | | attrs: { |
| | | image: { |
| | | 'xlink:href': `${window.SITE_CONFIG['apiURL']}/sysPictureBase/getSvgImage?token=${Cookies.get('token')}&id=${item.imgPath}`, |
| | | 'xlink:href': `${window.SITE_CONFIG['apiURL']}/basicInfo/XhProductModel/getImg?token=${Cookies.get('token')}&id=${item.dataId}&t=${new Date().getTime()}`, |
| | | //'xlink:href': urlObject.createObjectURL(new Blob([item.svgContent])), |
| | | }, |
| | | title: { |
| | | text: item.basicUnitNum>=1?item.basicUnitNum:'', |
| | | text: item.basicUnitNum>1?item.basicUnitNum:'', |
| | | refX: 15, |
| | | refY: 10, |
| | | fill: '#748be7', |
| | |
| | | let dragNodeType = dragNode.getData().nodeType |
| | | let offHeight = 50 |
| | | if (dragNodeType === 'node') { |
| | | offHeight = 60 |
| | | offHeight = 70 |
| | | } else if (dragNodeType === 'bridgeConnection') { |
| | | offHeight = 175 |
| | | } else { |
| | |
| | | this.getYRange(inEdges, graphNodeStartNode, pointXY) |
| | | console.log(pointXY, 'new') |
| | | |
| | | let minX = graphNodeStartNode.position().x + graphNode.getBBox().width + 15 |
| | | let maxX = graphNode.position().x |
| | | let minX = graphNodeStartNode.position().x + graphNode.getBBox().width |
| | | let maxX = graphNode.position().x - dragNode.getBBox().width / 2 |
| | | let centerX = minX + (maxX - minX) / 2 |
| | | let centerY = graphNodeY + graphNode.getBBox().height / 2 - pointXY.minY > pointXY.maxY - (graphNodeY + graphNode.getBBox().height / 2) ? |
| | | pointXY.maxY + offHeight / 2 + 30 : pointXY.minY - offHeight / 2 - 30 |
| | | |
| | | let result = this.addNodeAndConnect(null, dragNode, minX, centerY) |
| | | let result = this.addNodeAndConnect(null, dragNode, centerX, centerY) |
| | | console.log(result, 'result111') |
| | | this.graph.addEdge({ |
| | | source: {cell: graphNodeStartNode}, |
| | |
| | | leftTopY = centerY |
| | | let dragNodeType = dragNode.getData().nodeType |
| | | if (dragNodeType === 'node') { |
| | | width = 60 |
| | | height = 60 |
| | | width = 100 |
| | | height = 70 |
| | | } else if (dragNodeType === 'dashedBox') { |
| | | width = 60 |
| | | height = 40 |
| | |
| | | height = 175 |
| | | } else { |
| | | width = 270 |
| | | height = 60 |
| | | height = 70 |
| | | } |
| | | leftTopX = centerX - width / 2 |
| | | leftTopY = centerY - height / 2 |