From 08dfaa8824d174bae7a84f7f99a3db4d76542471 Mon Sep 17 00:00:00 2001 From: xyc <jc_xiong@hotmail.com> Date: 星期六, 11 五月 2024 08:31:46 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- web/src/views/modules/taskReliability/RBD-edit-img.vue | 101 +++++++++++++++++++++++++++++++++++--------------- web/src/views/modules/taskReliability/ModelRbd-AddOrUpdate.vue | 1 2 files changed, 71 insertions(+), 31 deletions(-) diff --git a/web/src/views/modules/taskReliability/ModelRbd-AddOrUpdate.vue b/web/src/views/modules/taskReliability/ModelRbd-AddOrUpdate.vue index 0914dfb..e1a0d6d 100644 --- a/web/src/views/modules/taskReliability/ModelRbd-AddOrUpdate.vue +++ b/web/src/views/modules/taskReliability/ModelRbd-AddOrUpdate.vue @@ -25,7 +25,6 @@ modelName: '', productId: '', modelTag:'', - content: '', remark: '' } } diff --git a/web/src/views/modules/taskReliability/RBD-edit-img.vue b/web/src/views/modules/taskReliability/RBD-edit-img.vue index 8566355..bca1b8f 100644 --- a/web/src/views/modules/taskReliability/RBD-edit-img.vue +++ b/web/src/views/modules/taskReliability/RBD-edit-img.vue @@ -348,11 +348,7 @@ if (res.data !== null && (res.data.content != null)) { this.dataForm = res.data this.diagramJson = JSON.parse(this.dataForm.content) - if (this.diagramJson.cells.length !== 0) { this.graph.fromJSON(this.diagramJson) - } else { - this.graph.fromJSON(RBDDefault) - } this.isFirstLoad = false; console.log(this.diagramJson.cells.length, 'this.diagramJson.cells.length') @@ -360,13 +356,16 @@ // this.graph.centerContent() // this.graph.zoomToFit() } else { - await this.clearDiagram() + this.graph.fromJSON(RBDDefault) + this.isFirstLoad = false } }, async clearDiagram() { this.dataForm.id = null // this.graph.fromJSON(this.emptyJson) - this.graph.fromJSON('') + this.graph.fromJSON(RBDDefault) + this.graph.positionContent('left') + this.isFirstLoad = false; // this.graph.centerContent() // this.graph.zoomToFit() // this.graph.freeze() @@ -689,7 +688,22 @@ if (cells.length === 1) { let node = cells[0] if (!node.isNode()) { - this.$message({message: '璇烽�変腑鑺傜偣', type: 'warning'}) + this.$confirm('鏄惁鍒犻櫎璇ヨ繛鎺ョ嚎鐐�?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + this.$message({ + type: 'success', + message: '鍒犻櫎鎴愬姛!' + }) + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }) + }) + // this.$message({message: '璇烽�変腑鑺傜偣', type: 'warning'}) return false; // 鍙栨秷鎿嶄綔 } let nodeType = node.getData().nodeType @@ -720,17 +734,17 @@ let outNode = isSeriesNode.outNode console.log(inLine, outLine, 'inLine,outLine') console.log(inNode, outNode, 'inNode,outNode') - if (inLineIsToLine) { - inLine[0].target = {cell: outNode.id, port: 'left1'} - } else { - outLine[0].source = {cell: inNode.id, port: 'right1'} - } //鎻愮ず鏄惁瑕佸垹闄� this.$confirm('鏄惁鍒犻櫎璇ヨ妭鐐�?', '鎻愮ず', { confirmButtonText: '纭畾', cancelButtonText: '鍙栨秷', type: 'warning' }).then(() => { + if (inLineIsToLine) { + inLine[0].target = {cell: outNode.id, port: 'left1'} + } else { + outLine[0].source = {cell: inNode.id, port: 'right1'} + } if (deleteType === 1){ node.remove() } @@ -746,15 +760,37 @@ type: 'info', message: '宸插彇娑堝垹闄�' }) + return false }) } if (this.isMultipleBrach(node)) { //鎻愮ず鏄惁瑕佸垹闄� - if (deleteType === 1) - node.remove() - else - this.deleteCombination(node) - return + this.$confirm('鏄惁鍒犻櫎璇ヨ妭鐐�?', '鎻愮ず', { + confirmButtonText: '纭畾', + cancelButtonText: '鍙栨秷', + type: 'warning' + }).then(() => { + if (inLineIsToLine) { + inLine[0].target = {cell: outNode.id, port: 'left1'} + } else { + outLine[0].source = {cell: inNode.id, port: 'right1'} + } + if (deleteType === 1) + node.remove() + else + this.deleteCombination(node) + this.$message({ + type: 'success', + message: '鍒犻櫎鎴愬姛!' + }) + + }).catch(() => { + this.$message({ + type: 'info', + message: '宸插彇娑堝垹闄�' + }) + return false + }) } } //鎻愮ず涓嶈兘鍒犻櫎 @@ -1141,9 +1177,10 @@ } if (startNode && endNode) { let centerY = graphNode.position().y - let result = this.addNodeAndConnect(graphNode, dragNode, dragNode.position().x, centerY) + let result = this.addNodeAndConnect(graphNode, dragNode, dragNode.position().x - dragNode.size().width/2, centerY) if (!result){ dragNode.remove() + this.$message({message: '娌℃湁瓒冲鐨勭┖闂存斁缃鑺傜偣锛岃鎵╁ぇ鍓╀綑绌洪棿', type: 'warning'}) return } inEdges[0].target = {cell: result.newStartNode.id, port: 'left1'} @@ -1174,6 +1211,7 @@ let result = this.addNodeAndConnect(null, dragNode, minX, centerY) if (!result){ dragNode.remove() + this.$message({message: '娌℃湁瓒冲鐨勭┖闂存斁缃鑺傜偣锛岃鎵╁ぇ鍓╀綑绌洪棿', type: 'warning'}) return } this.graph.addEdge({ @@ -1200,8 +1238,10 @@ width =100 height = 60 } else if (dragNodeType === 'bridgeConnection') { - width =450 - height = 160 + width =550 + height = 115 + leftTopX = leftX - width/2 + leftTopY = centerY - height/2 // leftTopY = 240/2 } else { width =270 @@ -1216,9 +1256,9 @@ dragNode.position(leftX, centerY) return {newStartNode: dragNode, newEndNode: dragNode} } else if (dragNodeType === 'bridgeConnection') { - return this.createBridgeConnection(leftX, centerY, dragNode) + return this.createBridgeConnection(leftTopX, leftTopY, dragNode) } else { - return this.createParallelBrach(leftX, centerY, dragNode) + return this.createParallelBrach(leftTopX, leftTopY, dragNode) } }, // 鐩镐氦鐨勮竟 @@ -1247,6 +1287,7 @@ let result = this.addNodeAndConnect(null, dragNode, dragNode.position().x, centerY) if (!result){ dragNode.remove() + this.$message({message: '娌℃湁瓒冲鐨勭┖闂存斁缃鑺傜偣锛岃鎵╁ぇ鍓╀綑绌洪棿', type: 'warning'}) return } if (isRight) { @@ -1327,15 +1368,16 @@ })*/ }, createBridgeConnection(x, y, dragNode) { - const leftTopDashedBox = this.createDashedBox(x + 120, y) - const rightTopDashedBox = this.createDashedBox(x + 400, y) + console.log(x,y,'leftX centerY') + const leftTopDashedBox = this.createDashedBox(x + 40, y) + const rightTopDashedBox = this.createDashedBox(x + 380, y) - const leftConnectNode = this.createConnectNode(x + 50, y + 80) - const alignCenterDashedBox = this.createDashedBox(x + 260, y + 80) - const rightConnectNode = this.createBridgeNode(x + 550, y + 80) + const leftConnectNode = this.createConnectNode(x, y + 87) + const alignCenterDashedBox = this.createDashedBox(x+ 210, y + 87) + const rightConnectNode = this.createBridgeNode(x + 530, y + 87) - const leftBottomDashedBox = this.createDashedBox(x + 120, y + 160) - const rightBottomDashedBox = this.createDashedBox(x + 400, y + 160) + const leftBottomDashedBox = this.createDashedBox(x+ 50, y + 160) + const rightBottomDashedBox = this.createDashedBox(x + 370 , y + 160) rightConnectNode.setData({startNodeId: leftConnectNode.id}) leftConnectNode.setData({endNodeId: rightConnectNode.id}) @@ -1445,7 +1487,6 @@ const dragNodeId = getUUID().toString() let connectNode = this.graph.addNode({ shape: 'image', - // imageUrl: require('/public/modelImg/' + item.imgPath + '.png'), width: 10, height: 10, id: connectId, -- Gitblit v1.9.1