增加工具栏提示。

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

View File

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

View File

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