Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: the value was not cleared correctly when cleaning the range picker #4904

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions packages/@core/ui-kit/form-ui/src/components/form-actions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@ function handleRangeTimeValue(values: Record<string, any>) {

fieldMappingTime.forEach(
([field, [startTimeKey, endTimeKey], format = 'YYYY-MM-DD']) => {
/**
* 时间字段为空 但是映射的start/end不为空 说明已经清理了组件的时间(组件右边的x)
* 需要删除对应的start/end字段 否则会被保留
*/
if (!values[field] && values[startTimeKey] && values[endTimeKey]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

你这样改会有别的bug,这样在选了开始时间和结束时间之后,不改变值连续点击提交,会把原先选择的值删掉。
如下图:
image

delete values[startTimeKey];
delete values[endTimeKey];
return;
}
vince292007 marked this conversation as resolved.
Show resolved Hide resolved

if (!values[field]) {
delete values[field];
return;
Expand Down