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