From 23b4b0e764ba8d7bf73f9c7d999f4144427d31cd Mon Sep 17 00:00:00 2001
From: xyc <jc_xiong@hotmail.com>
Date: 星期五, 13 九月 2024 16:35:35 +0800
Subject: [PATCH] 新增可靠性框图自动排版功能

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

diff --git a/web/src/views/modules/taskReliability/RBD-edit-img.vue b/web/src/views/modules/taskReliability/RBD-edit-img.vue
index 0deb426..c7f5609 100644
--- a/web/src/views/modules/taskReliability/RBD-edit-img.vue
+++ b/web/src/views/modules/taskReliability/RBD-edit-img.vue
@@ -18,6 +18,7 @@
               <el-button type="primary" @click="saveDiagram()">鏆傚瓨</el-button>
               <el-button type="primary" @click="analyzeDiagram()">鎻愪氦</el-button>
               <el-button type="primary" @click="clearDiagram()">娓呯┖鍥惧舰</el-button>
+              <el-button type="primary" @click="layoutDiagram()">涓�閿帓鐗�</el-button>
               <el-button @click="leftAlign()">
                 <i style="font-size: 1rem;" class="wt-iconfont icon-zuoduiqi"></i>
               </el-button>
@@ -1503,6 +1504,28 @@
           }
         })
       },
+      async layoutDiagram() {
+        console.log(JSON.stringify(this.graph.toJSON()), 'graph.toJSON()')
+        this.dataForm.content = JSON.stringify(this.graph.toJSON())
+        this.dataForm.urlPref = window.SITE_CONFIG['apiURL']
+        await this.$http['post'](`/taskReliability/ModelLine/layout`, this.dataForm).then(async res => {
+          if (res.msg === 'success') {
+            // this.$emit('refreshDataList')
+            // this.$alert('瑙f瀽鎴愬姛', '鎻愮ず', {
+            //   confirmButtonText: '纭畾'
+            // })
+            console.log(res.data, 'layoutDiagram res.data')
+            this.dataForm.content = res.data.content
+            console.log(this.dataForm.content, 'layoutDiagram dataForm.content')
+            this.diagramJson = JSON.parse(this.dataForm.content)
+            this.graph.fromJSON(this.diagramJson)
+            this.isFirstLoad = false;
+            // console.log(this.diagramJson.cells.length, 'this.diagramJson.cells.length')
+
+            this.graph.positionContent('left')
+          }
+        })
+      },
       leftAlign() {
         const NODE = this.graph.getSelectedCells()
         let leftX = null

--
Gitblit v1.9.1