增强节点数据处理逻辑,支持整体输出选项的添加和引用字段的回显,优化 HTTP 请求体配置的参数处理。

This commit is contained in:
2026-05-29 18:07:09 +08:00
parent 542895c61c
commit b60583008b

View File

@@ -1093,6 +1093,12 @@ const availableParentParams = computed(() => {
// 如果是判断节点,跳过不添加其字段
if (isJudge) return;
// 首先添加节点的整体输出选项
params.push({
label: `${parentNodeName}【整体输出】`,
value: `\${${parentId}}`,
});
// 只添加可引用字段HTTP节点仅允许结果返回结构其他节点维持原逻辑
if (parentProps.formConfig && Array.isArray(parentProps.formConfig)) {
if (nodeCode === 'http') {
@@ -1184,15 +1190,24 @@ const workflowDsl = computed(() => ({
const rawValue = item.value;
let normalizedValue: any = rawValue;
if (typeof rawValue === 'string') {
const matched = rawValue.match(/^\$\{([^\.}]+)\.([^}]+)\}$/);
if (matched) {
normalizedValue = {
field: matched[2],
nodeId: matched[1],
quoteOutput: false,
};
}
}
const matched = rawValue.match(/^\$\{([^\.}]+)\.([^}]+)\}$/);
if (matched) {
normalizedValue = {
field: matched[2],
nodeId: matched[1],
quoteOutput: false,
};
} else {
const nodeOutputMatched = rawValue.match(/^\$\{([^}]+)\}$/);
if (nodeOutputMatched) {
normalizedValue = {
field: 'nodeOutputResult',
nodeId: nodeOutputMatched[1],
quoteOutput: false,
};
}
}
}
const normalizedItem: any = {
key: realKey,
@@ -2550,6 +2565,14 @@ const getHttpBodyData = (field: string) => {
rawItem.fieldConstraint = rawItem.fieldConstraint && typeof rawItem.fieldConstraint === 'object' ? rawItem.fieldConstraint : {};
} else {
rawItem.showInForm = false;
// 回显上级节点引用:对象结构转回选择器可识别的字符串
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) {
rawItem.value = refField === 'nodeOutputResult' ? `\${${refNodeId}}` : refField ? `\${${refNodeId}.${refField}}` : rawItem.value;
}
}
}
});
return obj;
@@ -2736,7 +2759,7 @@ const confirmHttpBodyConfig = () => {
const rawValue = item?.value;
let normalizedValue: any = rawValue;
// 如果 value 选择了上级参数(形如 ${nodeId.field}),转成对象结构传给后端
// 如果 value 选择了上级参数(形如 ${nodeId.field}或上级节点整体输出(形如 ${nodeId},转成对象结构传给后端
if (typeof rawValue === 'string') {
const matched = rawValue.match(/^\$\{([^\.}]+)\.([^}]+)\}$/);
if (matched) {
@@ -2745,6 +2768,15 @@ const confirmHttpBodyConfig = () => {
nodeId: matched[1],
quoteOutput: false,
};
} else {
const nodeOutputMatched = rawValue.match(/^\$\{([^}]+)\}$/);
if (nodeOutputMatched) {
normalizedValue = {
field: 'nodeOutputResult',
nodeId: nodeOutputMatched[1],
quoteOutput: false,
};
}
}
}
@@ -5622,3 +5654,4 @@ onBeforeUnmount(() => {
justify-content: center;
}
</style>