1
This commit is contained in:
parent
6dfd7b914f
commit
3543906817
@ -113,12 +113,22 @@ const WorkflowDesign: React.FC = () => {
|
||||
},
|
||||
validateConnection({sourceCell, targetCell, sourceMagnet, targetMagnet}) {
|
||||
if (sourceCell === targetCell) {
|
||||
return false;
|
||||
return false; // 禁止自连接
|
||||
}
|
||||
if (!sourceMagnet || !targetMagnet) {
|
||||
return false;
|
||||
return false; // 需要有效的连接点
|
||||
}
|
||||
// 检查是否已存在相同的连接
|
||||
|
||||
// 获取源节点和目标节点的类型
|
||||
const sourceNodeType = sourceCell.getProp('nodeType');
|
||||
const targetNodeType = targetCell.getProp('nodeType');
|
||||
|
||||
// 如果源节点或目标节点是网关类型,允许多条连线
|
||||
if (sourceNodeType === 'GATEWAY_NODE' || targetNodeType === 'GATEWAY_NODE') {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 对于其他类型的节点,检查是否已存在连接
|
||||
const edges = graph.getEdges();
|
||||
const exists = edges.some(edge => {
|
||||
const source = edge.getSource();
|
||||
@ -521,7 +531,7 @@ const WorkflowDesign: React.FC = () => {
|
||||
|
||||
// 节点点击事件
|
||||
graph.on('node:click', ({node}) => {
|
||||
// 获取当前选中的节点
|
||||
// <EFBFBD><EFBFBD>取当前选中的节点
|
||||
const selectedNode = graph.getSelectedCells()[0];
|
||||
|
||||
// 如果有其他节点被选中,恢复其样式
|
||||
@ -883,7 +893,7 @@ const WorkflowDesign: React.FC = () => {
|
||||
message.success('已剪切');
|
||||
};
|
||||
|
||||
// 处理粘贴操作
|
||||
// 处理粘贴操<EFBFBD><EFBFBD><EFBFBD>
|
||||
const handlePaste = () => {
|
||||
if (!graph) return;
|
||||
if (graph.isClipboardEmpty()) {
|
||||
@ -952,7 +962,7 @@ const WorkflowDesign: React.FC = () => {
|
||||
return port?.id;
|
||||
};
|
||||
|
||||
// 获取源节点的输出端口(一定是out组)
|
||||
// 获取源节点的输出端口(一定<EFBFBD><EFBFBD><EFBFBD>out组)
|
||||
const sourcePort = getPortByGroup(sourceNode, 'out');
|
||||
|
||||
// 获取目标节点的输入端口(一定是in组)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user