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 @@