amis icon indicating copy to clipboard operation
amis copied to clipboard

filter 打开时提交

Open cashcn opened this issue 5 years ago • 2 comments

请问下 CRUD 中 设 filter 过滤表单 initFetch :false

有什么方法,能打开页面,马上执行filter中的提交

cashcn avatar Jun 27 '21 06:06 cashcn

submitOnInit

RickCole21 avatar Jun 28 '21 02:06 RickCole21

在 filter 下配置 submitOnInit,filter中的 表单项设置默认值 示例

{
    "type": "crud",
    "name": "crud",
    "syncLocation": false,
    "api": "https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/crud/table4",
    "filter": {
      "debug": true,
      "title": "条件搜索",
      "submitOnInit": true,
      "body": [
        {
          "type": "group",
          "body": [
            {
              "type": "input-text",
              "name": "keywords",
              "label": "关键字",
              "clearable": true,
              "placeholder": "通过关键字搜索",
              "size": "sm",
              "value": "233"
            },
            {
              "type": "input-text",
              "name": "engine",
              "label": "Engine",
              "clearable": true,
              "size": "sm"
            },
            {
              "type": "input-text",
              "name": "platform",
              "label": "Platform",
              "clearable": true,
              "size": "sm"
            }
          ]
        }
      ],
      "actions": [
        {
          "type": "button",
          "actionType": "drawer",
          "icon": "fa fa-plus",
          "label": "创建记录",
          "target": "crud",
          "closeOnOutside": true,
          "drawer": {
            "title": "创建记录",
            "body": {
              "type": "form",
              "api": "post:https://3xsw4ap8wah59.cfc-execute.bj.baidubce.com/api/amis-mock/mock2/sample",
              "body": [
                {
                  "type": "input-text",
                  "name": "engine",
                  "label": "Engine"
                },
                {
                  "type": "input-text",
                  "name": "browser",
                  "label": "Browser"
                }
              ]
            }
          }
        },
        {
          "type": "reset",
          "label": "重置"
        },
        {
          "type": "submit",
          "level": "primary",
          "label": "查询"
        }
      ]
    },
    "columns": [
      {
        "name": "id",
        "label": "ID"
      },
      {
        "name": "engine",
        "label": "Rendering engine"
      },
      {
        "name": "browser",
        "label": "Browser"
      },
      {
        "name": "platform",
        "label": "Platform(s)",
        "canAccessSuperData": false
      },
      {
        "name": "version",
        "label": "Engine version"
      },
      {
        "name": "grade",
        "label": "CSS grade"
      }
    ]
  }

CheshireJCat avatar Nov 24 '23 06:11 CheshireJCat