增加工具栏提示。

This commit is contained in:
dengqichen 2024-12-12 15:09:12 +08:00
parent bfb7e34839
commit c93847b482
3 changed files with 29 additions and 70 deletions

View File

@ -1,6 +1,6 @@
import Ajv from 'ajv'; import Ajv from 'ajv';
import addFormats from 'ajv-formats'; import addFormats from 'ajv-formats';
import { NodeType } from '../../../../types'; import {NodeTypeEnum} from "@/pages/Workflow/Definition/Designer/components/NodePanel/types";
const ajv = new Ajv({ const ajv = new Ajv({
allErrors: true, allErrors: true,
@ -17,7 +17,7 @@ export interface ValidationResult {
} }
export const validateNodeConfig = ( export const validateNodeConfig = (
nodeType: NodeType, nodeType: NodeTypeEnum,
formData: any formData: any
): ValidationResult => { ): ValidationResult => {
console.log('Validating node config:', { nodeType, formData }); console.log('Validating node config:', { nodeType, formData });

View File

@ -1,5 +1,4 @@
import { BaseResponse } from '@/types/base/response'; import { BaseResponse } from '@/types/base/response';
import { NodeGraph } from '../../../types';
/** /**
* *
@ -16,83 +15,48 @@ export interface NodeStyle {
* *
*/ */
export enum NodeCategory { export enum NodeCategory {
EVENT = 'EVENT', // 事件节点 EVENT = 'EVENT', // 事件节点
TASK = 'TASK', // 任务节点 TASK = 'TASK', // 任务节点
GATEWAY = 'GATEWAY', // 网关节点 GATEWAY = 'GATEWAY', // 网关节点
CONTAINER = 'CONTAINER' // 容器节点 CONTAINER = 'CONTAINER' // 容器节点
} }
/** /**
* *
*/ */
export enum NodeTypeEnum { export enum NodeTypeEnum {
START_EVENT = 'START_EVENT', // 开始节点 START_EVENT = 'START_EVENT', // 开始节点
END_EVENT = 'END_EVENT', // 结束节点 END_EVENT = 'END_EVENT', // 结束节点
USER_TASK = 'USER_TASK', // 用户任务 USER_TASK = 'USER_TASK', // 用户任务
SERVICE_TASK = 'SERVICE_TASK', // 服务任务 SERVICE_TASK = 'SERVICE_TASK', // 服务任务
SCRIPT_TASK = 'SCRIPT_TASK', // 脚本任务 SCRIPT_TASK = 'SCRIPT_TASK', // 脚本任务
EXCLUSIVE_GATEWAY = 'EXCLUSIVE_GATEWAY', // 排他网关 EXCLUSIVE_GATEWAY = 'EXCLUSIVE_GATEWAY', // 排他网关
PARALLEL_GATEWAY = 'PARALLEL_GATEWAY', // 并行网关 PARALLEL_GATEWAY = 'PARALLEL_GATEWAY', // 并行网关
SUB_PROCESS = 'SUB_PROCESS', // 子流程 SUB_PROCESS = 'SUB_PROCESS', // 子流程
CALL_ACTIVITY = 'CALL_ACTIVITY' // 调用活动 CALL_ACTIVITY = 'CALL_ACTIVITY' // 调用活动
}
/**
*
*/
export interface NodeDetails {
description: string; // 详细描述
features: string[]; // 功能特性
scenarios: string[]; // 使用场景
}
/**
* JSON Schema属性
*/
export interface JsonSchemaProperty {
type: string;
title: string;
description: string;
format?: string;
default?: any;
enum?: string[];
enumNames?: string[];
}
/**
* Schema
*/
export interface NodeConfigSchema {
type: string;
properties: Record<string, JsonSchemaProperty>;
required: string[];
} }
/** /**
* *
*/ */
export interface NodeGraphConfig { export interface NodeGraphConfig {
code: string; // 节点代码 style: NodeStyle; // 节点样式
name: string; // 节点名称 ports?: any[]; // 连接点配置
description: string; // 节点描述 shape?: string; // 节点形状
details: NodeDetails; // 节点详情
configSchema: NodeConfigSchema; // 配置模式
uiSchema: NodeGraph; // UI渲染模式
} }
/** /**
* *
*/ */
export interface NodeType extends BaseResponse { export interface NodeType extends BaseResponse {
type: NodeTypeEnum; // 节点类型 type: NodeTypeEnum; // 节点类型
name: string; // 节点名称 name: string; // 节点名称
description: string; // 节点描述 description: string; // 节点描述
category: NodeCategory; // 节点分类 category: NodeCategory; // 节点分类
flowableConfig: any; // 工作流引擎配置 graphConfig: NodeGraphConfig; // 图形配置
graphConfig: NodeGraphConfig; // 图形配置 style?: NodeStyle; // 兼容旧版本的样式配置
style: NodeStyle; // 节点样式 orderNum: number; // 排序号
orderNum: number; // 排序号 enabled: boolean; // 是否启用
enabled: boolean; // 是否启用 deleted: boolean; // 是否删除
deleted: boolean; // 是否删除 extraData: any; // 扩展数据
extraData: any; // 扩展数据
} }

View File

@ -8,13 +8,8 @@ import { Snapline } from '@antv/x6-plugin-snapline';
import { MiniMap } from '@antv/x6-plugin-minimap'; import { MiniMap } from '@antv/x6-plugin-minimap';
import { import {
NodeData, NodeData,
EdgeData,
WorkflowDefinition,
GraphData,
EdgeStyle,
NodeType
} from '../types'; } from '../types';
import { generateNodeStyle, generatePorts } from './nodeUtils'; import {WorkflowDefinition} from "@/pages/Workflow/Definition/types";
// Initialize graph with enhanced configuration // Initialize graph with enhanced configuration
export const initGraph = ({ export const initGraph = ({