baidu / amis

前端低代码框架,通过 JSON 配置就能生成各种页面。
https://baidu.github.io/amis/
Apache License 2.0
17.43k stars 2.53k forks source link

在crud插件搜索内添加时间范围插件,清空时间只能清除startTime,endTime清除不了 #10523

Open zmm1988 opened 5 months ago

zmm1988 commented 5 months ago

描述问题:

时间范围插件先选中时间点击搜索然后点击清除在点击搜索,时间的第二个字段没有清除

截图或视频:

https://github.com/baidu/amis/assets/48378155/90f530c6-710c-42c4-9be9-33b21ed0a26d

如何复现(请务必完整填写下面内容):

  1. 你是如何使用 amis 的?

  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在

    amis@6.5.0

  3. 粘贴有问题的完整 amis schema 代码:

    {
    "type": "page",
    "title": "qwe",
    "body": [
    {
      "type": "tpl",
      "tpl": "这是你刚刚新增的页面。",
      "wrapperComponent": "",
      "inline": false,
      "id": "u:127050688e19"
    },
    {
      "id": "u:feda2575a478",
      "type": "crud2",
      "mode": "table2",
      "dsType": "api",
      "syncLocation": true,
      "selectable": true,
      "multiple": true,
      "primaryField": "id",
      "loadType": "pagination",
      "api": {
        "url": "http://172.0.0.1:8380",
        "method": "get",
        "requestAdaptor": "",
        "adaptor": "",
        "messages": {}
      },
      "filter": {
        "type": "form",
        "title": "条件查询",
        "mode": "inline",
        "columnCount": 3,
        "clearValueOnHidden": true,
        "behavior": [
          "SimpleQuery"
        ],
        "body": [
          {
            "type": "input-date-range",
            "label": "日期范围",
            "name": "startTime",
            "id": "u:5f31c8cdca70",
            "extraName": "endTime",
            "displayFormat": "YYYY-MM-DD",
            "valueFormat": "YYYY-MM-DD"
          }
        ],
        "actions": [
          {
            "type": "reset",
            "label": "重置",
            "id": "u:baf5dfc0d60c"
          },
          {
            "type": "submit",
            "label": "查询",
            "level": "primary",
            "id": "u:e55a44d859af"
          }
        ],
        "id": "u:485b65894106",
        "feat": "Insert"
      },
      "headerToolbar": [
        {
          "type": "flex",
          "direction": "row",
          "justify": "flex-start",
          "alignItems": "stretch",
          "style": {
            "position": "static"
          },
          "items": [
            {
              "type": "container",
              "align": "left",
              "behavior": [
                "Insert",
                "BulkEdit",
                "BulkDelete"
              ],
              "body": [
                {
                  "type": "button",
                  "label": "新增",
                  "level": "primary",
                  "className": "m-r-xs",
                  "behavior": "Insert",
                  "onEvent": {
                    "click": {
                      "actions": [
                        {
                          "actionType": "dialog",
                          "dialog": {
                            "body": [
                              {
                                "id": "u:2ef724bb0d01",
                                "type": "form",
                                "title": "新增数据",
                                "mode": "horizontal",
                                "dsType": "api",
                                "feat": "Insert",
                                "body": [],
                                "resetAfterSubmit": true,
                                "actions": [
                                  {
                                    "type": "button",
                                    "actionType": "cancel",
                                    "label": "取消",
                                    "id": "u:ce8ea7df69d9"
                                  },
                                  {
                                    "type": "button",
                                    "actionType": "submit",
                                    "label": "提交",
                                    "level": "primary",
                                    "id": "u:3e152feb7f66"
                                  }
                                ],
                                "onEvent": {
                                  "submitSucc": {
                                    "actions": [
                                      {
                                        "actionType": "search",
                                        "groupType": "component",
                                        "componentId": "u:feda2575a478"
                                      }
                                    ]
                                  }
                                }
                              }
                            ],
                            "title": "新增数据",
                            "size": "md",
                            "actions": [
                              {
                                "type": "button",
                                "actionType": "cancel",
                                "label": "取消",
                                "id": "u:81fa6e3b1ccc"
                              },
                              {
                                "type": "button",
                                "actionType": "submit",
                                "label": "提交",
                                "level": "primary",
                                "id": "u:b72f8b0fc9bc"
                              }
                            ],
                            "id": "u:4caa76e2f415"
                          }
                        }
                      ]
                    }
                  },
                  "id": "u:e9fc9c78bf42"
                },
                {
                  "type": "button",
                  "label": "批量编辑",
                  "className": "m-r-xs",
                  "disabledOn": "${selectedItems != null && selectedItems.length < 1}",
                  "behavior": "BulkEdit",
                  "onEvent": {
                    "click": {
                      "actions": [
                        {
                          "actionType": "dialog",
                          "dialog": {
                            "body": [
                              {
                                "id": "u:9c8dc63ad7e3",
                                "type": "form",
                                "title": "批量编辑",
                                "mode": "horizontal",
                                "dsType": "api",
                                "feat": "BulkEdit",
                                "body": [],
                                "resetAfterSubmit": true,
                                "actions": [
                                  {
                                    "type": "button",
                                    "actionType": "cancel",
                                    "label": "取消",
                                    "id": "u:19231a0af421"
                                  },
                                  {
                                    "type": "button",
                                    "actionType": "submit",
                                    "label": "提交",
                                    "level": "primary",
                                    "id": "u:99f441d401df"
                                  }
                                ],
                                "onEvent": {
                                  "submitSucc": {
                                    "actions": [
                                      {
                                        "actionType": "search",
                                        "groupType": "component",
                                        "componentId": "u:feda2575a478"
                                      }
                                    ]
                                  }
                                }
                              }
                            ],
                            "title": "批量编辑",
                            "size": "md",
                            "actions": [
                              {
                                "type": "button",
                                "actionType": "cancel",
                                "label": "取消",
                                "id": "u:e61acb9d6129"
                              },
                              {
                                "type": "button",
                                "actionType": "submit",
                                "label": "提交",
                                "level": "primary",
                                "id": "u:ef4ee1611039"
                              }
                            ],
                            "id": "u:f238f9ac6d64"
                          }
                        }
                      ]
                    }
                  },
                  "id": "u:9c7b1f1a35ce"
                },
                {
                  "type": "button",
                  "label": "批量删除",
                  "behavior": "BulkDelete",
                  "level": "danger",
                  "className": "m-r-xs",
                  "confirmText": "确认要批量删除数据「${JOIN(ARRAYMAP(selectedItems, item => item.id), ',')}」",
                  "disabledOn": "${selectedItems != null && selectedItems.length < 1}",
                  "onEvent": {
                    "click": {
                      "actions": [
                        {
                          "actionType": "ajax"
                        },
                        {
                          "actionType": "search",
                          "groupType": "component",
                          "componentId": "u:feda2575a478"
                        }
                      ]
                    }
                  },
                  "id": "u:d492c01c20f7"
                }
              ],
              "wrapperBody": false,
              "style": {
                "flexGrow": 1,
                "flex": "1 1 auto",
                "position": "static",
                "display": "flex",
                "flexBasis": "auto",
                "flexDirection": "row",
                "flexWrap": "nowrap",
                "alignItems": "stretch",
                "justifyContent": "flex-start"
              },
              "id": "u:c55d416f7b0e"
            },
            {
              "type": "container",
              "align": "right",
              "behavior": [
                "FuzzyQuery"
              ],
              "body": [],
              "wrapperBody": false,
              "style": {
                "flexGrow": 1,
                "flex": "1 1 auto",
                "position": "static",
                "display": "flex",
                "flexBasis": "auto",
                "flexDirection": "row",
                "flexWrap": "nowrap",
                "alignItems": "stretch",
                "justifyContent": "flex-end"
              },
              "id": "u:dc3a96b1bef2"
            }
          ],
          "id": "u:735e8ae0cf56"
        }
      ],
      "footerToolbar": [
        {
          "type": "flex",
          "direction": "row",
          "justify": "flex-start",
          "alignItems": "stretch",
          "style": {
            "position": "static"
          },
          "items": [
            {
              "type": "container",
              "align": "left",
              "body": [],
              "wrapperBody": false,
              "style": {
                "flexGrow": 1,
                "flex": "1 1 auto",
                "position": "static",
                "display": "flex",
                "flexBasis": "auto",
                "flexDirection": "row",
                "flexWrap": "nowrap",
                "alignItems": "stretch",
                "justifyContent": "flex-start"
              },
              "id": "u:b4d147fb4b3e"
            },
            {
              "type": "container",
              "align": "right",
              "body": [
                {
                  "type": "pagination",
                  "behavior": "Pagination",
                  "layout": [
                    "total",
                    "perPage",
                    "pager"
                  ],
                  "perPage": 10,
                  "perPageAvailable": [
                    10,
                    20,
                    50,
                    100
                  ],
                  "align": "right",
                  "id": "u:520664745b3c"
                }
              ],
              "wrapperBody": false,
              "style": {
                "flexGrow": 1,
                "flex": "1 1 auto",
                "position": "static",
                "display": "flex",
                "flexBasis": "auto",
                "flexDirection": "row",
                "flexWrap": "nowrap",
                "alignItems": "stretch",
                "justifyContent": "flex-end"
              },
              "id": "u:c1979547bdc2"
            }
          ],
          "id": "u:8ede10511d4f"
        }
      ],
      "columns": [
        {
          "type": "operation",
          "title": "操作",
          "buttons": [
            {
              "type": "button",
              "label": "查看",
              "level": "link",
              "behavior": "View",
              "onEvent": {
                "click": {
                  "actions": [
                    {
                      "actionType": "dialog",
                      "dialog": {
                        "body": [
                          {
                            "id": "u:3c9ba04136ec",
                            "type": "form",
                            "title": "查看数据",
                            "mode": "horizontal",
                            "dsType": "api",
                            "feat": "View",
                            "body": [],
                            "static": true,
                            "actions": [
                              {
                                "type": "button",
                                "actionType": "cancel",
                                "label": "关闭",
                                "id": "u:3b627fdb08ab"
                              }
                            ],
                            "onEvent": {
                              "submitSucc": {
                                "actions": [
                                  {
                                    "actionType": "search",
                                    "groupType": "component",
                                    "componentId": "u:feda2575a478"
                                  }
                                ]
                              }
                            }
                          }
                        ],
                        "title": "查看数据",
                        "size": "md",
                        "actions": [
                          {
                            "type": "button",
                            "actionType": "cancel",
                            "label": "关闭",
                            "id": "u:cb1e83b59645"
                          }
                        ],
                        "id": "u:236dc86d1f4e"
                      }
                    }
                  ]
                }
              },
              "id": "u:388368014ae7"
            },
            {
              "type": "button",
              "label": "编辑",
              "level": "link",
              "behavior": "Edit",
              "onEvent": {
                "click": {
                  "actions": [
                    {
                      "actionType": "dialog",
                      "dialog": {
                        "body": [
                          {
                            "id": "u:8921f697e771",
                            "type": "form",
                            "title": "编辑数据",
                            "mode": "horizontal",
                            "dsType": "api",
                            "feat": "Edit",
                            "body": [],
                            "resetAfterSubmit": true,
                            "actions": [
                              {
                                "type": "button",
                                "actionType": "cancel",
                                "label": "取消",
                                "id": "u:e4dcccf2bbcf"
                              },
                              {
                                "type": "button",
                                "actionType": "submit",
                                "label": "提交",
                                "level": "primary",
                                "id": "u:5c46a2a32fee"
                              }
                            ],
                            "onEvent": {
                              "submitSucc": {
                                "actions": [
                                  {
                                    "actionType": "search",
                                    "groupType": "component",
                                    "componentId": "u:feda2575a478"
                                  }
                                ]
                              }
                            }
                          }
                        ],
                        "title": "编辑数据",
                        "size": "md",
                        "actions": [
                          {
                            "type": "button",
                            "actionType": "cancel",
                            "label": "取消",
                            "id": "u:3249de29234b"
                          },
                          {
                            "type": "button",
                            "actionType": "submit",
                            "label": "提交",
                            "level": "primary",
                            "id": "u:05e7c02fca64"
                          }
                        ],
                        "id": "u:e3bc5a3eb8c1"
                      }
                    }
                  ]
                }
              },
              "id": "u:09bb45785fb3"
            },
            {
              "type": "button",
              "label": "删除",
              "behavior": "Delete",
              "className": "m-r-xs text-danger",
              "level": "link",
              "confirmText": "确认要删除数据",
              "onEvent": {
                "click": {
                  "actions": [
                    {
                      "actionType": "ajax",
                      "data": {
                        "&": "$$"
                      }
                    },
                    {
                      "actionType": "search",
                      "groupType": "component",
                      "componentId": "u:feda2575a478"
                    }
                  ]
                }
              },
              "id": "u:f0c51c6dc302"
            }
          ],
          "id": "u:a52380ef8515"
        }
      ]
    }
    ],
    "id": "u:cc62ff5deb69",
    "pullRefresh": {
    "disabled": true
    },
    "regions": [
    "body"
    ]
    }
github-actions[bot] commented 5 months ago

👍 Thanks for this! 🏷 I have applied any labels matching special text in your issue.

Please review the labels and make any necessary changes.

jackZou888 commented 2 months ago

解决了吗?我也遇到了这个问题