| | |
| | | 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 }) => { |
| | | |
| | |
| | | } |
| | | |
| | | let result = sortNodes(rootNode, nodes, graph); |
| | | let targetResult = setResult(edges, result) |
| | | console.log(targetResult); |
| | | exportDataToServer({ |
| | | originData: JSON.stringify(data), |
| | | data: result, |
| | |
| | | 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 = ""; |
| | | |