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

crud的filter默认值从接口获取时crud初始化发接口参数有问题 #11558

Open
thinkingc opened this issue Feb 6, 2025 · 0 comments

Comments

@thinkingc
Copy link
Contributor

描述问题:

crud的filter默认值从接口获取时crud初始化发接口参数有问题,crud接口参数和form表单对应不上。

截图或视频:

Image

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

  1. 你是如何使用 amis 的?
    npm

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

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

{
  "type": "page",
  "data": {},
  "initApi": {
    "method": "get",
    "url": "https://aliyunfc-amis-mock-gmecwxibod.cn-beijing.fcapp.run/api/mock2/form/getOptions?waitSeconds=3",
    "tdata": {
      "platform": "${platform}"
    },
    "adaptor": "return ({ 'data': { 'engine': 'Gecko,Trident', 'platform': api.tdata.platform || 'Win 98+ / OSX.2+', 'engineOptions': [{label:'Blink', value:'Blink'}, {label:'Trident', value:'Trident'}, {label:'Gecko', value:'Gecko'}], 'platformOptions': [{label:'Win 95+', value:'Win 95+'}, {label:'Win XP', value:'Win XP'}, {label:'Win 98+ / OSX.2+', value:'Win 98+ / OSX.2+'}] } })"
  },
  "body": [
    {
      "type": "crud",
      "api": "https://aliyunfc-amis-mock-gmecwxibod.cn-beijing.fcapp.run/api/mock2/crud/table4",
      "syncLocation": false,
      "autoGenerateFilter": {
        "defaultExpanded": false,
        "showBtnToolbar": false
      },
      "filter": {
        "title": "",
        "data": {},
        "id": "filter-id",
        "canAccessSuperData": true,
        "body": [
          {
            "type": "group",
            "mode": "horizontal",
            "body": [
              {
                "type": "select",
                "name": "grade",
                "label": "CSS grade",
                "placeholder": "选择grade",
                "clearable": true,
                "source": "https://aliyunfc-amis-mock-gmecwxibod.cn-beijing.fcapp.run/api/mock2/form/getOptions"
              },
              {
                "type": "select",
                "name": "engine",
                "label": "engine",
                "multiple": true,
                "placeholder": "选择engine",
                "source": "${engineOptions}"
              },
              {
                "type": "select",
                "name": "platform",
                "label": "平台",
                "multiple": true,
                "placeholder": "选择平台",
                "labelField": "label",
                "valueField": "value",
                "resetValue": "Win XP",
                "source": "${platformOptions}"
              }
            ]
          }
        ],
        "actions": [
          {
            "type": "reset",
            "label": "重 置",
            "onEvent": {
              "click": {
                "actions": [
                  {
                    "actionType": "setValue",
                    "componentId": "filter-id",
                    "args": {
                      "data": {
                        "engine": "Gecko,Trident",
                        "platform": "Win 98+ / OSX.2+"
                      }
                    }
                  }
                ]
              }
            }
          },
          {
            "type": "submit",
            "level": "primary",
            "label": "查 询"
          }
        ]
      },
      "columns": [
        {
          "name": "engine",
          "label": "Rendering engine"
        },
        {
          "name": "browser",
          "label": "Browser"
        },
        {
          "name": "platform",
          "label": "Platform(s)"
        },
        {
          "name": "version",
          "label": "Engine version"
        },
        {
          "name": "grade",
          "label": "CSS grade"
        }
      ]
    }
  ]
}
  1. 操作步骤
    等waitSeconds 3s之后
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant