feat(web): 增加循环节点的基本参数

This commit is contained in:
v-zhangjc9
2025-07-15 11:11:36 +08:00
parent b0e4f5853e
commit df8270676a
2 changed files with 26 additions and 10 deletions

View File

@@ -1,20 +1,21 @@
import {PlusCircleFilled} from '@ant-design/icons'
import {Button, Dropdown} from 'antd'
import type {ButtonProps} from 'antd/lib'
import {isEqual, randomId, unique} from 'licia' import {isEqual, randomId, unique} from 'licia'
import {NodeRegistry, NodeRegistryMap} from '../NodeRegistry.tsx'
import {commonInfo} from '../../../util/amis.tsx' import {commonInfo} from '../../../util/amis.tsx'
import {checkAddNode} from '../FlowChecker.tsx' import {checkAddNode} from '../FlowChecker.tsx'
import {Button, Dropdown} from 'antd' import {NodeRegistry, NodeRegistryMap} from '../NodeRegistry.tsx'
import {PlusCircleFilled} from '@ant-design/icons'
import {useDataStore} from '../store/DataStore.ts' import {useDataStore} from '../store/DataStore.ts'
import {useFlowStore} from '../store/FlowStore.ts' import {useFlowStore} from '../store/FlowStore.ts'
import type {ButtonProps} from 'antd/lib'
export type AddNodeButtonProps = { export type AddNodeButtonProps = ButtonProps & {
parent?: string parent?: string
} & ButtonProps onlyIcon?: boolean
}
const AddNodeButton = (props: AddNodeButtonProps) => { const AddNodeButton = (props: AddNodeButtonProps) => {
const {data, setDataById} = useDataStore() const {data, setDataById} = useDataStore()
const {nodes, addNode, edges,} = useFlowStore() const {nodes, addNode, edges} = useFlowStore()
return ( return (
<Dropdown <Dropdown
menu={{ menu={{
@@ -57,7 +58,7 @@ const AddNodeButton = (props: AddNodeButtonProps) => {
...(props.parent ? { ...(props.parent ? {
parentId: props.parent, parentId: props.parent,
extent: 'parent', extent: 'parent',
} : {}) } : {}),
}) })
} catch (e) { } catch (e) {
// @ts-ignore // @ts-ignore
@@ -68,7 +69,7 @@ const AddNodeButton = (props: AddNodeButtonProps) => {
> >
<Button {...props}> <Button {...props}>
<PlusCircleFilled/> <PlusCircleFilled/>
{props.onlyIcon ? undefined : '新增节点'}
</Button> </Button>
</Dropdown> </Dropdown>
) )

View File

@@ -23,6 +23,21 @@ const LoopNode = (props: NodeProps) => {
}, [props.id]) }, [props.id])
const columnsSchema = useCallback(() => [ const columnsSchema = useCallback(() => [
{
type: 'switch',
name: 'failFast',
label: '快速失败',
description: '执行过程中一旦出现错误,及时中断循环任务的执行',
},
{
disabled: true,
type: 'switch',
name: 'parallel',
label: '并行执行',
},
{
type: 'divider',
},
...outputsFormColumns(false, true), ...outputsFormColumns(false, true),
], [props.id]) ], [props.id])
@@ -48,7 +63,7 @@ const LoopNode = (props: NodeProps) => {
color={flowDotColor} color={flowDotColor}
bgColor={flowBackgroundColor} bgColor={flowBackgroundColor}
/> />
<AddNodeButton className="mt-2 ml-2" parent={props.id}/> <AddNodeButton className="mt-2 ml-2" parent={props.id} onlyIcon/>
</div> </div>
} }
columnSchema={columnsSchema} columnSchema={columnsSchema}