diff --git a/ui/src/components/dynamics-form/constructor/index.vue b/ui/src/components/dynamics-form/constructor/index.vue
index 8c3297b415d..76521fe3b2b 100644
--- a/ui/src/components/dynamics-form/constructor/index.vue
+++ b/ui/src/components/dynamics-form/constructor/index.vue
@@ -100,6 +100,7 @@ const getData = () => {
required: form_data.value.required,
field: form_data.value.field,
default_value: form_data.value.default_value,
+ show_default_value: form_data.value.show_default_value,
...componentFormRef.value.getData()
}
}
diff --git a/ui/src/components/dynamics-form/constructor/items/DatePickerConstructor.vue b/ui/src/components/dynamics-form/constructor/items/DatePickerConstructor.vue
index e370dd6a564..c22d38e5507 100644
--- a/ui/src/components/dynamics-form/constructor/items/DatePickerConstructor.vue
+++ b/ui/src/components/dynamics-form/constructor/items/DatePickerConstructor.vue
@@ -26,11 +26,16 @@
+
+
+ 默认值
+
+
+
{
format: formValue.value.format,
'value-format': formValue.value.format
},
- default_value: formValue.value.default_value
+ default_value: formValue.value.default_value,
+ show_default_value: formValue.value.show_default_value,
}
}
const rander = (form_data: any) => {
formValue.value.type = form_data.attrs.type
formValue.value.format = form_data.attrs?.format
formValue.value.default_value = form_data.default_value || ''
+ formValue.value.show_default_value = form_data.show_default_value
}
defineExpose({ getData, rander })
onBeforeMount(() => {
formValue.value.type = 'datetime'
formValue.value.format = 'YYYY-MM-DD HH:mm:ss'
formValue.value.default_value = ''
+ formValue.value.show_default_value = true
})
diff --git a/ui/src/components/dynamics-form/constructor/items/JsonInputConstructor.vue b/ui/src/components/dynamics-form/constructor/items/JsonInputConstructor.vue
index 5121bd020b1..210ebc860e1 100644
--- a/ui/src/components/dynamics-form/constructor/items/JsonInputConstructor.vue
+++ b/ui/src/components/dynamics-form/constructor/items/JsonInputConstructor.vue
@@ -1,10 +1,15 @@
+
+
+ 默认值
+
+
+
@@ -40,7 +45,8 @@ const getData = () => {
}
]
},
- default_value: formValue.value.default_value
+ default_value: formValue.value.default_value,
+ show_default_value: formValue.value.show_default_value,
}
}
@@ -55,10 +61,12 @@ const default_value_rule = {
const rander = (form_data: any) => {
formValue.value.default_value = form_data.default_value
+ formValue.value.show_default_value = form_data.show_default_value
}
defineExpose({ getData, rander })
onMounted(() => {
formValue.value.default_value = {}
+ formValue.value.show_default_value = true
})
diff --git a/ui/src/components/dynamics-form/constructor/items/MultiSelectConstructor.vue b/ui/src/components/dynamics-form/constructor/items/MultiSelectConstructor.vue
index 04fbbe9d492..5e202ba8281 100644
--- a/ui/src/components/dynamics-form/constructor/items/MultiSelectConstructor.vue
+++ b/ui/src/components/dynamics-form/constructor/items/MultiSelectConstructor.vue
@@ -46,11 +46,16 @@
+
+
+ 默认值
+
+
+
{
input_type: 'MultiSelect',
attrs: {},
default_value: formValue.value.default_value,
+ show_default_value: formValue.value.show_default_value,
text_field: 'label',
value_field: 'value',
option_list: formValue.value.option_list
@@ -111,12 +117,14 @@ const getData = () => {
const rander = (form_data: any) => {
formValue.value.option_list = form_data.option_list || []
formValue.value.default_value = form_data.default_value
+ formValue.value.show_default_value = form_data.show_default_value
}
defineExpose({ getData, rander })
onMounted(() => {
formValue.value.option_list = []
formValue.value.default_value = ''
+ formValue.value.show_default_value = true
addOption()
})
diff --git a/ui/src/components/dynamics-form/constructor/items/RadioCardConstructor.vue b/ui/src/components/dynamics-form/constructor/items/RadioCardConstructor.vue
index 1347a7a2d3f..dcf9b0f0a44 100644
--- a/ui/src/components/dynamics-form/constructor/items/RadioCardConstructor.vue
+++ b/ui/src/components/dynamics-form/constructor/items/RadioCardConstructor.vue
@@ -47,11 +47,16 @@
+
+
+ 默认值
+
+
+
{
input_type: 'RadioCard',
attrs: {},
default_value: formValue.value.default_value,
+ show_default_value: formValue.value.show_default_value,
text_field: 'label',
value_field: 'value',
option_list: formValue.value.option_list
@@ -104,12 +110,14 @@ const getData = () => {
const rander = (form_data: any) => {
formValue.value.option_list = form_data.option_list || []
formValue.value.default_value = form_data.default_value
+ formValue.value.show_default_value = form_data.show_default_value
}
defineExpose({ getData, rander })
onMounted(() => {
formValue.value.option_list = []
formValue.value.default_value = ''
+ formValue.value.show_default_value = true
addOption()
})
diff --git a/ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue b/ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue
index fb7693f56dc..6089b7b86e4 100644
--- a/ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue
+++ b/ui/src/components/dynamics-form/constructor/items/SingleSelectConstructor.vue
@@ -47,11 +47,16 @@
+
+
+ 默认值
+
+
+
{
input_type: 'SingleSelect',
attrs: {},
default_value: formValue.value.default_value,
+ show_default_value: formValue.value.show_default_value,
text_field: 'label',
value_field: 'value',
option_list: formValue.value.option_list
@@ -109,6 +115,7 @@ defineExpose({ getData, rander })
onMounted(() => {
formValue.value.option_list = []
formValue.value.default_value = ''
+ formValue.value.show_default_value = true
addOption()
})
diff --git a/ui/src/components/dynamics-form/constructor/items/TextInputConstructor.vue b/ui/src/components/dynamics-form/constructor/items/TextInputConstructor.vue
index 553cb448352..0540a95e80a 100644
--- a/ui/src/components/dynamics-form/constructor/items/TextInputConstructor.vue
+++ b/ui/src/components/dynamics-form/constructor/items/TextInputConstructor.vue
@@ -47,13 +47,18 @@
+
+
+ 默认值
+
+
+
{
'show-word-limit': true
},
default_value: formValue.value.default_value,
+ show_default_value: formValue.value.show_default_value,
props_info: {
rules: formValue.value.required
? [
@@ -153,6 +159,7 @@ onMounted(() => {
formValue.value.minlength = 0
formValue.value.maxlength = 20
formValue.value.default_value = ''
+ formValue.value.show_default_value = true
})
diff --git a/ui/src/components/dynamics-form/index.vue b/ui/src/components/dynamics-form/index.vue
index b618652b205..bd493f4a00b 100644
--- a/ui/src/components/dynamics-form/index.vue
+++ b/ui/src/components/dynamics-form/index.vue
@@ -151,6 +151,12 @@ const initDefaultData = (formField: FormField) => {
) {
formValue.value[formField.field] = formField.default_value
}
+
+ // 配置不展示默认值
+ if (!formField.show_default_value) {
+ formValue.value[formField.field] = undefined
+ console.log(formField.show_default_value, formValue.value[formField.field])
+ }
}
onBeforeMount(() => {
diff --git a/ui/src/components/dynamics-form/type.ts b/ui/src/components/dynamics-form/type.ts
index 20bb29dba25..e0da49be2f4 100644
--- a/ui/src/components/dynamics-form/type.ts
+++ b/ui/src/components/dynamics-form/type.ts
@@ -126,6 +126,10 @@ interface FormField {
* 默认值
*/
default_value?: any
+ /**
+ * 是否显示默认值
+ */
+ show_default_value?: boolean
/**
* {field:field_value_list} 表示在 field有值 ,并且值在field_value_list中才显示
*/