# 工作流节点

调用其他子工作流,实现流程的复用

# 数据结构定义

export interface WorkflowNodeDef {
  id: INodeIDValue;
  type: WorkflowNodeTypeEnum.Workflow;
  data: {
    title: string;
    inputsValues: {
      workflow_id: IFlowConstantValue;             // 子工作流 ID
      input_params: Record<string, IFlowValue>;    // 子工作流输入参数
    };
    inputs: IJsonSchema;                           // 子工作流输入参数类型
    outputs: IJsonSchema;                          // 子工作流输出参数类型
  }
}

# 范例

{
  id: {random(6)},
  type: 'workflow',
  data: {
    title: `调用子工作流`,
    inputsValues: {
      workflow_id: {                             // 子工作流 ID
        type: 'constant',
        content: '196117',
      },
      input_params: {                            // 子工作流输入参数
        query: {
          type: 'ref',
          content: ['100001', 'query'],
        },
        enable: {
          type: 'ref',
          content: ['100001', 'enable'],
        },
        array_obj: {
          type: 'ref',
          content: ['100001', 'array_obj'],
        },
      }
    },
    inputs: {
      type: 'object',
      required: [],
      properties: {
        workflow_id: { type: 'string' },
        input_params: {
          type: 'object',
          properties: {
            query: {
              type: 'string',
            },
            enable: {
              type: 'boolean',
            },
            array_obj: {
              type: 'array',
              items: {
                type: 'object',
                properties: {
                  int: {
                    type: 'number',
                  },
                  str: {
                    type: 'string',
                  },
                },
              },
            },
          },
        },
      },
    },
    outputs: {
      type: 'object',
      properties: {
        result: { type: 'string' },
      },
    },
  },
}