增加工具栏提示。

This commit is contained in:
dengqichen 2024-12-13 16:31:10 +08:00
parent 692a6030eb
commit e2d06ece26
2 changed files with 12 additions and 6 deletions

View File

@ -200,7 +200,16 @@ const NodeConfigDrawer: React.FC<NodeConfigDrawerProps> = ({
layout="vertical" layout="vertical"
initialValues={{}} initialValues={{}}
> >
{renderFormItems()} <Form.Item name="code" hidden>
<Input />
</Form.Item>
{nodeDefinition?.graphConfig.configSchema &&
Object.entries(nodeDefinition.graphConfig.configSchema.properties).map(([key, property]) => {
// 跳过 code 字段的显示
if (key === 'code') return null;
const required = nodeDefinition.graphConfig.configSchema.required?.includes(key) || false;
return renderFormItem(key, property as SchemaProperty, required);
})}
</Form> </Form>
</Drawer> </Drawer>
); );

View File

@ -16,7 +16,6 @@ export const addNodeToGraph = (
position?: { x: number, y: number } position?: { x: number, y: number }
) => { ) => {
let nodeDefinition = workflowNodeDefinitionList.find(def => def.type === workflowDefinitionNode.type); let nodeDefinition = workflowNodeDefinitionList.find(def => def.type === workflowDefinitionNode.type);
console.log(nodeDefinition.graphConfig.uiSchema, workflowDefinitionNode.graph)
let uiGraph = isNew ? nodeDefinition.graphConfig.uiSchema : workflowDefinitionNode.graph; let uiGraph = isNew ? nodeDefinition.graphConfig.uiSchema : workflowDefinitionNode.graph;
// 根据形状类型设置正确的 shape // 根据形状类型设置正确的 shape
let shape = 'rect'; // 默认使用矩形 let shape = 'rect'; // 默认使用矩形
@ -25,7 +24,6 @@ export const addNodeToGraph = (
} else if (uiGraph.shape === 'diamond') { } else if (uiGraph.shape === 'diamond') {
shape = 'polygon'; shape = 'polygon';
} }
console.log(nodeDefinition.type, workflowDefinitionNode.type)
// 创建节点 // 创建节点
return graph.addNode({ return graph.addNode({
inherit: 'rect', inherit: 'rect',
@ -50,7 +48,6 @@ export const addNodeToGraph = (
type: isNew ? nodeDefinition.type : workflowDefinitionNode.type, type: isNew ? nodeDefinition.type : workflowDefinitionNode.type,
code: uiGraph.code, code: uiGraph.code,
ports: convertPortConfig(uiGraph.ports), ports: convertPortConfig(uiGraph.ports),
nodeDefinition: nodeDefinition, nodeDefinition: nodeDefinition
aaaaaa: "dasdasdsadasdd"
}); });
}; };