diff --git a/src/views/flow/components/ParamsDrawer.vue b/src/views/flow/components/ParamsDrawer.vue index d8c01c5..7b0f84f 100644 --- a/src/views/flow/components/ParamsDrawer.vue +++ b/src/views/flow/components/ParamsDrawer.vue @@ -8,7 +8,7 @@ custom-class="flow-params-drawer" :title="props.data.properties?.name || '参数配置'" class="flow-params-drawer" - size="min(560px, 92vw)" + :size="drawerSize" append-to-body destroy-on-close :close-on-click-modal="false" @@ -36,6 +36,7 @@ import HttpNodeParams from './params/HttpNodeParams.vue' import SdAgentNodeParams from './params/SdAgentNodeParams.vue' import RecognizeNodeParams from './params/RecognizeNodeParams.vue' import DeviceUniversal from './params/device_universal.vue' +import SwitchNodeParams from './params/SwitchNodeParams.vue' const props = defineProps({ drawer: Boolean, @@ -45,6 +46,13 @@ const props = defineProps({ const emits = defineEmits(['close']) const paramsComponentRef = ref(null) +/** + * 分支条件包含左值、运算符和右值三列,仅为分支节点提供更宽的编辑空间。 + */ +const drawerSize = computed(() => ( + props.data?.type === 'branch' ? 'min(920px, 96vw)' : 'min(560px, 92vw)' +)) + // 根据节点类型决定渲染哪个子组件 const currentComponent = computed(() => { const type = props.data?.type @@ -55,6 +63,7 @@ const currentComponent = computed(() => { if (type === 'sdAgent') return SdAgentNodeParams if (type === 'recognize') return RecognizeNodeParams if (type === 'device_universal') return DeviceUniversal + if (type === 'branch') return SwitchNodeParams return null }) diff --git a/src/views/flow/components/params/SwitchNodeParams.vue b/src/views/flow/components/params/SwitchNodeParams.vue new file mode 100644 index 0000000..8bb799c --- /dev/null +++ b/src/views/flow/components/params/SwitchNodeParams.vue @@ -0,0 +1,413 @@ + + + + + + diff --git a/src/views/flow/index.vue b/src/views/flow/index.vue index cbbf4fa..3f2472c 100644 --- a/src/views/flow/index.vue +++ b/src/views/flow/index.vue @@ -354,7 +354,7 @@ const drop = (e) => { } if ( - !["selectArea", "branch", "stopLoop", "subStart", "subEnd"].includes(newNode.type) + !["selectArea", "stopLoop", "subStart", "subEnd"].includes(newNode.type) ) { showParamsDrawer.value = true; paramsDrawerData.value = newNode; @@ -383,7 +383,7 @@ const handleConnect = (connection) => { */ const handleNodeDoubleClick = ({ node }) => { const data = lf.getGraphData().nodes.find((item) => item.id === node.id); - if (!data || ["selectArea", "branch", "stopLoop", "subStart", "subEnd", "end"].includes(data.type)) return; + if (!data || ["selectArea", "stopLoop", "subStart", "subEnd", "end"].includes(data.type)) return; showParamsDrawer.value = true; paramsDrawerData.value = data; }; @@ -649,8 +649,8 @@ const initFlowData = { properties: { name: "Start", action: "start", - nodeParams: [ - { name: "robotId", type: "input", input: "", disabled: true } + inputParams: [ + { name: "robotId", type: "string", input: "", disabled: true } ], }, }, diff --git a/src/views/flow/nodes/function/switch.vue b/src/views/flow/nodes/function/switch.vue index 26b4dac..8d63bb2 100644 --- a/src/views/flow/nodes/function/switch.vue +++ b/src/views/flow/nodes/function/switch.vue @@ -1,281 +1,63 @@ + + diff --git a/src/views/flow/vue-flow/FlowNode.vue b/src/views/flow/vue-flow/FlowNode.vue index cc73569..3006758 100644 --- a/src/views/flow/vue-flow/FlowNode.vue +++ b/src/views/flow/vue-flow/FlowNode.vue @@ -16,7 +16,7 @@ :is-valid-connection="isValidLoopConnection" class="flow-handle flow-handle--target" /> -
+
{ return true; }); }); + const model = computed(() => window.lf?.getNodeModelById(props.id)); /** @@ -375,4 +376,5 @@ onMounted(() => bindComponent(componentRef.value)); &--branch:hover { transform: translate(50%, -50%) scale(1.18); } } + diff --git a/src/views/flow/vue-flow/adapter.js b/src/views/flow/vue-flow/adapter.js index 9b6f9e0..68aaa69 100644 --- a/src/views/flow/vue-flow/adapter.js +++ b/src/views/flow/vue-flow/adapter.js @@ -50,12 +50,13 @@ const groupChildExtent = () => ({ * @param {*} node 当前流程节点 */ const nodeSize = (node) => { + // 分支节点采用统一的标准卡片尺寸,忽略旧流程数据中遗留的大尺寸记录。 + if (node.type === "branch") return { width: 372, height: 180 }; const width = Number(node.properties?.width || node.width); const height = Number(node.properties?.height || node.height); if (Number.isFinite(width) && Number.isFinite(height)) { return { width, height }; } - if (node.type === "branch") return { width: 748, height: 420 }; if (GROUP_TYPES.has(node.type)) return { width: 720, height: 460 }; if (TARGET_ONLY_TYPES.has(node.type) || SOURCE_ONLY_TYPES.has(node.type)) { return { width: 328, height: 120 };