From d8cc3c09832eb9fa4da907366815d38f5522d791 Mon Sep 17 00:00:00 2001 From: dengqichen Date: Fri, 20 Dec 2024 11:32:27 +0800 Subject: [PATCH] 1 --- .../src/pages/Workflow/NodeDesign/Design.tsx | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/Workflow/NodeDesign/Design.tsx b/frontend/src/pages/Workflow/NodeDesign/Design.tsx index 8bb83ff8..aa641e92 100644 --- a/frontend/src/pages/Workflow/NodeDesign/Design.tsx +++ b/frontend/src/pages/Workflow/NodeDesign/Design.tsx @@ -65,7 +65,8 @@ const FormRenderer: React.FC<{ schema: any; path?: string; readOnly?: boolean; -}> = ({schema, path = '', readOnly = false}) => { + currentTab?: any; +}> = ({schema, path = '', readOnly = false, currentTab}) => { if (!schema || !schema.properties) return null; const renderPortConfig = (portSchema: any, portPath: string) => { if (!portSchema || !portSchema.properties) return null; @@ -85,6 +86,12 @@ const FormRenderer: React.FC<{ required={portSchema.required?.includes('position')} initialValue={'default' in position ? position.default : undefined} style={{marginBottom: 16}} + rules={[ + { + required: portSchema.required?.includes('position'), + message: `请${position.type === 'string' ? '输入' : '选择'}${position.title}` + } + ]} > {readOnly ? ( {position.default || '-'} @@ -112,6 +119,7 @@ const FormRenderer: React.FC<{ schema={attrs} path={`${portPath}.attrs`} readOnly={readOnly} + currentTab={currentTab} /> )} @@ -192,6 +200,7 @@ const FormRenderer: React.FC<{ schema={value} path={fieldPath} readOnly={readOnly} + currentTab={currentTab} /> ); @@ -207,9 +216,15 @@ const FormRenderer: React.FC<{ } tooltip={value.description} - required={schema.required?.includes(key)} + required={currentTab?.schemaKey === 'uiVariables' && schema.required?.includes(key)} initialValue={'default' in value ? value.default : undefined} style={{marginBottom: 16}} + rules={currentTab?.schemaKey === 'uiVariables' ? [ + { + required: schema.required?.includes(key), + message: `请${value.type === 'string' ? '输入' : '选择'}${value.title}` + } + ] : undefined} > {readOnly ? ( {value.default || '-'} @@ -638,6 +653,7 @@ const NodeDesignForm: React.FC = () => { ) : null