| | |
| | | <el-button @click="redo()">重做</el-button> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <zt-button type="delete" @click="deleteCompment()" /> |
| | | <zt-button type="delete" @click="deleteCompment()"/> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div id="containerImg" style="border: 1px solid #EAEBEE;border-radius: 6px; |
| | |
| | | "shape": "edge", |
| | | "id": "66c81c68-0827-4a3c-8343-e2c453d3e9e7", |
| | | "router": { |
| | | "name": "manhattan" |
| | | "name": "manhattan", |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | "connector": { |
| | | "name": "rounded" |
| | |
| | | "shape": "edge", |
| | | "id": "a0f3cf90-6d37-4ee0-a254-90b4ec2b6a7f", |
| | | "router": { |
| | | "name": "manhattan" |
| | | "name": "manhattan", |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | "connector": { |
| | | "name": "rounded" |
| | |
| | | }, |
| | | data() { |
| | | return { |
| | | nodeX:'', |
| | | nodeY:'', |
| | | nodeX: '', |
| | | nodeY: '', |
| | | isFirstLoad: true, |
| | | hasMoveNode: false, |
| | | hasMoveSingleNode: null, |
| | |
| | | stroke: '#5F95FF', |
| | | strokeWidth: 1, |
| | | connector: 'rounded', |
| | | router: 'manhattan', |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | label: '', |
| | | nodeStroke: '#5F95FF', |
| | | nodeStrokeWidth: 1, |
| | |
| | | connecting: { |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | connector: { |
| | | name: 'rounded', |
| | |
| | | anchor: 'center', |
| | | connectionPoint: 'anchor', |
| | | allowBlank: false, |
| | | allowLoop:false, // 是否允许创建循环连线,即边的起始节点和终止节点为同一节点,默认为 true |
| | | allowLoop: false, // 是否允许创建循环连线,即边的起始节点和终止节点为同一节点,默认为 true |
| | | snap: { |
| | | radius: 20, |
| | | }, |
| | |
| | | repairMttcr: item.repairMttcr, |
| | | repairMttcrOther2: item.repairMttcrOtherParams2, |
| | | repairMttcrOther3: item.repairMttcrOtherParams3, |
| | | successRate:item.successRate, |
| | | successRate: item.successRate, |
| | | |
| | | imgHeight: item.imgHeight, |
| | | imgWidth: item.imgWidth, |
| | |
| | | }) |
| | | return false |
| | | }) |
| | | }else if (this.isMultipleBrach(node)) { |
| | | } else if (this.isMultipleBrach(node)) { |
| | | //提示是否要删除 |
| | | this.$confirm('是否删除该节点?', '提示', { |
| | | confirmButtonText: '确定', |
| | |
| | | }) |
| | | return false |
| | | }) |
| | | }else { |
| | | } else { |
| | | //提示不能删除 |
| | | this.$message({message: '该条线路上只有该节点,无法删除', type: 'warning'}) |
| | | return false; // 取消操作 |
| | |
| | | } |
| | | }) |
| | | }, |
| | | getNodeArr(){ |
| | | getNodeArr() { |
| | | const nodes = this.graph.getNodes() |
| | | let nodeArr2 = [] |
| | | // 检查除当前节点之外的所有节点的包围框是否相交 |
| | | for (const node of nodes) { |
| | | console.log(node, 'saveDiagram node') |
| | | if (node.getData().nodeType == 'node' && node.getData().dataId) { |
| | | if (node.getData().nodeType == 'node' && node.getData().dataId) { |
| | | nodeArr2.push(node.getData().dataId) |
| | | } |
| | | } |
| | |
| | | this.getNodeArr() |
| | | const nodes = this.graph.getNodes() |
| | | for (const node of nodes) { |
| | | if(node.getData().nodeType === 'dashedBox'){ |
| | | if (node.getData().nodeType === 'dashedBox') { |
| | | this.$message({message: '该模型中存在虚框,无法保存', type: 'warning'}) |
| | | return false; // 取消添加节点操作 |
| | | } |
| | | if(node.getData().nodeType === 'vote'){ |
| | | if (node.getData().nodeType === 'vote') { |
| | | const edges = this.graph.getConnectedEdges(node); |
| | | if(node.getData().voteNum>=edges.length){ |
| | | if (node.getData().voteNum >= edges.length) { |
| | | this.$message({message: '表决数量不能高于该节点的进线数量', type: 'warning'}) |
| | | return false; // 取消添加节点操作 |
| | | } |
| | |
| | | this.graph.addEdge({ |
| | | source: {cell: graphNodeStartNode, port: 'right1'}, |
| | | target: {cell: result.newStartNode, port: 'left1'}, |
| | | router: {name: 'manhattan'}, |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | connector: {name: 'rounded'} |
| | | }) |
| | | this.graph.addEdge({ |
| | | source: {cell: result.newEndNode, port: 'right1'}, |
| | | target: {cell: graphNode, port: 'left1'}, |
| | | router: {name: 'manhattan'}, |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | connector: {name: 'rounded'} |
| | | }) |
| | | } |
| | |
| | | this.graph.addEdge({ |
| | | source: {cell: result.newEndNode, port: startPort}, |
| | | target: {cell: endNode, port: endPort}, |
| | | router: {name: 'manhattan'}, |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | connector: {name: 'rounded'} |
| | | }) |
| | | } else { |
| | | this.graph.addEdge({ |
| | | source: {cell: startNode, port: startPort}, |
| | | target: {cell: result.newStartNode, port: endPort}, |
| | | router: {name: 'manhattan'}, |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | connector: {name: 'rounded'} |
| | | }) |
| | | graphEdge.source = {cell: result.newEndNode.id, port: startPort} |
| | |
| | | this.graph.addEdge({ |
| | | source: {cell: connectNode, port: 'right1'}, |
| | | target: {cell: dashedBox, port: 'left1'}, |
| | | router: {name: 'manhattan'}, |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | connector: {name: 'rounded'} |
| | | }) |
| | | this.graph.addEdge({ |
| | | source: {cell: dashedBox, port: 'right1'}, |
| | | target: {cell: dragNode, port: 'left1'}, |
| | | router: {name: 'manhattan'}, |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | connector: {name: 'rounded'} |
| | | }) |
| | | return {newStartNode: connectNode, newEndNode: dragNode} |
| | |
| | | this.graph.addEdge({ |
| | | source: {cell: leftConnectNode, port: 'right1'}, |
| | | target: {cell: leftTopDashedBox, port: 'left1'}, |
| | | router: {name: 'manhattan'}, |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | connector: {name: 'rounded'}, |
| | | }) |
| | | this.graph.addEdge({ |
| | | source: {cell: leftConnectNode, port: 'right1'}, |
| | | target: {cell: leftBottomDashedBox, port: 'left1'}, |
| | | router: {name: 'manhattan'}, |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | connector: {name: 'rounded'}, |
| | | }) |
| | | |
| | | let edgeTop = this.graph.addEdge({ |
| | | source: {cell: leftTopDashedBox, port: 'right1'}, |
| | | target: {cell: rightTopDashedBox, port: 'left1'}, |
| | | router: {name: 'manhattan'}, |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | connector: {name: 'rounded'}, |
| | | }) |
| | | let edgeBottom = this.graph.addEdge({ |
| | | source: {cell: leftBottomDashedBox, port: 'right1'}, |
| | | target: {cell: rightBottomDashedBox, port: 'left1'}, |
| | | router: {name: 'manhattan'}, |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | connector: {name: 'rounded'}, |
| | | }) |
| | | |
| | | this.graph.addEdge({ |
| | | source: {cell: rightTopDashedBox, port: 'right1'}, |
| | | target: {cell: rightConnectNode, port: 'left1'}, |
| | | router: {name: 'manhattan'}, |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | connector: {name: 'rounded'}, |
| | | }) |
| | | this.graph.addEdge({ |
| | | source: {cell: rightBottomDashedBox, port: 'right1'}, |
| | | target: {cell: rightConnectNode, port: 'left1'}, |
| | | router: {name: 'manhattan'}, |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | connector: {name: 'rounded'}, |
| | | }) |
| | | |
| | | this.graph.addEdge({ |
| | | source: {cell: edgeTop}, |
| | | target: {cell: alignCenterDashedBox, port: 'top1'}, |
| | | router: {name: 'manhattan'}, |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | connector: {name: 'rounded'}, |
| | | }) |
| | | this.graph.addEdge({ |
| | | source: {cell: alignCenterDashedBox, port: 'bottom1'}, |
| | | target: {cell: edgeBottom}, |
| | | router: {name: 'manhattan'}, |
| | | router: { |
| | | name: 'manhattan', |
| | | args: { |
| | | startDirections: ['top','bottom'], // 从下方开始 |
| | | endDirections: ['left'], // 向左方结束 |
| | | }, |
| | | }, |
| | | connector: {name: 'rounded'}, |
| | | }) |
| | | dragNode.remove() |