|
@@ -45,6 +45,7 @@ function createEdge(sourceNodeId, targetNodeId) {
|
|
|
function createNodes(source, startNode) {
|
|
|
const nodesRaw = [];
|
|
|
const edgesRaw = [];
|
|
|
+
|
|
|
|
|
|
function convert(raw, parent = "0", level = 0) {
|
|
|
level++;
|
|
@@ -63,9 +64,16 @@ function createNodes(source, startNode) {
|
|
|
|
|
|
const prevSameNodeIndex = nodesRaw.findIndex(({ text }) => text === node.text);
|
|
|
if (prevSameNodeIndex >= 0) nodesRaw.splice(prevSameNodeIndex, 1);
|
|
|
-
|
|
|
+
|
|
|
nodesRaw.push(node);
|
|
|
edgesRaw.push(edge);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
if (current.next_actions.length > 0) convert(current, current.order_process, level);
|
|
|
}
|
|
|
}
|
|
@@ -85,6 +93,7 @@ function createNodesWithRecord(nodesRaw, edgesRaw, record) {
|
|
|
const next = record[i + 1];
|
|
|
const isLast = i === record.length - 1;
|
|
|
const sourceNodeIndex = nodesRaw.findIndex(({ id }) => id === current.order_process);
|
|
|
+
|
|
|
if (sourceNodeIndex >= 0) {
|
|
|
nodesRaw[sourceNodeIndex].type = isLast ? 'ProcessTask' : 'StartTask';
|
|
|
nodesRaw[sourceNodeIndex].properties = {
|
|
@@ -118,6 +127,7 @@ export function createProcessData(source, record) {
|
|
|
}
|
|
|
|
|
|
const { start, startRaw } = createStartNode(source);
|
|
|
+
|
|
|
const { nodesRaw: _nodesRaw, edgesRaw } = createNodes(source, startRaw);
|
|
|
|
|
|
const nodesRaw = [start, ..._nodesRaw];
|
|
@@ -127,7 +137,5 @@ export function createProcessData(source, record) {
|
|
|
processChart.nodes.push(...nodes);
|
|
|
processChart.edges.push(...edges);
|
|
|
|
|
|
- console.log(processChart)
|
|
|
-
|
|
|
return processChart
|
|
|
}
|