Skip to content

Commit

Permalink
fix: The switch node does not display default values
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohuzhang1 committed Dec 31, 2024
1 parent 4ae21bc commit cb6d79f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
13 changes: 11 additions & 2 deletions ui/src/workflow/nodes/form-node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@
</div></template
>

<el-table class="border" v-if="form_data.form_field_list.length > 0" :data="form_data.form_field_list">
<el-table
class="border"
v-if="form_data.form_field_list.length > 0"
:data="form_data.form_field_list"
>
<el-table-column prop="field" label="参数">
<template #default="{ row }">
<span :title="row.field" class="ellipsis-1">{{ row.field }}</span>
Expand Down Expand Up @@ -84,7 +88,9 @@

<el-table-column prop="default_value" label="默认值">
<template #default="{ row }">
<span :title="row.default_value" class="ellipsis-1">{{ getDefaultValue(row) }}</span>
<span :title="row.default_value" class="ellipsis-1">{{
getDefaultValue(row)
}}</span>
</template>
</el-table-column>
<el-table-column label="必填">
Expand Down Expand Up @@ -208,6 +214,9 @@ const getDefaultValue = (row: any) => {
}
return row.default_value
}
if (row.default_value !== undefined) {
return row.default_value
}
}
const validate = () => {
Expand Down

0 comments on commit cb6d79f

Please sign in to comment.