소스 검색

输出变量

CzRger 2 달 전
부모
커밋
7c8f37b6b5

+ 11 - 2
src/views/workflow/chart/node-index.vue

@@ -5,12 +5,18 @@
       <div class="node-sub" v-if="state.nodeData?.subTitle">{{ state.nodeData.subTitle }}</div>
     </div>
     <div class="node-content">
-      <template v-if="state.nodeData?.type === 'root'">
+      <template v-if="state.nodeData?.type === NodeType.Root">
         <rootNode :node="state.node"/>
       </template>
-      <template v-else-if="state.nodeData?.type === 'if-else'">
+      <template v-else-if="state.nodeData?.type === NodeType.Test">
+        <testNode :node="state.node"/>
+      </template>
+      <template v-else-if="state.nodeData?.type === NodeType.IfElse">
         <ifElseNode :node="state.node"/>
       </template>
+      <template v-else-if="state.nodeData?.type === NodeType.Answer">
+        <answerNode :node="state.node"/>
+      </template>
     </div>
   </div>
 </template>
@@ -19,7 +25,10 @@
 import {computed, getCurrentInstance, inject, nextTick, onMounted, reactive, ref, watch} from "vue";
 import rootNode from '../instance/root/node/index.vue'
 import ifElseNode from '../instance/if-else/node/index.vue'
+import testNode from '../instance/test/node/index.vue'
+import answerNode from '../instance/answer/node/index.vue'
 import {useWorkflowStore} from "@/stores";
+import {NodeType} from "@/views/workflow/types";
 
 const WorkflowStore = useWorkflowStore()
 const getNode: any = inject('getNode')

+ 6 - 2
src/views/workflow/chart/panel-index.vue

@@ -20,10 +20,13 @@
         <template v-if="nodeDataCpt.type === NodeType.Root">
           <rootPanel :node="WorkflowStore.panel.node"/>
         </template>
-        <template v-if="nodeDataCpt.type === NodeType.Answer">
+        <template v-else-if="nodeDataCpt.type === NodeType.Test">
+          <testPanel :node="WorkflowStore.panel.node"/>
+        </template>
+        <template v-else-if="nodeDataCpt.type === NodeType.Answer">
           <answerPanel :node="WorkflowStore.panel.node"/>
         </template>
-        <template v-if="nodeDataCpt.type === NodeType.IfElse">
+        <template v-else-if="nodeDataCpt.type === NodeType.IfElse">
           <ifElsePanel :node="WorkflowStore.panel.node"/>
         </template>
       </div>
@@ -36,6 +39,7 @@ import {computed, getCurrentInstance, onMounted, reactive, ref, watch} from "vue
 import rootPanel from '../instance/root/panel/index.vue'
 import answerPanel from '../instance/answer/panel/index.vue'
 import ifElsePanel from '../instance/if-else/panel/index.vue'
+import testPanel from '../instance/test/panel/index.vue'
 import {useWorkflowStore} from "@/stores";
 import {NodeType} from "@/views/workflow/types";
 

+ 9 - 2
src/views/workflow/config.ts

@@ -2,6 +2,8 @@ import { v4 } from "uuid";
 import {ConditionMode, NodeDataStruct, NodePortStruct, NodeStruct, NodeType} from "@/views/workflow/types";
 import rootNodeDefault from "@/views/workflow/instance/root/default";
 import answerNodeDefault from "@/views/workflow/instance/answer/default";
+import ifElseNodeDefault from "@/views/workflow/instance/if-else/default";
+import testNodeDefault from "@/views/workflow/instance/test/default";
 
 export const lineStyle = {
   line: {
@@ -29,6 +31,8 @@ export const nodeDefault = {
     data: <NodeDataStruct>{
       id: v4(),
       title: '测试节点',
+      subTitle: '',
+      ...testNodeDefault.defaultValue
     }
   }),
   [NodeType.Root]: () => (<NodeStruct>{
@@ -37,6 +41,7 @@ export const nodeDefault = {
     data: <NodeDataStruct>{
       id: v4(),
       title: '开始',
+      subTitle: '',
       ...rootNodeDefault.defaultValue,
     }
   }),
@@ -46,6 +51,7 @@ export const nodeDefault = {
     data: <NodeDataStruct>{
       id: v4(),
       title: '直接回复',
+      subTitle: '',
       ...answerNodeDefault.defaultValue,
     }
   }),
@@ -55,11 +61,12 @@ export const nodeDefault = {
     data: <NodeDataStruct>{
       id: v4(),
       title: '条件分支',
+      subTitle: '',
+      ...ifElseNodeDefault.defaultValue,
       ports: <NodePortStruct[]>[
         {
           id: v4(),
-          mode: ConditionMode.And,
-          cases: []
+          ...ifElseNodeDefault.caseValue
         },
         {
           id: v4(),

+ 3 - 2
src/views/workflow/handle.ts

@@ -3,6 +3,7 @@ import {merge} from "lodash";
 import {lineStyle, portStyle} from "@/views/workflow/config";
 import { v4 } from "uuid";
 import {useWorkflowStore} from "@/stores";
+import {NodeType} from "@/views/workflow/types";
 
 const WorkflowStore = useWorkflowStore()
 export const handleNode = (no) => {
@@ -39,7 +40,7 @@ export const handleNode = (no) => {
       }
     ]
   }
-  if (node.data.workflowData.type === 'root') {
+  if (node.data.workflowData.type === NodeType.Root) {
     node.data.sysVars = [
       ...WorkflowStore.systemVars
     ]
@@ -66,7 +67,7 @@ export const handleNode = (no) => {
         }
       })
     })
-  } else if (node.data.workflowData.type !== 'answer') {
+  } else if (node.data.workflowData.type !== NodeType.Answer) {
     node.ports.items.push({
       id: `${node.id}_end`,
       group: 'end',

+ 1 - 1
src/views/workflow/index.vue

@@ -38,7 +38,7 @@ const getJsonData = () => {
         id: cell.id,
         x: cell.position.x,
         y: cell.position.y,
-        data: cell.data
+        data: cell.data.workflowData
       }
       res.nodes.push(node)
     } else if (cell.shape === 'edge') {

+ 29 - 0
src/views/workflow/instance/component/vars/vars-out.vue

@@ -0,0 +1,29 @@
+<template>
+  <div class="vars-out" v-if="outVars.length > 0">
+    <template v-for="item in outVars">
+      <div class="out-item">
+        <div>{{item.key}} <span class="ml-2 opacity-65">{{item.type}}</span></div>
+        <div><span class="opacity-65">{{item.label}}</span></div>
+      </div>
+    </template>
+  </Div>
+</template>
+
+<script setup lang="ts">
+import {getCurrentInstance, reactive, ref} from "vue";
+
+const emits = defineEmits([])
+const props = defineProps({
+  outVars: {default: []}
+})
+const {proxy}: any = getCurrentInstance()
+const state: any = reactive({})
+</script>
+
+<style lang="scss" scoped>
+.vars-out {
+  .out-item {
+    font-size: 12px;
+  }
+}
+</style>

+ 3 - 1
src/views/workflow/instance/if-else/default.ts

@@ -1,9 +1,11 @@
+import {ConditionMode} from "@/views/workflow/types";
+
 const nodeDefault = {
   defaultValue: {
     inVars: [],
   },
   caseValue: {
-    mode: 'and',
+    mode: ConditionMode.And,
     cases: []
   },
 }

+ 0 - 3
src/views/workflow/instance/root/funcs.ts

@@ -1,3 +0,0 @@
-export const getInVars = (node, graph) => {
-
-}

+ 11 - 0
src/views/workflow/instance/test/default.ts

@@ -0,0 +1,11 @@
+const nodeDefault = {
+  defaultValue: {
+    inVars: [],
+    outVars: [
+      {label: '参数1', key: 'param1', type: 'String'},
+      {label: '参数2', key: 'param2', type: 'Number'},
+    ],
+  }
+}
+
+export default nodeDefault

+ 25 - 0
src/views/workflow/instance/test/node/index.vue

@@ -0,0 +1,25 @@
+<template>
+  <div class="node-test">
+  </div>
+</template>
+
+<script setup lang="ts">
+import {computed, getCurrentInstance, inject, onMounted, reactive, ref} from "vue";
+
+const emits = defineEmits([])
+const props = defineProps({
+  node: <any>{}
+})
+const {proxy}: any = getCurrentInstance()
+const state: any = reactive({
+  nodeData: {}
+})
+onMounted(() => {
+  state.nodeData = props.node.data.workflowData
+})
+</script>
+
+<style lang="scss" scoped>
+.node-test {
+}
+</style>

+ 42 - 0
src/views/workflow/instance/test/panel/index.vue

@@ -0,0 +1,42 @@
+<template>
+  <div class="panel-block" v-if="state.nodeData">
+    <div class="_p-title">
+      <div class="text-sm">可用变量</div>
+    </div>
+    <varsSelect :node="props.node"/>
+    <div class="_p-title">
+      <div class="text-sm">输出变量</div>
+    </div>
+    <varsOut :outVars="state.nodeData.outVars"/>
+  </div>
+</template>
+
+<script setup lang="ts">
+import {getCurrentInstance, reactive, ref, watch} from "vue";
+import varsSelect from "@/views/workflow/instance/component/vars/vars-select.vue";
+import varsOut from "@/views/workflow/instance/component/vars/vars-out.vue";
+import {useWorkflowStore} from "@/stores";
+
+const WorkflowStore = useWorkflowStore()
+const emits = defineEmits([])
+const props = defineProps({
+  node: <any>{}
+})
+const {proxy}: any = getCurrentInstance()
+const state: any = reactive({
+  nodeData: null,
+  vars: {
+    show: false,
+    transfer: {}
+  }
+})
+watch(() => props.node, (n) => {
+  if (n) {
+    state.nodeData = n.data.workflowData
+  }
+}, {immediate: true})
+</script>
+
+<style lang="scss" scoped>
+@use "@/views/workflow/instance/component/style";
+</style>

+ 607 - 74
src/views/workflow/mockJson.ts

@@ -18,13 +18,13 @@ export const data1 = {
             "key": "key1",
             "type": "String",
             "length": "10",
-            "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c",
+            "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c"
           },
           {
             "label": "参数2",
             "key": "key2",
             "type": "Number",
-            "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c",
+            "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c"
           }
         ],
         "sysVars": [
@@ -32,13 +32,13 @@ export const data1 = {
             "label": "查询内容",
             "key": "sys.query",
             "type": "String",
-            "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c",
+            "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c"
           },
           {
             "label": "用户ID",
             "key": "sys.user_id",
             "type": "String",
-            "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c",
+            "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c"
           }
         ]
       }
@@ -62,7 +62,7 @@ export const data1 = {
                   "key": "key1",
                   "type": "String",
                   "length": "10",
-                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c",
+                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c"
                 },
                 "method": "includes",
                 "type": "constant",
@@ -74,7 +74,7 @@ export const data1 = {
                   "label": "查询内容",
                   "key": "sys.query",
                   "type": "String",
-                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c",
+                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c"
                 },
                 "method": "end with",
                 "type": "constant",
@@ -97,7 +97,7 @@ export const data1 = {
                   "label": "参数2",
                   "key": "key2",
                   "type": "Number",
-                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c",
+                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c"
                 },
                 "method": "≥",
                 "type": "constant",
@@ -116,7 +116,7 @@ export const data1 = {
                   "key": "key1",
                   "type": "String",
                   "length": "10",
-                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c",
+                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c"
                 },
                 "method": "includes",
                 "type": "variable",
@@ -124,7 +124,7 @@ export const data1 = {
                   "label": "查询内容",
                   "key": "sys.query",
                   "type": "String",
-                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c",
+                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c"
                 }
               },
               {
@@ -134,7 +134,7 @@ export const data1 = {
                   "key": "key1",
                   "type": "String",
                   "length": "10",
-                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c",
+                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c"
                 },
                 "method": "includes",
                 "type": "constant",
@@ -146,7 +146,7 @@ export const data1 = {
                   "label": "参数2",
                   "key": "key2",
                   "type": "Number",
-                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c",
+                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c"
                 },
                 "method": "=",
                 "type": "constant",
@@ -159,7 +159,7 @@ export const data1 = {
                   "key": "key1",
                   "type": "String",
                   "length": "10",
-                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c",
+                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c"
                 },
                 "method": "includes",
                 "type": "constant",
@@ -183,106 +183,579 @@ export const data1 = {
       }
     },
     {
-      "id": "b39b1a2f-8474-456b-8859-ce0b6597dd47",
-      "x": 60,
-      "y": 700,
+      "id": "ae7c7fe2-8538-43d5-b51c-4e096b7c1044",
+      "x": 108,
+      "y": 50,
       "data": {
+        "id": "ae7c7fe2-8538-43d5-b51c-4e096b7c1044",
         "title": "条件分支",
+        "subTitle": "2323",
+        "inVars": [],
+        "ports": [
+          {
+            "id": "f454f87f-35c1-4867-9ba7-6667426283e7",
+            "mode": "and",
+            "cases": [
+              {
+                "id": "f2150382-4dbe-4205-b6a4-8aaee6df7db9",
+                "source": {
+                  "label": "参数1",
+                  "key": "key1",
+                  "type": "String",
+                  "length": "10",
+                  "nodeId": "3ba412bb-3772-4f61-85de-095f4017858c"
+                },
+                "method": "includes",
+                "type": "constant",
+                "target": "说23"
+              }
+            ]
+          },
+          {
+            "id": "66e4ddc8-0171-4832-9cbd-569af9981c0d",
+            "mode": "and",
+            "cases": []
+          },
+          {
+            "id": "81d25ab4-1b38-46f4-8d6d-0dec29c1a030",
+            "isElse": true
+          }
+        ],
         "type": "if-else",
+        "edgeSource": "ce2c26aa-9b40-4e32-858e-38fa4b09718d"
+      }
+    },
+    {
+      "id": "6649401b-a00f-4f3a-818f-0e0919783e15",
+      "x": 108,
+      "y": 252,
+      "data": {
+        "id": "6649401b-a00f-4f3a-818f-0e0919783e15",
+        "title": "条件分支",
+        "subTitle": "",
+        "inVars": [],
         "ports": [
           {
-            "id": "6a5cde35-141d-4006-b5b2-89f0e567c7a8",
-            "data": {
-              "p1": "条件分支1的桩1"
-            }
+            "id": "449c9ecc-bbf7-4543-821c-e1e72a3e5d88",
+            "mode": "and",
+            "cases": []
           },
           {
-            "id": "fab2de26-7769-4a3d-8727-1f11b01054c6",
-            "data": {
-              "p1": "条件分支1的桩2"
-            }
+            "id": "4a12b919-c2a4-4894-93e4-3ec60e9ee75e",
+            "isElse": true
           }
         ],
-        "p1": "条件分支2的参数1",
-        "id": "b39b1a2f-8474-456b-8859-ce0b6597dd47",
-        "edgeSource": "7171167d-873b-4621-9ce1-dd45f9f4c9c3"
+        "type": "if-else",
+        "edgeSource": "ce2c26aa-9b40-4e32-858e-38fa4b09718d"
       }
     },
     {
-      "id": "b948a0d9-6e18-4b0f-a4c4-9a60bf3fc624",
-      "x": 140,
+      "id": "cf733a11-9d27-4de7-af4f-fa2dbc32ccd4",
+      "x": -20,
       "y": -220,
       "data": {
-        "id": "b948a0d9-6e18-4b0f-a4c4-9a60bf3fc624",
+        "id": "cf733a11-9d27-4de7-af4f-fa2dbc32ccd4",
         "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number"
+          }
+        ],
+        "type": "test",
+        "edgeSource": "ce2c26aa-9b40-4e32-858e-38fa4b09718d"
+      }
+    },
+    {
+      "id": "dba44a3d-4102-402e-b30e-2b782b897f76",
+      "x": 108,
+      "y": 604,
+      "data": {
+        "id": "dba44a3d-4102-402e-b30e-2b782b897f76",
+        "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number"
+          }
+        ],
+        "type": "test",
+        "edgeSource": "ce2c26aa-9b40-4e32-858e-38fa4b09718d"
+      }
+    },
+    {
+      "id": "3baab4e2-9301-413c-bbe4-f0a6028907e2",
+      "x": 108,
+      "y": 754,
+      "data": {
+        "id": "3baab4e2-9301-413c-bbe4-f0a6028907e2",
+        "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number"
+          }
+        ],
         "type": "test",
         "edgeSource": "ce2c26aa-9b40-4e32-858e-38fa4b09718d"
       }
     },
     {
-      "id": "b7dc7ea7-239b-40c5-b751-8ce5ebf49a23",
+      "id": "f24fb6f8-19d2-45a8-a80c-5053e7017d39",
       "x": 180,
+      "y": -60,
+      "data": {
+        "id": "f24fb6f8-19d2-45a8-a80c-5053e7017d39",
+        "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number"
+          }
+        ],
+        "type": "test",
+        "edgeSource": "66e4ddc8-0171-4832-9cbd-569af9981c0d"
+      }
+    },
+    {
+      "id": "86350d8b-0ecf-4394-b31e-a050384828c6",
+      "x": 500,
       "y": -110,
       "data": {
-        "id": "b7dc7ea7-239b-40c5-b751-8ce5ebf49a23",
+        "id": "86350d8b-0ecf-4394-b31e-a050384828c6",
         "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String",
+            "nodeId": "86350d8b-0ecf-4394-b31e-a050384828c6"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number",
+            "nodeId": "86350d8b-0ecf-4394-b31e-a050384828c6"
+          }
+        ],
         "type": "test",
-        "edgeSource": "ce2c26aa-9b40-4e32-858e-38fa4b09718d"
+        "edgeSource": "66e4ddc8-0171-4832-9cbd-569af9981c0d"
+      }
+    },
+    {
+      "id": "faa43da7-ec23-4cf7-bc28-002f6e7cc970",
+      "x": 290,
+      "y": 470,
+      "data": {
+        "id": "faa43da7-ec23-4cf7-bc28-002f6e7cc970",
+        "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number"
+          }
+        ],
+        "type": "test",
+        "edgeSource": "66e4ddc8-0171-4832-9cbd-569af9981c0d"
+      }
+    },
+    {
+      "id": "c68bde66-fd1f-48c1-9c03-c89fbbe75427",
+      "x": 850,
+      "y": 120,
+      "data": {
+        "id": "c68bde66-fd1f-48c1-9c03-c89fbbe75427",
+        "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String",
+            "nodeId": "c68bde66-fd1f-48c1-9c03-c89fbbe75427"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number",
+            "nodeId": "c68bde66-fd1f-48c1-9c03-c89fbbe75427"
+          }
+        ],
+        "type": "test",
+        "edgeSource": "86350d8b-0ecf-4394-b31e-a050384828c6_end"
+      }
+    },
+    {
+      "id": "85593db2-587e-40ff-bc4c-e12e7d1cec57",
+      "x": 784,
+      "y": 350,
+      "data": {
+        "id": "85593db2-587e-40ff-bc4c-e12e7d1cec57",
+        "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number"
+          }
+        ],
+        "type": "test",
+        "edgeSource": "86350d8b-0ecf-4394-b31e-a050384828c6_end"
+      }
+    },
+    {
+      "id": "4b1cb6d4-e04d-4575-9d79-198bb95fadc5",
+      "x": 784,
+      "y": 500,
+      "data": {
+        "id": "4b1cb6d4-e04d-4575-9d79-198bb95fadc5",
+        "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number"
+          }
+        ],
+        "type": "test",
+        "edgeSource": "86350d8b-0ecf-4394-b31e-a050384828c6_end"
+      }
+    },
+    {
+      "id": "75691582-b0c5-421a-8b5b-7fc00abb400d",
+      "x": 784,
+      "y": 650,
+      "data": {
+        "id": "75691582-b0c5-421a-8b5b-7fc00abb400d",
+        "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number"
+          }
+        ],
+        "type": "test",
+        "edgeSource": "86350d8b-0ecf-4394-b31e-a050384828c6_end"
       }
     },
     {
-      "id": "94653d7d-c496-4e42-8ad2-7fa038abcc1e",
-      "x": 520,
-      "y": -10,
+      "id": "31313a98-2b7c-4565-9577-79cb088c26f0",
+      "x": 784,
+      "y": 800,
       "data": {
-        "id": "94653d7d-c496-4e42-8ad2-7fa038abcc1e",
+        "id": "31313a98-2b7c-4565-9577-79cb088c26f0",
         "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number"
+          }
+        ],
         "type": "test",
-        "edgeSource": "2ae1788e-b022-44ea-a2d4-98f8eee7cafb"
+        "edgeSource": "86350d8b-0ecf-4394-b31e-a050384828c6_end"
       }
     },
     {
-      "id": "123fc5c7-1d97-4be0-93f6-3afe0dfaf592",
-      "x": 470,
-      "y": 100,
+      "id": "5acf8cbd-0ba7-4d43-98c7-218b591be23b",
+      "x": 784,
+      "y": 950,
       "data": {
-        "id": "123fc5c7-1d97-4be0-93f6-3afe0dfaf592",
+        "id": "5acf8cbd-0ba7-4d43-98c7-218b591be23b",
         "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number"
+          }
+        ],
+        "type": "test",
+        "edgeSource": "86350d8b-0ecf-4394-b31e-a050384828c6_end"
+      }
+    },
+    {
+      "id": "53a2bde3-6279-481e-a47e-38fdcdb7933f",
+      "x": 612,
+      "y": 202,
+      "data": {
+        "id": "53a2bde3-6279-481e-a47e-38fdcdb7933f",
+        "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number"
+          }
+        ],
+        "type": "test",
+        "edgeSource": "faa43da7-ec23-4cf7-bc28-002f6e7cc970_end"
+      }
+    },
+    {
+      "id": "065c5348-cbb3-424a-8650-35a102a0da7e",
+      "x": 1122,
+      "y": 500,
+      "data": {
+        "id": "065c5348-cbb3-424a-8650-35a102a0da7e",
+        "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number"
+          }
+        ],
+        "type": "test",
+        "edgeSource": "4b1cb6d4-e04d-4575-9d79-198bb95fadc5_end"
+      }
+    },
+    {
+      "id": "b35e5e4a-77e4-4639-afcb-8506fccbf160",
+      "x": 1122,
+      "y": 650,
+      "data": {
+        "id": "b35e5e4a-77e4-4639-afcb-8506fccbf160",
+        "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number"
+          }
+        ],
+        "type": "test",
+        "edgeSource": "4b1cb6d4-e04d-4575-9d79-198bb95fadc5_end"
+      }
+    },
+    {
+      "id": "12cd6001-5f6b-4a3b-a56c-0df623be3907",
+      "x": 1122,
+      "y": 800,
+      "data": {
+        "id": "12cd6001-5f6b-4a3b-a56c-0df623be3907",
+        "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number"
+          }
+        ],
         "type": "test",
-        "edgeSource": "2ae1788e-b022-44ea-a2d4-98f8eee7cafb"
+        "edgeSource": "4b1cb6d4-e04d-4575-9d79-198bb95fadc5_end"
       }
     },
     {
-      "id": "e2d0d66f-3c14-4b28-b617-48243c75e18a",
-      "x": 490,
-      "y": 270,
+      "id": "541191cf-7459-4b14-906b-fbe385223737",
+      "x": 1122,
+      "y": 950,
       "data": {
-        "id": "e2d0d66f-3c14-4b28-b617-48243c75e18a",
+        "id": "541191cf-7459-4b14-906b-fbe385223737",
         "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number"
+          }
+        ],
         "type": "test",
-        "edgeSource": "2ae1788e-b022-44ea-a2d4-98f8eee7cafb"
+        "edgeSource": "4b1cb6d4-e04d-4575-9d79-198bb95fadc5_end"
       }
     },
     {
-      "id": "e48dc03d-38c2-4668-ace1-220f7a01a878",
-      "x": 404,
-      "y": 418,
+      "id": "76bcbc17-5419-48b2-ab05-e56a4fb91d79",
+      "x": 1460,
+      "y": 500,
       "data": {
-        "id": "e48dc03d-38c2-4668-ace1-220f7a01a878",
+        "id": "76bcbc17-5419-48b2-ab05-e56a4fb91d79",
+        "title": "直接回复",
+        "subTitle": "",
+        "inVars": [],
+        "type": "answer",
+        "edgeSource": "065c5348-cbb3-424a-8650-35a102a0da7e_end"
+      }
+    },
+    {
+      "id": "d36cc631-0686-4126-9e82-a7280c51f138",
+      "x": 1188,
+      "y": 120,
+      "data": {
+        "id": "d36cc631-0686-4126-9e82-a7280c51f138",
         "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String",
+            "nodeId": "d36cc631-0686-4126-9e82-a7280c51f138"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number",
+            "nodeId": "d36cc631-0686-4126-9e82-a7280c51f138"
+          }
+        ],
         "type": "test",
-        "edgeSource": "2ae1788e-b022-44ea-a2d4-98f8eee7cafb"
+        "edgeSource": "c68bde66-fd1f-48c1-9c03-c89fbbe75427_end"
       }
     },
     {
-      "id": "75fd8fd1-e286-4100-afb4-869f8250814d",
-      "x": 404,
-      "y": 577,
+      "id": "e2bfecbd-c831-4cab-90db-02d061fa9436",
+      "x": 1526,
+      "y": 120,
       "data": {
-        "id": "75fd8fd1-e286-4100-afb4-869f8250814d",
+        "id": "e2bfecbd-c831-4cab-90db-02d061fa9436",
         "title": "测试节点",
+        "subTitle": "",
+        "inVars": [],
+        "outVars": [
+          {
+            "label": "参数1",
+            "key": "param1",
+            "type": "String",
+            "nodeId": "e2bfecbd-c831-4cab-90db-02d061fa9436"
+          },
+          {
+            "label": "参数2",
+            "key": "param2",
+            "type": "Number",
+            "nodeId": "e2bfecbd-c831-4cab-90db-02d061fa9436"
+          }
+        ],
         "type": "test",
-        "edgeSource": "2ae1788e-b022-44ea-a2d4-98f8eee7cafb"
+        "edgeSource": "d36cc631-0686-4126-9e82-a7280c51f138_end"
+      }
+    },
+    {
+      "id": "e6d527bf-2864-4a04-99b5-9edffd5b6f35",
+      "x": 1864,
+      "y": 120,
+      "data": {
+        "id": "e6d527bf-2864-4a04-99b5-9edffd5b6f35",
+        "title": "直接回复",
+        "subTitle": "",
+        "inVars": [],
+        "type": "answer",
+        "edgeSource": "e2bfecbd-c831-4cab-90db-02d061fa9436_end"
       }
     }
   ],
@@ -292,44 +765,104 @@ export const data1 = {
       "source": "3ba412bb-3772-4f61-85de-095f4017858c"
     },
     {
-      "target": "b39b1a2f-8474-456b-8859-ce0b6597dd47",
+      "target": "ae7c7fe2-8538-43d5-b51c-4e096b7c1044",
       "source": "676e9ade-d857-4fea-b2d4-ff9484dcebb8",
-      "port": "7171167d-873b-4621-9ce1-dd45f9f4c9c3"
+      "port": "ce2c26aa-9b40-4e32-858e-38fa4b09718d"
     },
     {
-      "target": "b948a0d9-6e18-4b0f-a4c4-9a60bf3fc624",
+      "target": "6649401b-a00f-4f3a-818f-0e0919783e15",
       "source": "676e9ade-d857-4fea-b2d4-ff9484dcebb8",
       "port": "ce2c26aa-9b40-4e32-858e-38fa4b09718d"
     },
     {
-      "target": "b7dc7ea7-239b-40c5-b751-8ce5ebf49a23",
+      "target": "cf733a11-9d27-4de7-af4f-fa2dbc32ccd4",
       "source": "676e9ade-d857-4fea-b2d4-ff9484dcebb8",
       "port": "ce2c26aa-9b40-4e32-858e-38fa4b09718d"
     },
     {
-      "target": "94653d7d-c496-4e42-8ad2-7fa038abcc1e",
+      "target": "dba44a3d-4102-402e-b30e-2b782b897f76",
       "source": "676e9ade-d857-4fea-b2d4-ff9484dcebb8",
-      "port": "2ae1788e-b022-44ea-a2d4-98f8eee7cafb"
+      "port": "ce2c26aa-9b40-4e32-858e-38fa4b09718d"
     },
     {
-      "target": "123fc5c7-1d97-4be0-93f6-3afe0dfaf592",
+      "target": "3baab4e2-9301-413c-bbe4-f0a6028907e2",
       "source": "676e9ade-d857-4fea-b2d4-ff9484dcebb8",
-      "port": "2ae1788e-b022-44ea-a2d4-98f8eee7cafb"
+      "port": "ce2c26aa-9b40-4e32-858e-38fa4b09718d"
     },
     {
-      "target": "e2d0d66f-3c14-4b28-b617-48243c75e18a",
-      "source": "676e9ade-d857-4fea-b2d4-ff9484dcebb8",
-      "port": "2ae1788e-b022-44ea-a2d4-98f8eee7cafb"
+      "target": "f24fb6f8-19d2-45a8-a80c-5053e7017d39",
+      "source": "ae7c7fe2-8538-43d5-b51c-4e096b7c1044",
+      "port": "66e4ddc8-0171-4832-9cbd-569af9981c0d"
     },
     {
-      "target": "e48dc03d-38c2-4668-ace1-220f7a01a878",
-      "source": "676e9ade-d857-4fea-b2d4-ff9484dcebb8",
-      "port": "2ae1788e-b022-44ea-a2d4-98f8eee7cafb"
+      "target": "86350d8b-0ecf-4394-b31e-a050384828c6",
+      "source": "ae7c7fe2-8538-43d5-b51c-4e096b7c1044",
+      "port": "66e4ddc8-0171-4832-9cbd-569af9981c0d"
     },
     {
-      "target": "75fd8fd1-e286-4100-afb4-869f8250814d",
-      "source": "676e9ade-d857-4fea-b2d4-ff9484dcebb8",
-      "port": "2ae1788e-b022-44ea-a2d4-98f8eee7cafb"
+      "target": "faa43da7-ec23-4cf7-bc28-002f6e7cc970",
+      "source": "ae7c7fe2-8538-43d5-b51c-4e096b7c1044",
+      "port": "66e4ddc8-0171-4832-9cbd-569af9981c0d"
+    },
+    {
+      "target": "c68bde66-fd1f-48c1-9c03-c89fbbe75427",
+      "source": "86350d8b-0ecf-4394-b31e-a050384828c6"
+    },
+    {
+      "target": "85593db2-587e-40ff-bc4c-e12e7d1cec57",
+      "source": "86350d8b-0ecf-4394-b31e-a050384828c6"
+    },
+    {
+      "target": "4b1cb6d4-e04d-4575-9d79-198bb95fadc5",
+      "source": "86350d8b-0ecf-4394-b31e-a050384828c6"
+    },
+    {
+      "target": "75691582-b0c5-421a-8b5b-7fc00abb400d",
+      "source": "86350d8b-0ecf-4394-b31e-a050384828c6"
+    },
+    {
+      "target": "31313a98-2b7c-4565-9577-79cb088c26f0",
+      "source": "86350d8b-0ecf-4394-b31e-a050384828c6"
+    },
+    {
+      "target": "5acf8cbd-0ba7-4d43-98c7-218b591be23b",
+      "source": "86350d8b-0ecf-4394-b31e-a050384828c6"
+    },
+    {
+      "target": "53a2bde3-6279-481e-a47e-38fdcdb7933f",
+      "source": "faa43da7-ec23-4cf7-bc28-002f6e7cc970"
+    },
+    {
+      "target": "065c5348-cbb3-424a-8650-35a102a0da7e",
+      "source": "4b1cb6d4-e04d-4575-9d79-198bb95fadc5"
+    },
+    {
+      "target": "b35e5e4a-77e4-4639-afcb-8506fccbf160",
+      "source": "4b1cb6d4-e04d-4575-9d79-198bb95fadc5"
+    },
+    {
+      "target": "12cd6001-5f6b-4a3b-a56c-0df623be3907",
+      "source": "4b1cb6d4-e04d-4575-9d79-198bb95fadc5"
+    },
+    {
+      "target": "541191cf-7459-4b14-906b-fbe385223737",
+      "source": "4b1cb6d4-e04d-4575-9d79-198bb95fadc5"
+    },
+    {
+      "target": "76bcbc17-5419-48b2-ab05-e56a4fb91d79",
+      "source": "065c5348-cbb3-424a-8650-35a102a0da7e"
+    },
+    {
+      "target": "d36cc631-0686-4126-9e82-a7280c51f138",
+      "source": "c68bde66-fd1f-48c1-9c03-c89fbbe75427"
+    },
+    {
+      "target": "e2bfecbd-c831-4cab-90db-02d061fa9436",
+      "source": "d36cc631-0686-4126-9e82-a7280c51f138"
+    },
+    {
+      "target": "e6d527bf-2864-4a04-99b5-9edffd5b6f35",
+      "source": "e2bfecbd-c831-4cab-90db-02d061fa9436"
     }
   ]
 }

+ 2 - 1
src/views/workflow/types.ts

@@ -8,7 +8,8 @@ export type NodeStruct = {
 export type NodeDataStruct = {
   id: string
   title: string
-  type?: 'test' | 'root' | 'answer' | 'if-else'
+  subTitle?: string
+  type?: NodeType.Test | NodeType.Root | NodeType.Answer | NodeType.IfElse
   ports?: NodePortStruct[]
   edgeSource?: string
 }