fix: 修复工作流开始表单文案清空回退
- 保留标题和说明的显式空值 - 同步运行页与后端解析逻辑
This commit is contained in:
@@ -38,11 +38,14 @@ const submitLoading = ref(false);
|
||||
const startFormMeta = computed(() => {
|
||||
const meta = props.workflowParams?.startFormMeta || {};
|
||||
return {
|
||||
title: String(meta.title || '').trim() || props.workflowParams?.title || '',
|
||||
title:
|
||||
meta.title == null
|
||||
? props.workflowParams?.title || ''
|
||||
: String(meta.title).trim(),
|
||||
description:
|
||||
String(meta.description || '').trim() ||
|
||||
props.workflowParams?.description ||
|
||||
'',
|
||||
meta.description == null
|
||||
? props.workflowParams?.description || ''
|
||||
: String(meta.description).trim(),
|
||||
submitText: String(meta.submitText || '').trim() || $t('button.run'),
|
||||
};
|
||||
});
|
||||
|
||||
@@ -855,8 +855,8 @@ describe('workflow node fields', () => {
|
||||
systemReserved: true,
|
||||
});
|
||||
expect(normalized.startFormMeta).toMatchObject({
|
||||
title: '开始问答',
|
||||
description: '请先补充必要信息,再开始执行工作流。',
|
||||
title: '',
|
||||
description: '',
|
||||
submitText: '开始',
|
||||
});
|
||||
expect(normalized.parameters[0]).toMatchObject({
|
||||
|
||||
@@ -439,8 +439,9 @@ function createDefaultStartFormMeta(): StartFormMeta {
|
||||
export function normalizeStartFormMeta(meta?: Partial<StartFormMeta> | null): StartFormMeta {
|
||||
const fallback = createDefaultStartFormMeta();
|
||||
return {
|
||||
title: trimString(meta?.title) || fallback.title,
|
||||
description: trimString(meta?.description) || fallback.description,
|
||||
// Missing values use defaults; an explicit empty string means the user cleared the field.
|
||||
title: meta?.title == null ? fallback.title : trimString(meta.title),
|
||||
description: meta?.description == null ? fallback.description : trimString(meta.description),
|
||||
submitText: trimString(meta?.submitText) || fallback.submitText,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user