From a7b85143a18a911934dc614f244bc3457345f9c4 Mon Sep 17 00:00:00 2001 From: shaohuzhang1 Date: Mon, 28 Oct 2024 12:09:17 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E8=A1=A8=E5=8D=95?= =?UTF-8?q?=E6=9E=84=E9=80=A0=E5=99=A8=E7=9B=B8=E5=85=B3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dynamics-form/constructor/data.ts | 27 +++++ .../dynamics-form/constructor/index.vue | 11 +- .../items/DatePickerConstructor.vue | 6 +- .../items/JsonInputConstructor.vue | 1 - .../items/SingleSelectConstructor.vue | 10 +- .../constructor/items/SliderConstructor.vue | 54 +++++++-- .../items/SwitchInputConstructor.vue | 2 +- .../items/TextInputConstructor.vue | 110 +++++++++++++++--- .../template/component/AddParamDrawer.vue | 14 ++- .../template/component/ParamSettingDialog.vue | 66 +++++------ 10 files changed, 217 insertions(+), 84 deletions(-) create mode 100644 ui/src/components/dynamics-form/constructor/data.ts diff --git a/ui/src/components/dynamics-form/constructor/data.ts b/ui/src/components/dynamics-form/constructor/data.ts new file mode 100644 index 000000000..ff100fa06 --- /dev/null +++ b/ui/src/components/dynamics-form/constructor/data.ts @@ -0,0 +1,27 @@ +const input_type_list = [ + { + label: '文本框', + value: 'TextInput' + }, + { + label: '滑块', + value: 'Slider' + }, + { + label: '开关', + value: 'SwitchInput' + }, + { + label: '单选框', + value: 'SingleSelect' + }, + { + label: '日期', + value: 'DatePicker' + }, + { + label: 'JSON文本框', + value: 'JsonInput' + } +] +export { input_type_list } diff --git a/ui/src/components/dynamics-form/constructor/index.vue b/ui/src/components/dynamics-form/constructor/index.vue index 42310516a..5b1ade7dd 100644 --- a/ui/src/components/dynamics-form/constructor/index.vue +++ b/ui/src/components/dynamics-form/constructor/index.vue @@ -41,20 +41,15 @@ import { onMounted, ref, nextTick } from 'vue' import type { FormInstance } from 'element-plus' import _ from 'lodash' +import { input_type_list as input_type_list_data } from '@/components/dynamics-form/constructor/data' 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' }, - { label: 'JSON文本框', value: 'JsonInputConstructor' } - ] + input_type_list: () => + input_type_list_data.map((item) => ({ label: item.label, value: item.value + 'Constructor' })) } ) const emit = defineEmits(['update:modelValue']) diff --git a/ui/src/components/dynamics-form/constructor/items/DatePickerConstructor.vue b/ui/src/components/dynamics-form/constructor/items/DatePickerConstructor.vue index 44d1f91d4..e370dd6a5 100644 --- a/ui/src/components/dynamics-form/constructor/items/DatePickerConstructor.vue +++ b/ui/src/components/dynamics-form/constructor/items/DatePickerConstructor.vue @@ -41,7 +41,7 @@ diff --git a/ui/src/components/dynamics-form/constructor/items/SwitchInputConstructor.vue b/ui/src/components/dynamics-form/constructor/items/SwitchInputConstructor.vue index 80ba8dbc0..92a52a021 100644 --- a/ui/src/components/dynamics-form/constructor/items/SwitchInputConstructor.vue +++ b/ui/src/components/dynamics-form/constructor/items/SwitchInputConstructor.vue @@ -33,7 +33,7 @@ const getData = () => { } const rander = (form_data: any) => { - formValue.value.default_value = form_data.default_value + formValue.value.default_value = form_data.default_value || false } defineExpose({ getData, rander }) onMounted(() => { diff --git a/ui/src/components/dynamics-form/constructor/items/TextInputConstructor.vue b/ui/src/components/dynamics-form/constructor/items/TextInputConstructor.vue index 7ac8e86fd..553cb4483 100644 --- a/ui/src/components/dynamics-form/constructor/items/TextInputConstructor.vue +++ b/ui/src/components/dynamics-form/constructor/items/TextInputConstructor.vue @@ -1,21 +1,48 @@ - - \ No newline at end of file + diff --git a/ui/src/views/template/component/ParamSettingDialog.vue b/ui/src/views/template/component/ParamSettingDialog.vue index ecebbc567..df60d0170 100644 --- a/ui/src/views/template/component/ParamSettingDialog.vue +++ b/ui/src/views/template/component/ParamSettingDialog.vue @@ -8,26 +8,22 @@ :destroy-on-close="true" :before-close="close" > - - 添加参数 - - + 添加参数 + - + @@ -41,13 +37,13 @@