Skip to content

Commit

Permalink
fix: 修复动态表单时间选择集无法回显
Browse files Browse the repository at this point in the history
  • Loading branch information
shaohuzhang1 committed Oct 21, 2024
1 parent a148447 commit 392a68e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ui/src/components/dynamics-form/constructor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import type { FormInstance } from 'element-plus'
const props = withDefaults(
defineProps<{
modelValue: any
input_type_list: Array<{ label: string; value: string }>
input_type_list?: Array<{ label: string; value: string }>
}>(),
{
input_type_list: () => [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</el-form-item>
<el-form-item label="格式" required>
<el-select
@change="format_change"
v-model="formValue.format"
filterable
default-first-option
Expand Down Expand Up @@ -68,6 +69,7 @@ const type_dict: any = {
}
const type_change = () => {
formValue.value.format = type_dict[formValue.value.type][0].value
formValue.value.default_value = ''
}
const props = defineProps<{
modelValue: any
Expand All @@ -85,14 +87,18 @@ const formValue = computed({
const getData = () => {
return {
input_type: 'DatePicker',
attrs: {},
attrs: {
type: formValue.value.type,
format: formValue.value.format,
'value-format': formValue.value.format
},
default_value: formValue.value.default_value
}
}
defineExpose({ getData })
onMounted(() => {
formValue.value.type = 'datetime'
formValue.value.format = 'YYYY-MM-DD HH:mm:ss'
formValue.value.type = props.modelValue.attrs?.type || 'datetime'
formValue.value.format = props.modelValue.attrs?.format || 'YYYY-MM-DD HH:mm:ss'
formValue.value.default_value = props.modelValue.default_value || ''
})
</script>
Expand Down

0 comments on commit 392a68e

Please sign in to comment.