amis table2 简单查询,表单项动态拉取并设置默认值,重置清空了表单

jdzmm42g  于 5个月前  发布在  其他
关注(0)|答案(1)|浏览(130)
描述问题:

table2 开启简单查询,表单项动态拉取并设置默认值时,首次点击重置按钮,表单项被清空,再次点击重置,表单项恢复默认值

截图或视频:

如何复现(请务必完整填写下面内容):
  1. 你是如何使用 amis 的?
    npm
  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在
    6.7.0
  3. 粘贴有问题的完整 amis schema 代码:
{
  "type": "crud2",
  "id": "u:d3aefb919010",
  "mode": "table2",
  "dsType": "api",
  "syncLocation": true,
  "primaryField": "id",
  "loadType": "pagination",
  "api": {
    "url": "https://aisuda.bce.baidu.com/amis/api/sample?perPage=5",
    "method": "get"
  },
  "filter": {
    "type": "form",
    "title": "条件查询",
    "mode": "inline",
    "columnCount": 3,
    "clearValueOnHidden": true,
    "behavior": [
      "SimpleQuery"
    ],
    "body": [
      {
        "name": "engine",
        "label": "engine",
        "type": "input-text",
        "size": "full",
        "required": false,
        "behavior": "SimpleQuery",
        "id": "u:202eec61ad6f"
      },
      {
        "name": "browser",
        "label": "browser",
        "type": "input-text",
        "size": "full",
        "required": false,
        "behavior": "SimpleQuery",
        "id": "u:da9a3aa5fd9f"
      },
      {
        "name": "platform",
        "label": "platform",
        "type": "input-text",
        "size": "full",
        "required": false,
        "behavior": "SimpleQuery",
        "id": "u:e6bebc7def32"
      },
      {
        "name": "version",
        "label": "version",
        "type": "input-text",
        "size": "full",
        "required": false,
        "behavior": "SimpleQuery",
        "id": "u:835067b62a74"
      },
      {
        "name": "grade",
        "label": "grade",
        "type": "input-text",
        "size": "full",
        "required": false,
        "behavior": "SimpleQuery",
        "id": "u:adff23926ada"
      },
      {
        "name": "badgeText",
        "label": "badgeText",
        "type": "input-text",
        "size": "full",
        "required": false,
        "behavior": "SimpleQuery",
        "id": "u:94fc50a76b79"
      },
      {
        "name": "id",
        "label": "id",
        "type": "input-number",
        "size": "full",
        "required": false,
        "behavior": "SimpleQuery",
        "id": "u:00dfd4e980f5",
        "keyboard": true,
        "step": 1
      },
      {
        "type": "select",
        "label": "选项",
        "name": "select",
        "id": "u:1365a89eb070",
        "multiple": false,
        "source": {
          "method": "get",
          "url": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/form/getOptions",
          "requestAdaptor": "",
          "adaptor": "// response.data.value = response.data[2].value\r\n// console.log(response)\r\n// const { options } = response?.data\r\n// if (response?.data?.data) {\r\n//   response.data.data.value = response.data.data[2].value\r\n// }\r\nconst { data, ...rest } = response.data\r\nreturn {\r\n  ...rest,\r\n  data: {\r\n    options: data.options,\r\n    value: data.options[5].value\r\n  }\r\n}",
          "messages": {}
        }
      }
    ],
    "actions": [
      {
        "type": "reset",
        "label": "重置",
        "id": "u:836e08e22273"
      },
      {
        "type": "submit",
        "label": "查询",
        "level": "primary",
        "id": "u:b4736f56af22"
      }
    ],
    "id": "u:288535b04ab5",
    "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": [],
          "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:912e73d521dd"
        },
        {
          "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:7c36349e8e08"
        }
      ],
      "id": "u:ead25028c806"
    }
  ],
  "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:0032457a2ad1"
        },
        {
          "type": "container",
          "align": "right",
          "body": [
            {
              "type": "pagination",
              "behavior": "Pagination",
              "layout": [
                "total",
                "perPage",
                "pager"
              ],
              "perPage": 10,
              "perPageAvailable": [
                10,
                20,
                50,
                100
              ],
              "align": "right",
              "id": "u:997da85ad1ba"
            }
          ],
          "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:8127f8079144"
        }
      ],
      "id": "u:7f086d995528"
    }
  ],
  "columns": [
    {
      "type": "tpl",
      "title": "engine",
      "name": "engine",
      "id": "u:72c63d33a0b9"
    },
    {
      "type": "tpl",
      "title": "browser",
      "name": "browser",
      "id": "u:197495573e86"
    },
    {
      "type": "tpl",
      "title": "platform",
      "name": "platform",
      "id": "u:89379a830665"
    },
    {
      "type": "tpl",
      "title": "version",
      "name": "version",
      "id": "u:0bf3dc5af714"
    },
    {
      "type": "tpl",
      "title": "grade",
      "name": "grade",
      "id": "u:33b53be1b6cb"
    },
    {
      "type": "tpl",
      "title": "badgeText",
      "name": "badgeText",
      "id": "u:c431b01b4e6e"
    },
    {
      "type": "tpl",
      "title": "id",
      "name": "id",
      "id": "u:032801ba1487"
    }
  ],
  "editorSetting": {
    "mock": {
      "enable": true,
      "maxDisplayRows": 5
    }
  }
}
  1. 操作步骤
    见上图,操作,首次点击重置,表单项被清空,再次点击表单项恢复默认值
pjngdqdw

pjngdqdw1#

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

Please review the labels and make any necessary changes.

相关问题