From dc53503f08dbd6658c30ce38a73b3bdc4a8034e8 Mon Sep 17 00:00:00 2001
From: wente <329538422@qq.com>
Date: 星期五, 10 五月 2024 10:43:27 +0800
Subject: [PATCH] 组合

---
 web/src/views/modules/taskReliability/RBD-edit-img.vue |   66 +++++++++++++++++++++++++++------
 1 files changed, 54 insertions(+), 12 deletions(-)

diff --git a/web/src/views/modules/taskReliability/RBD-edit-img.vue b/web/src/views/modules/taskReliability/RBD-edit-img.vue
index b5ec2b8..bca1b8f 100644
--- a/web/src/views/modules/taskReliability/RBD-edit-img.vue
+++ b/web/src/views/modules/taskReliability/RBD-edit-img.vue
@@ -363,7 +363,9 @@
       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()
@@ -686,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
@@ -717,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()
                   }
@@ -743,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,6 +1180,7 @@
             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'}
@@ -1171,6 +1211,7 @@
           let result = this.addNodeAndConnect(null, dragNode, minX, centerY)
           if (!result){
             dragNode.remove()
+            this.$message({message: '娌℃湁瓒冲鐨勭┖闂存斁缃鑺傜偣锛岃鎵╁ぇ鍓╀綑绌洪棿', type: 'warning'})
             return
           }
           this.graph.addEdge({
@@ -1246,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) {

--
Gitblit v1.9.1