diff --git a/src/views/settings/creation/index.vue b/src/views/settings/creation/index.vue index 80656c9..4b9f31f 100644 --- a/src/views/settings/creation/index.vue +++ b/src/views/settings/creation/index.vue @@ -734,10 +734,15 @@ allow-create default-first-option clearable - placeholder="值(可手动输入或选择上级参数)" + placeholder="值(可手动输入或选择上级字段)" class="w100" > - + @@ -1183,6 +1188,32 @@ const availableParentParams = computed(() => { return params; }); +const availableParentFieldParams = computed(() => + availableParentParams.value.filter((item) => { + const value = String(item.value || '').trim(); + const label = String(item.label || '').trim(); + return value !== '${}' && !value.endsWith('.nodeOutputResult}') && !label.endsWith('.输出结果'); + }) +); +const getReferenceDisplayLabel = (value: string) => { + const formatted = formatParamReference(value); + return formatted === value ? value : formatted; +}; +const getHttpBodyReferenceOptions = (currentValue?: string) => { + const options = [...availableParentFieldParams.value]; + const normalizedValue = String(currentValue || '').trim(); + if (!normalizedValue) return options; + if (options.some((item) => item.value === normalizedValue)) return options; + const isReferenceValue = /^\$\{[^.}]+\.[^}]+\}$/.test(normalizedValue); + if (!isReferenceValue) return options; + return [ + ...options, + { + label: getReferenceDisplayLabel(normalizedValue), + value: normalizedValue, + }, + ]; +}; const treeProps = { children: 'children', label: 'label' }; const apiBaseUrl = (import.meta.env.VITE_API_URL || '').replace(/\/$/, ''); const nodeLibraryGroups = ref([]); @@ -2649,11 +2680,9 @@ const getHttpBodyData = (field: string) => { if (rawItem.value && typeof rawItem.value === 'object' && !Array.isArray(rawItem.value)) { const refNodeId = String(rawItem.value.nodeId || '').trim(); const refField = String(rawItem.value.field || '').trim(); - if (refNodeId) { - if (refField) { + if (refNodeId && refField) { rawItem.value = `\${${refNodeId}.${refField}}`; } - } } } });