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

View File

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