优化节点超时节点卡顿问题

pull/710/head
Lemon 2025-02-24 17:00:05 +08:00
parent 4b96a6458b
commit da7c9e9796
1 changed files with 34 additions and 30 deletions

View File

@ -165,53 +165,57 @@ const nodeClick = () => {
const deleteNode = () => {
emits('update:flowNode', currentNode.value.childNode)
}
//
const findReturnTaskNodes = (
matchNodeList: SimpleFlowNode[] //
) => {
//
//
const findReturnTaskNodes = (matchNodeList: SimpleFlowNode[]) => {
// Set ,
const uniqueNodes = new Set<SimpleFlowNode>()
const currentNodeId = currentNode.value.id
//
emits('find:parentNode', matchNodeList, NodeType.USER_TASK_NODE)
//
findChildUserTaskNodes(currentNode.value, matchNodeList)
//
const currentNodeId = currentNode.value.id
// 使 Map , id key
const uniqueNodes = new Map()
// Set
matchNodeList.forEach(node => {
if (node.id !== currentNodeId) {
uniqueNodes.set(node.id, node)
uniqueNodes.add(node)
}
})
//
// Set
findChildUserTaskNodes(currentNode.value, uniqueNodes, currentNodeId)
// Set
matchNodeList.length = 0
matchNodeList.push(...Array.from(uniqueNodes.values()))
matchNodeList.push(...uniqueNodes)
}
//
const findChildUserTaskNodes = (node: SimpleFlowNode, matchNodeList: SimpleFlowNode[]) => {
//
const findChildUserTaskNodes = (
node: SimpleFlowNode,
uniqueNodes: Set<SimpleFlowNode>,
currentNodeId: string
) => {
if (!node) return
//
//
if (node.childNode) {
if (node.childNode.type === NodeType.USER_TASK_NODE) {
matchNodeList.push(node.childNode)
if (node.childNode.type === NodeType.USER_TASK_NODE && node.childNode.id !== currentNodeId) {
uniqueNodes.add(node.childNode)
}
findChildUserTaskNodes(node.childNode, matchNodeList)
findChildUserTaskNodes(node.childNode, uniqueNodes, currentNodeId)
}
//
//
if (node.type === NodeType.CONDITION_BRANCH_NODE && node.conditionNodes) {
node.conditionNodes.forEach(conditionNode => {
for (const conditionNode of node.conditionNodes) {
if (conditionNode.childNode) {
if (conditionNode.childNode.type === NodeType.USER_TASK_NODE) {
matchNodeList.push(conditionNode.childNode)
if (conditionNode.childNode.type === NodeType.USER_TASK_NODE &&
conditionNode.childNode.id !== currentNodeId) {
uniqueNodes.add(conditionNode.childNode)
}
findChildUserTaskNodes(conditionNode.childNode, matchNodeList)
findChildUserTaskNodes(conditionNode.childNode, uniqueNodes, currentNodeId)
}
})
}
}
}