const getNextNode = (lf, nodeId) => {
    // 获取所有上级节点
    const parentNodes = lf.getNodeIncomingNode(nodeId);
    console.log(parentNodes, 'parentNodes' + nodeId);
    let vars = [];
    if (parentNodes.length > 0) {
        for (let i = 0; i < parentNodes.length; i++) {
            if (parentNodes[i].properties?.nodeVars?.length) {
                vars = vars.concat(parentNodes[i].properties.nodeVars);
            }
            console.log(vars, 'vars' + nodeId);
            const parentVars = getNextNode(lf, parentNodes[i].id);
            if (parentVars?.length) vars = vars.concat(parentVars);
        }
    }

    return vars;
}
export const getNodeCanUseVars = (lf, nodeId) => {
    const vars = getNextNode(lf, nodeId);

    if (!vars?.length) return [];

    // 参数去重
    const varMap = {};
    vars.forEach(item => {
        if(!varMap[item.key]) varMap[item.key] = item;
    });

    return Object.values(varMap);
    
}