From 26906df48aed7bc719e398fbacd7e2a04499119c Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Mon, 21 Oct 2024 11:55:32 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=8A=A8=E6=80=81=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E6=94=B6=E9=9B=86=E6=B7=BB=E5=8A=A0=E6=97=A5=E6=9C=9F=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dynamics-form/constructor/index.vue | 32 +++--- .../items/DatePickerConstructor.vue | 99 +++++++++++++++++++ .../constructor/items/SliderConstructor.vue | 19 ++-- .../items/TextInputConstructor.vue | 24 ++++- 4 files changed, 148 insertions(+), 26 deletions(-) create mode 100644 ui/src/components/dynamics-form/constructor/items/DatePickerConstructor.vue diff --git a/ui/src/components/dynamics-form/constructor/index.vue b/ui/src/components/dynamics-form/constructor/index.vue index 41c038850..4f0f0426f 100644 --- a/ui/src/components/dynamics-form/constructor/index.vue +++ b/ui/src/components/dynamics-form/constructor/index.vue @@ -7,12 +7,12 @@ :model="form_data" v-bind="$attrs" > - - - + + + @@ -41,18 +41,25 @@ import { onMounted, ref } from 'vue' import type { FormInstance } from 'element-plus' -const props = defineProps<{ - modelValue: any -}>() +const props = withDefaults( + defineProps<{ + modelValue: any + input_type_list: Array<{ label: string; value: string }> + }>(), + { + input_type_list: () => [ + { label: '文本框', value: 'TextInputConstructor' }, + { label: '滑块', value: 'SliderConstructor' }, + { label: '开关', value: 'SwitchInputConstructor' }, + { label: '单选框', value: 'SingleSelectConstructor' }, + { label: '日期', value: 'DatePickerConstructor' } + ] + } +) const emit = defineEmits(['update:modelValue']) const ruleFormRef = ref() -const input_type_list = [ - { label: '文本框', value: 'TextInputConstructor' }, - { label: '滑块', value: 'SliderConstructor' }, - { label: '开关', value: 'SwitchInputConstructor' }, - { label: '单选框', value: 'SingleSelectConstructor' } -] + const componentFormRef = ref() const form_data = ref({ label: '', @@ -96,7 +103,6 @@ const validate = () => { onMounted(() => { if (props.modelValue) { const data = props.modelValue - // console.log(data) form_data.value = data // 处理option form_data.value.input_type = data.input_type + 'Constructor' diff --git a/ui/src/components/dynamics-form/constructor/items/DatePickerConstructor.vue b/ui/src/components/dynamics-form/constructor/items/DatePickerConstructor.vue new file mode 100644 index 000000000..ccd431d1e --- /dev/null +++ b/ui/src/components/dynamics-form/constructor/items/DatePickerConstructor.vue @@ -0,0 +1,99 @@ + + + diff --git a/ui/src/components/dynamics-form/constructor/items/SliderConstructor.vue b/ui/src/components/dynamics-form/constructor/items/SliderConstructor.vue index 974914ef3..6d6b6c3b4 100644 --- a/ui/src/components/dynamics-form/constructor/items/SliderConstructor.vue +++ b/ui/src/components/dynamics-form/constructor/items/SliderConstructor.vue @@ -1,16 +1,19 @@