From b14971e79da170ac3e191880ef15d24c957ca42c Mon Sep 17 00:00:00 2001 From: CaptainB Date: Wed, 23 Oct 2024 10:26:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=97=B6=E9=BB=98=E8=AE=A4=E9=80=89=E4=B8=AD=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1047782 --user=刘瑞斌 【应用编排】-用户输入-添加参数时组件类型选择下拉选项,默认显示一个选项值 https://www.tapd.cn/57709429/s/1596098 --- .../items/SingleSelectConstructor.vue | 1 + .../items/TextInputConstructor.vue | 20 +++++++++---------- .../component/UserFieldFormDialog.vue | 10 ++++++++-- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue b/ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue index 17d52a268..48315ad6c 100644 --- a/ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue +++ b/ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue @@ -77,6 +77,7 @@ const getData = () => { } const rander = (form_data: any) => { formValue.value.option_list = form_data.option_list + formValue.value.default_value = form_data.default_value } defineExpose({ getData, rander }) diff --git a/ui/src/components/dynamics-form/constructor/items/TextInputConstructor.vue b/ui/src/components/dynamics-form/constructor/items/TextInputConstructor.vue index 1f23ad846..7ac8e86fd 100644 --- a/ui/src/components/dynamics-form/constructor/items/TextInputConstructor.vue +++ b/ui/src/components/dynamics-form/constructor/items/TextInputConstructor.vue @@ -3,7 +3,7 @@ @@ -13,7 +13,7 @@ @@ -27,8 +27,8 @@ > { return { input_type: 'TextInput', attrs: { - maxlength: formValue.value.max_length, - minlength: formValue.value.min_length, + maxlength: formValue.value.maxlength, + minlength: formValue.value.minlength, 'show-word-limit': true }, default_value: formValue.value.default_value @@ -64,14 +64,14 @@ const getData = () => { } const rander = (form_data: any) => { const attrs = form_data.attrs || {} - formValue.value.min_length = attrs.min_length - formValue.value.max_length = attrs.max_length + formValue.value.minlength = attrs.minlength + formValue.value.maxlength = attrs.maxlength formValue.value.default_value = form_data.default_value } defineExpose({ getData, rander }) onMounted(() => { - formValue.value.min_length = 0 - formValue.value.max_length = 20 + formValue.value.minlength = 0 + formValue.value.maxlength = 20 formValue.value.default_value = '' }) diff --git a/ui/src/workflow/nodes/base-node/component/UserFieldFormDialog.vue b/ui/src/workflow/nodes/base-node/component/UserFieldFormDialog.vue index ffa343917..6b3daf519 100644 --- a/ui/src/workflow/nodes/base-node/component/UserFieldFormDialog.vue +++ b/ui/src/workflow/nodes/base-node/component/UserFieldFormDialog.vue @@ -44,10 +44,11 @@ const currentRow = computed(() => { const row = currentItem.value switch (row.type) { case 'input': - if (check_field(['field', 'input_type', 'label', 'required'], currentItem.value)) { + if (check_field(['field', 'input_type', 'label', 'required', 'attrs'], currentItem.value)) { return currentItem.value } return { + attrs: row.attrs || { maxlength: 20, minlength: 0 }, field: row.field || row.variable, input_type: 'TextInput', label: row.label || row.name, @@ -64,12 +65,13 @@ const currentRow = computed(() => { return currentItem.value } return { + attrs: row.attrs || {}, field: row.field || row.variable, input_type: 'SingleSelect', label: row.label || row.name, default_value: row.default_value, required: row.required != undefined ? row.required : row.is_required, - option_list: row.optionList.map((o: any) => { + option_list: row.option_list ? row.option_list: row.optionList.map((o: any) => { return { key: o, value: o } }) } @@ -106,6 +108,8 @@ const currentRow = computed(() => { default: return currentItem.value } + } else { + return { input_type: 'TextInput', required: true, attrs: { maxlength: 20, minlength: 0 } } } }) const currentIndex = ref(null) @@ -124,6 +128,8 @@ const open = (row: any, index: any) => { isEdit.value = true currentItem.value = cloneDeep(row) currentIndex.value = index + } else { + currentItem.value = null } }