Skip to content

介绍


本文档主要用于描述 ShadcnWorkflow 组件的一些特性和使用方法。

用法

查看代码
vue
<template>
  <div style="width: 1080px">
    <ShadcnWorkflowEditor v-model="workflowState"
                          :categories="categories"
                          :nodes="nodes"
                          :connections="[]"/>
  </div>
</template>

视图

查看代码
vue
<template>
  <div style="width: 1080px">
    <ShadcnWorkflowView :nodes="nodes" :data="data"/>
  </div>
</template>

示例

json
{
    id: 'start',
    label: 'Start',
    category: 'input',
    position: { x: 0, y: 0 },
    configure: [
        {
            field: 'name',
            label: 'Name',
            type: 'input',
            description: 'This is a long description, this is a long description, this is a long description, this is a long description',
            required: true
        },
        {
            field: 'name1',
            label: 'Password',
            type: 'password',
            rules: [
                {
                    required: true, 
                    message: 'Please input password!'
                }
            ],
            required: true
        }
    ],
    description: 'Job start node',
    ports: [
        { 
            id: 'out1', 
            type: 'output',
            label: 'Output', 
            required: true,
            message: 'Input is required'
        }
    ]
}
  • id : 节点 ID
  • label : 节点标签
  • category :节点类别
  • position : 节点位置
    • x : 节点 x 位置
    • y : 节点 y 位置
  • configure : 节点配置
    • field : 配置字段
    • label : 配置标签
    • type : 配置类型,支持所有 form 组件
    • description : 配置描述
    • required :配置必需
    • rules : 配置规则
  • description : 节点描述
  • ports : 节点端口
    • id : 端口 ID
    • type : 端口类型
    • label : 端口标签
    • required :需要端口
    • message : 端口消息

数据

json
{
    "nodes": [
        {
            "id": "646de380-ec15-411c-a830-3bf4c5515451",
            "tid": "start",
            "category": "input",
            "position": {
                "x": 160,
                "y": 121
            },
            "data": {}
        },
        {
            "id": "109ed659-2909-41bd-9530-12010a539e3f",
            "tid": "end",
            "category": "output",
            "position": {
                "x": 396,
                "y": 340
            },
            "data": {}
        }
    ],
    "connections": [
        {
            "id": "7f4fe994-c2ef-4978-b1c8-f3c94dae79ef",
            "source": "646de380-ec15-411c-a830-3bf4c5515451-out1",
            "target": "109ed659-2909-41bd-9530-12010a539e3f-in1"
        }
    ]
}
  • nodes :节点
    • id : 节点 ID
    • tid : 节点 tid (原始节点 ID)
    • category :节点类别
    • position : 节点位置
      • x : 节点 x 位置
      • y : 节点 y 位置
    • data :节点表单数据
  • connections :连接
    • id : 连接 ID
    • source : 连接源
    • target : 连接目标

流程 (Workflow) 属性



流程 (Workflow) 插槽

流程 (Workflow) 事件