|
|
|
@ -32,7 +32,8 @@ import { appFLowHandle } from '@/pages/flowEditor/utils/appFlowhandle';
|
|
|
|
import { Dispatch } from 'redux';
|
|
|
|
import { Dispatch } from 'redux';
|
|
|
|
import { runMainFlow } from '@/api/apps';
|
|
|
|
import { runMainFlow } from '@/api/apps';
|
|
|
|
import store from '@/store';
|
|
|
|
import store from '@/store';
|
|
|
|
import { updateAppEvent } from '@/api/appEvent';
|
|
|
|
import { updateAppEvent, updateAppEventChannel, updateAppFlowData } from '@/api/appEvent';
|
|
|
|
|
|
|
|
import { sleep } from '@/utils/common';
|
|
|
|
|
|
|
|
|
|
|
|
export const useFlowCallbacks = (
|
|
|
|
export const useFlowCallbacks = (
|
|
|
|
nodes: Node[],
|
|
|
|
nodes: Node[],
|
|
|
|
@ -1182,6 +1183,40 @@ export const useFlowCallbacks = (
|
|
|
|
nodes,
|
|
|
|
nodes,
|
|
|
|
edges
|
|
|
|
edges
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const appFlowParams = {
|
|
|
|
|
|
|
|
appEventList: {}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
nodes.forEach(node => {
|
|
|
|
|
|
|
|
appFlowParams.appEventList[node.id] = {
|
|
|
|
|
|
|
|
x: node.position.x,
|
|
|
|
|
|
|
|
y: node.position.y
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const eventMap = new Map();
|
|
|
|
|
|
|
|
edges.forEach((edge: any) => {
|
|
|
|
|
|
|
|
const eventId = edge.data.displayData.eventId;
|
|
|
|
|
|
|
|
const dto = {
|
|
|
|
|
|
|
|
eventId: eventId,
|
|
|
|
|
|
|
|
topicDTO: {
|
|
|
|
|
|
|
|
topic: edge.data.displayData.topic,
|
|
|
|
|
|
|
|
eventName: edge.data.displayData.name
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
eventMap.set(eventId, dto);
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
const appEventParams = Array.from(eventMap.values());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
updateAppFlowData(appFlowParams);
|
|
|
|
|
|
|
|
if (appEventParams.length > 0) {
|
|
|
|
|
|
|
|
for (const item of appEventParams) {
|
|
|
|
|
|
|
|
console.log('item:', item);
|
|
|
|
|
|
|
|
await sleep(500);
|
|
|
|
|
|
|
|
updateAppEventChannel(item);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}, [nodes, edges, initialData?.appId]);
|
|
|
|
}, [nodes, edges, initialData?.appId]);
|
|
|
|
// 运行处理函数
|
|
|
|
// 运行处理函数
|
|
|
|
|