From 46a4622aa224c4b98ec7d1e5633ad7b045fd4e41 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Fri, 15 Nov 2024 16:05:52 +0800 Subject: [PATCH] fix: the value was not cleared correctly when cleaning the range picker --- .../ui-kit/form-ui/src/components/form-actions.vue | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/@core/ui-kit/form-ui/src/components/form-actions.vue b/packages/@core/ui-kit/form-ui/src/components/form-actions.vue index 0a713567fa1..e17685212d7 100644 --- a/packages/@core/ui-kit/form-ui/src/components/form-actions.vue +++ b/packages/@core/ui-kit/form-ui/src/components/form-actions.vue @@ -91,6 +91,16 @@ function handleRangeTimeValue(values: Record) { fieldMappingTime.forEach( ([field, [startTimeKey, endTimeKey], format = 'YYYY-MM-DD']) => { + /** + * 时间字段为空 但是映射的start/end不为空 说明已经清理了组件的时间(组件右边的x) + * 需要删除对应的start/end字段 否则会被保留 + */ + if (!values[field] && values[startTimeKey] && values[endTimeKey]) { + delete values[startTimeKey]; + delete values[endTimeKey]; + return; + } + if (!values[field]) { delete values[field]; return;