Ver Fonte

预览数据bug

肖阳 há 4 anos atrás
pai
commit
745596ad31

+ 1 - 0
src/components/DrawFlow/src/DrawFlow.vue

@@ -111,6 +111,7 @@ export default {
     },
     clickSelectBox(nextNode) {
       let { node, selfConfig } = this.getNodeFactory(nextNode);
+      console.log(node, nextNode);
       this.selfConfig = selfConfig.concat(node);
     },
     /**

+ 2 - 2
src/components/DrawFlow/src/components/DrawAddSelectBox/DrawAddBox.vue

@@ -61,8 +61,8 @@ export default {
       if (item.value === "流转至") {
         this.nodeConfig.isFlowTo = true;
       }
-      let { id, prevId, type, isRow } = Object.assign(nodeConfig, item);
-      let nextNode = new NextNode({ id, prevId, type, isRow });
+      let { id, prevId, type, isRow, title } = Object.assign(nodeConfig, item);
+      let nextNode = new NextNode({ id, prevId, type, isRow, title });
       this.$emit("clickSelectBox", nextNode);
     },
     renderAddSBox() {

+ 5 - 2
src/components/DrawFlow/src/components/NodeConfigFactory/NodeFactory.js

@@ -13,6 +13,9 @@ export class Node {
   content = "content";
   conditionNodes;
   constructor({ id, type, isRow }) {
+    if (type === "2") {
+      this.title = "你好";
+    }
     this.groupId = id;
     this.id = HashCode();
     this.type = type;
@@ -34,8 +37,8 @@ export class ConditionNode {
 }
 export class RowNode extends Node {
   data = {};
-  constructor({ id, type, isRow }) {
-    super({ id, type, isRow });
+  constructor({ id, type, isRow, title }) {
+    super({ id, type, isRow, title });
   }
 }
 export class CopyNode {

+ 42 - 50
src/views/Home.vue

@@ -30,68 +30,60 @@ const arr = [
     pids: [null]
   },
   {
-    title: "title",
+    type: "2",
+    title: "你好",
+    content: "contentaps9lbz9o4jg6rp1",
+    groupId: "amchc9jr6hrtm3sr",
+    id: "aps9lbz9o4jg6rp1",
+    isRow: true,
     data: {},
-    id: "an3boz0zbth6i67o",
-    groupId: "a7wd1l3kz6orbpyf",
-    type: "3",
-    content: "undefinedan3boz0zbth6i67o",
-    groupPid: "a9urcgltunlo3svk",
-    isRow: false,
-    pids: ["a9urcgltunlo3svk"]
+    isParent: true,
+    pids: ["amchc9jr6hrtm3sr"]
   },
   {
+    type: "4",
     title: "title",
+    content: "contentaqfvkqc99q6xxq83",
+    groupId: "root",
+    id: "aqfvkqc99q6xxq83",
+    isRow: true,
     data: {},
-    id: "am3ewe040lpe90j0",
-    groupId: "a7wd1l3kz6orbpyf",
-    type: "3",
-    content: "undefinedam3ewe040lpe90j0",
-    groupPid: "a9urcgltunlo3svk",
-    isRow: false,
-    pids: ["a9urcgltunlo3svk"]
+    isParent: true,
+    pids: ["root"]
   },
   {
-    type: "4",
     title: "title",
-    content: "contenta9urcgltunlo3svk",
-    groupId: "root",
-    id: "a9urcgltunlo3svk",
-    isRow: true,
     data: {},
+    id: "amchc9jr6hrtm3sr",
+    groupId: "ah97ujupz91p2gdr",
+    type: "3",
+    content: "undefinedamchc9jr6hrtm3sr",
+    groupPid: "aqfvkqc99q6xxq83",
+    isRow: false,
     isParent: true,
     childNode: {
-      id: "a7wd1l3kz6orbpyf",
-      groupId: "a9urcgltunlo3svk",
-      type: "route",
+      type: "2",
+      title: "你好",
+      content: "contentaps9lbz9o4jg6rp1",
+      groupId: "amchc9jr6hrtm3sr",
+      id: "aps9lbz9o4jg6rp1",
       isRow: true,
-      isFlowTo: false,
-      conditionNodes: [
-        {
-          title: "title",
-          data: {},
-          id: "an3boz0zbth6i67o",
-          groupId: "a7wd1l3kz6orbpyf",
-          type: "3",
-          content: "undefinedan3boz0zbth6i67o",
-          groupPid: "a9urcgltunlo3svk",
-          isRow: false,
-          pids: ["a9urcgltunlo3svk"]
-        },
-        {
-          title: "title",
-          data: {},
-          id: "am3ewe040lpe90j0",
-          groupId: "a7wd1l3kz6orbpyf",
-          type: "3",
-          content: "undefinedam3ewe040lpe90j0",
-          groupPid: "a9urcgltunlo3svk",
-          isRow: false,
-          pids: ["a9urcgltunlo3svk"]
-        }
-      ]
+      data: {},
+      isParent: true,
+      pids: ["amchc9jr6hrtm3sr"]
     },
-    pids: ["root"]
+    pids: ["aqfvkqc99q6xxq83"]
+  },
+  {
+    title: "title",
+    data: {},
+    id: "a8rg79hnv5e74gct",
+    groupId: "ah97ujupz91p2gdr",
+    type: "3",
+    content: "undefineda8rg79hnv5e74gct",
+    groupPid: "aqfvkqc99q6xxq83",
+    isRow: false,
+    pids: ["aqfvkqc99q6xxq83"]
   }
 ];
 // @ is an alias to /src
@@ -122,7 +114,7 @@ export default {
     getData() {
       console.log(this.$refs.flow);
       let res = this.$refs.flow.getResData();
-      console.log("这是返回的一维数组", res);
+      console.log("这是返回的一维数组", JSON.stringify(res));
     },
     nodeChange() {
       this.node.content = "nihao";