From 5e55262ee63e6587368ebbdb9386d71da5695386 Mon Sep 17 00:00:00 2001
From: fujunling <2984387807@qq.com>
Date: 星期二, 11 七月 2023 19:08:00 +0800
Subject: [PATCH] fjl

---
 Source/UBCS-WEB/src/views/modeling/cycle.vue |   59 +++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 39 insertions(+), 20 deletions(-)

diff --git a/Source/UBCS-WEB/src/views/modeling/cycle.vue b/Source/UBCS-WEB/src/views/modeling/cycle.vue
index 7c171f6..c7a5fd2 100644
--- a/Source/UBCS-WEB/src/views/modeling/cycle.vue
+++ b/Source/UBCS-WEB/src/views/modeling/cycle.vue
@@ -51,7 +51,7 @@
         v-if="visible"
         class="cycle_flow"
         :type="type"
-        :chart-data="rowData.data || {}"
+        :chart-data="nodesEdgesData"
         :chart-data-node-items="flowChartNodeItems"
         :rowData="rowData"
         ref="vueFlowchartEditor"
@@ -78,7 +78,7 @@
         pageSize: 10,
         total: 0,
         currentPage: 1,
-        layout: "total, sizes, prev, pager, next, jumper"
+        layout: "total, sizes, prev, pager, next, jumper",
       },
       option: {
         searchMenuSpan: 12,
@@ -116,6 +116,7 @@
       visible: false,
       flowChartNodeItems: [],
       rowData: {},
+      nodesEdgesData: {},
       dialogWidth: "50%",
       type: "detail",
       loading: false,
@@ -136,10 +137,6 @@
         };
       }
       this.loading = true;
-      console.log(
-        Object.assign({}, params, this.page),
-        "Object.assign({}, params, this.page)"
-      );
       const { limit, page } = this.page;
       API.getList(Object.assign({}, params, { limit, page })).then((res) => {
         this.loading = false;
@@ -150,35 +147,57 @@
       });
     },
     openDialog(type, row) {
-      if (type === "detail") {
-        this.title = "棰勮鐢熷懡鍛ㄦ湡娴佺▼鍥�";
-        this.dialogWidth = "50%";
-      } else if (type === "edit") {
+      this.type = type;
+      if (type === "edit") {
+        this.$set(row, "editLoading", true);
         this.title = "缂栬緫鐢熷懡鍛ㄦ湡娴佺▼鍥�";
         this.dialogWidth = "95%";
-      } else if (type === "add") {
+      } else if (type === "detail") {
+        this.$set(row, "detailLoading", true);
+        this.title = "棰勮鐢熷懡鍛ㄦ湡娴佺▼鍥�";
+        this.dialogWidth = "50%";
+      }
+      if (type !== "add") {
+        API.detail({ id: row.id }).then((res) => {
+          this.$set(row, "detailLoading", false);
+          this.$set(row, "editLoading", false);
+          this.rowData = row;
+          this.nodesEdgesData = {nodes: res.nodes, edges: res.edges}
+        });
+      } else {
         this.title = "鏂板鐢熷懡鍛ㄦ湡娴佺▼鍥�";
         this.dialogWidth = "95%";
+        this.visible = true;
       }
-      this.type = type;
-      this.rowData = row;
-      this.visible = true;
     },
     async submit() {
       const newRowData = await this.$refs.vueFlowchartEditor.getNewRowData();
-      console.log(newRowData, 'newRowDatanewRowData');
+      console.log(newRowData, "newRowDatanewRowData");
       if (!newRowData) {
         return;
       }
       const flowData = this.$refs.vueFlowchartEditor.getFlowData();
+      if (Array.isArray(flowData.nodes)) {
+        flowData.nodes = flowData.nodes.map((item) => {
+          item.name = item.id;
+          return item;
+        });
+      }
+      if (Array.isArray(flowData.edges)) {
+        flowData.edges = flowData.edges.map((item) => {
+          item.name = item.label;
+          return item;
+        });
+      }
+
       let params = {
         ...flowData,
-        ...newRowData
-      }
+        ...newRowData,
+      };
       console.log(flowData, newRowData);
-      API.add(params).then(res => {
-        console.log(res, 'res');
-      })
+      API.add(params).then((res) => {
+        console.log(res, "res");
+      });
     },
   },
   watch: {

--
Gitblit v1.9.3