From e30ebd4155742c7c1f373f67f254d6cda89fd543 Mon Sep 17 00:00:00 2001 From: Junjie <xjj@123> Date: 星期二, 16 四月 2024 16:55:46 +0800 Subject: [PATCH] # --- zy-asrs-flow/src/components/Flow/GraphTools.jsx | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/zy-asrs-flow/src/components/Flow/GraphTools.jsx b/zy-asrs-flow/src/components/Flow/GraphTools.jsx index 701fdec..dddb705 100644 --- a/zy-asrs-flow/src/components/Flow/GraphTools.jsx +++ b/zy-asrs-flow/src/components/Flow/GraphTools.jsx @@ -6,6 +6,7 @@ import { exportDataToServer, getFlowList, deleteFlowById, updateFlowStatus, mockRun } from "../../services/flow/api"; import './css/GraphTools.less' import { flow, remove } from "lodash"; +import { find } from "lodash"; export const GraphTools = ({ graphRef, isReady }) => { @@ -109,6 +110,8 @@ } let result = sortNodes(rootNode, nodes, graph); + let targetResult = setResult(edges, result) + console.log(targetResult); exportDataToServer({ originData: JSON.stringify(data), data: result, @@ -176,6 +179,37 @@ return cpValues; } + const setResult = (edges, result) => { + console.log(edges, result); + result.forEach((item) => { + let find = findEdge(edges, item.id) + + item.nextTrue = ""; + item.nextFalse = ""; + + find.forEach((edge) => { + if (edge.data.logicBool == true) { + item.nextTrue = edge.target.cell; + } else { + item.nextFalse = edge.target.cell; + } + }) + }) + + return result; + } + + const findEdge = (edges, parentId) => { + let list = []; + edges.forEach((edge) => { + if (edge.source.cell == parentId) { + list.push(edge); + } + }) + + return list; + } + const transCode = (rootNode, nodes, graph) => { let codeContent = ""; -- Gitblit v1.9.1