From cb6d79fad28ddb9353a8969bf1ceb72e54af5931 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Tue, 31 Dec 2024 16:36:59 +0800 Subject: [PATCH] fix: The switch node does not display default values --- .../base-node/component/UserInputFieldTable.vue | 10 +++++++--- ui/src/workflow/nodes/form-node/index.vue | 13 +++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/ui/src/workflow/nodes/base-node/component/UserInputFieldTable.vue b/ui/src/workflow/nodes/base-node/component/UserInputFieldTable.vue index cea5dbd0ce5..b2113766ddd 100644 --- a/ui/src/workflow/nodes/base-node/component/UserInputFieldTable.vue +++ b/ui/src/workflow/nodes/base-node/component/UserInputFieldTable.vue @@ -128,16 +128,20 @@ function refreshFieldList(data: any, index: any) { const getDefaultValue = (row: any) => { if (row.default_value) { - const default_value = row.option_list?.filter((v: any) => row.default_value.indexOf(v.value) > -1) - .map((v: any) => v.label).join(',') + const default_value = row.option_list + ?.filter((v: any) => row.default_value.indexOf(v.value) > -1) + .map((v: any) => v.label) + .join(',') if (default_value) { return default_value } return row.default_value } + if (row.default_value !== undefined) { + return row.default_value + } } - onMounted(() => { if (!props.nodeModel.properties.user_input_field_list) { if (props.nodeModel.properties.input_field_list) { diff --git a/ui/src/workflow/nodes/form-node/index.vue b/ui/src/workflow/nodes/form-node/index.vue index 544e755e3fb..7ee19f1e443 100644 --- a/ui/src/workflow/nodes/form-node/index.vue +++ b/ui/src/workflow/nodes/form-node/index.vue @@ -53,7 +53,11 @@ - +