Commit d227acf4 authored by chenshouchao's avatar chenshouchao

feat: 删除节点时同时删除相关的线

parent b195aaeb
...@@ -100,6 +100,12 @@ const BatchOperatorFlow = (props: IProps) => { ...@@ -100,6 +100,12 @@ const BatchOperatorFlow = (props: IProps) => {
return item.id !== inSideFlowNodeId; return item.id !== inSideFlowNodeId;
})) || })) ||
[]; [];
// 删除节点时同时删除相关的线
newVal?.forEach((task) => {
task.edges = task.edges.filter(
(edge) => edge.target !== inSideFlowNodeId
);
});
setTasks && setTasks(newVal); setTasks && setTasks(newVal);
} }
if (selectedEdge) { if (selectedEdge) {
...@@ -174,7 +180,7 @@ const BatchOperatorFlow = (props: IProps) => { ...@@ -174,7 +180,7 @@ const BatchOperatorFlow = (props: IProps) => {
}); });
}); });
return val; return val;
}, [tasks, inSideFlowNodeId, flowNodeDraggable]); }, [tasks, inSideFlowNodeId, flowNodeDraggable, showVersion]);
/** 生成初始化的连线节点 */ /** 生成初始化的连线节点 */
const initialEdges = useMemo(() => { const initialEdges = useMemo(() => {
......
...@@ -143,6 +143,12 @@ const Flow = (props: IProps) => { ...@@ -143,6 +143,12 @@ const Flow = (props: IProps) => {
); );
})) || })) ||
[]; [];
// 删除节点时同时删除相关的线
newVal?.forEach((task) => {
task.edges = task.edges.filter(
(edge) => edge.target !== inSideBatchNodeId
);
});
setTasks && setTasks(newVal); setTasks && setTasks(newVal);
} }
if (selectedEdge) { if (selectedEdge) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment