Compare commits
2 Commits
40bd866f91
...
e78df2ed5d
| Author | SHA1 | Date | |
|---|---|---|---|
| e78df2ed5d | |||
| add482aee2 |
@ -35,7 +35,7 @@ import CodeNodeParams from './params/CodeNodeParams.vue'
|
|||||||
import HttpNodeParams from './params/HttpNodeParams.vue'
|
import HttpNodeParams from './params/HttpNodeParams.vue'
|
||||||
import SdAgentNodeParams from './params/SdAgentNodeParams.vue'
|
import SdAgentNodeParams from './params/SdAgentNodeParams.vue'
|
||||||
import RecognizeNodeParams from './params/RecognizeNodeParams.vue'
|
import RecognizeNodeParams from './params/RecognizeNodeParams.vue'
|
||||||
import DeviceUniversal from './params/Device_universal.vue'
|
import DeviceUniversal from './params/DeviceUniversal.vue'
|
||||||
import SwitchNodeParams from './params/SwitchNodeParams.vue'
|
import SwitchNodeParams from './params/SwitchNodeParams.vue'
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
@ -62,7 +62,7 @@ const currentComponent = computed(() => {
|
|||||||
if (type === 'http') return HttpNodeParams
|
if (type === 'http') return HttpNodeParams
|
||||||
if (type === 'sdAgent') return SdAgentNodeParams
|
if (type === 'sdAgent') return SdAgentNodeParams
|
||||||
if (type === 'recognize') return RecognizeNodeParams
|
if (type === 'recognize') return RecognizeNodeParams
|
||||||
if (type === 'device_universal') return DeviceUniversal
|
if (type === 'deviceUniversal') return DeviceUniversal
|
||||||
if (type === 'branch') return SwitchNodeParams
|
if (type === 'branch') return SwitchNodeParams
|
||||||
return null
|
return null
|
||||||
})
|
})
|
||||||
|
|||||||
@ -337,7 +337,7 @@ function handler(params) {
|
|||||||
{
|
{
|
||||||
icon: cameraSvg,
|
icon: cameraSvg,
|
||||||
name: "通用指令",
|
name: "通用指令",
|
||||||
type: "device_universal",
|
type: "deviceUniversal",
|
||||||
desc: "执行设备通用指令",
|
desc: "执行设备通用指令",
|
||||||
action: 'DEVICE_EXECUTE_JSON_COMMAND',
|
action: 'DEVICE_EXECUTE_JSON_COMMAND',
|
||||||
nodeType: 'EDGE',
|
nodeType: 'EDGE',
|
||||||
|
|||||||
@ -78,7 +78,7 @@ import CodeNode from "../nodes/function/codeNode.vue";
|
|||||||
import CurrentLoopNode from "../nodes/function/currentLoop.vue";
|
import CurrentLoopNode from "../nodes/function/currentLoop.vue";
|
||||||
import SdAgentNode from "../nodes/function/sdAgent.vue";
|
import SdAgentNode from "../nodes/function/sdAgent.vue";
|
||||||
import RecognizeNode from "../nodes/function/recognize.vue";
|
import RecognizeNode from "../nodes/function/recognize.vue";
|
||||||
import DeviceUniversal from "../nodes/function/device_universal.vue";
|
import DeviceUniversal from "../nodes/function/deviceUniversal.vue";
|
||||||
|
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
id: String,
|
id: String,
|
||||||
@ -103,7 +103,7 @@ const componentMap = {
|
|||||||
currentLoop: CurrentLoopNode,
|
currentLoop: CurrentLoopNode,
|
||||||
sdAgent: SdAgentNode,
|
sdAgent: SdAgentNode,
|
||||||
recognize: RecognizeNode,
|
recognize: RecognizeNode,
|
||||||
device_universal: DeviceUniversal,
|
deviceUniversal: DeviceUniversal,
|
||||||
};
|
};
|
||||||
|
|
||||||
const flowStore = useFlowStore();
|
const flowStore = useFlowStore();
|
||||||
|
|||||||
@ -791,10 +791,21 @@ export const createFlowFacade = (store) => {
|
|||||||
const group = store.findNode(groupId);
|
const group = store.findNode(groupId);
|
||||||
const child = store.findNode(childId);
|
const child = store.findNode(childId);
|
||||||
if (!group || !child || GROUP_TYPES.has(child.data.flowType)) return;
|
if (!group || !child || GROUP_TYPES.has(child.data.flowType)) return;
|
||||||
|
const previousParentId = child.parentNode || child.data?.properties?.parentId;
|
||||||
const graph = facade.getGraphData();
|
const graph = facade.getGraphData();
|
||||||
const groupData = graph.nodes.find((node) => node.id === groupId);
|
const groupData = graph.nodes.find((node) => node.id === groupId);
|
||||||
const childData = graph.nodes.find((node) => node.id === childId);
|
const childData = graph.nodes.find((node) => node.id === childId);
|
||||||
if (!groupData || !childData) return;
|
if (!groupData || !childData) return;
|
||||||
|
|
||||||
|
// 节点从循环体外进入循环体后,原连线的两端已处于不同执行作用域,必须全部断开。
|
||||||
|
// 在重新渲染父子结构前直接过滤图数据,可保证入边、出边和层级变更在同一次更新中完成。
|
||||||
|
const enteringLoop = group.data.flowType === "loop" && previousParentId !== groupId;
|
||||||
|
if (enteringLoop) {
|
||||||
|
graph.edges = graph.edges.filter((edge) => (
|
||||||
|
edge.sourceNodeId !== childId && edge.targetNodeId !== childId
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
groupData.children = Array.from(new Set([...(groupData.children || []), childId]));
|
groupData.children = Array.from(new Set([...(groupData.children || []), childId]));
|
||||||
childData.properties = { ...(childData.properties || {}), parentId: groupId };
|
childData.properties = { ...(childData.properties || {}), parentId: groupId };
|
||||||
if (dropCenter) {
|
if (dropCenter) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user