From de388858f8a7174db31282342aaadd42f9d28936 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Mon, 21 Oct 2024 13:53:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E8=A1=A8=E5=8D=95=E6=97=B6=E9=97=B4=E9=80=89=E6=8B=A9=E9=9B=86?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E5=9B=9E=E6=98=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/dynamics-form/constructor/index.vue | 2 +- .../constructor/items/DatePickerConstructor.vue | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/ui/src/components/dynamics-form/constructor/index.vue b/ui/src/components/dynamics-form/constructor/index.vue index 4f0f0426f..baaa953be 100644 --- a/ui/src/components/dynamics-form/constructor/index.vue +++ b/ui/src/components/dynamics-form/constructor/index.vue @@ -44,7 +44,7 @@ import type { FormInstance } from 'element-plus' const props = withDefaults( defineProps<{ modelValue: any - input_type_list: Array<{ label: string; value: string }> + input_type_list?: Array<{ label: string; value: string }> }>(), { input_type_list: () => [ diff --git a/ui/src/components/dynamics-form/constructor/items/DatePickerConstructor.vue b/ui/src/components/dynamics-form/constructor/items/DatePickerConstructor.vue index ccd431d1e..bdf6148a5 100644 --- a/ui/src/components/dynamics-form/constructor/items/DatePickerConstructor.vue +++ b/ui/src/components/dynamics-form/constructor/items/DatePickerConstructor.vue @@ -11,6 +11,7 @@ { formValue.value.format = type_dict[formValue.value.type][0].value + formValue.value.default_value = '' } const props = defineProps<{ modelValue: any @@ -85,14 +87,18 @@ const formValue = computed({ const getData = () => { return { input_type: 'DatePicker', - attrs: {}, + attrs: { + type: formValue.value.type, + format: formValue.value.format, + 'value-format': formValue.value.format + }, default_value: formValue.value.default_value } } defineExpose({ getData }) onMounted(() => { - formValue.value.type = 'datetime' - formValue.value.format = 'YYYY-MM-DD HH:mm:ss' + formValue.value.type = props.modelValue.attrs?.type || 'datetime' + formValue.value.format = props.modelValue.attrs?.format || 'YYYY-MM-DD HH:mm:ss' formValue.value.default_value = props.modelValue.default_value || '' })