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

picker设置了默认值时的bug #11627

Open
BrentHuang opened this issue Feb 18, 2025 · 2 comments
Open

picker设置了默认值时的bug #11627

BrentHuang opened this issue Feb 18, 2025 · 2 comments
Labels
bug Something isn't working feat need confirm

Comments

@BrentHuang
Copy link

amis 6.10.0

编辑设备按钮,点击弹出“编辑设备”对话框,对话框中放一个form表单,form表单中放一个picker(用于选择已有的设备组,source配置为接口,分页拉取设备组)

{
  "type": "page",
  "id": "u:35f5d256a94d",
  "asideResizor": false,
  "pullRefresh": {
    "disabled": true
  },
  "regions": [
    "body"
  ],
  "body": [
    {
      "type": "button",
      "label": "编辑",
      "onEvent": {
        "click": {
          "actions": [
            {
              "ignoreError": false,
              "actionType": "dialog",
              "dialog": {
                "type": "dialog",
                "title": "编辑设备",
                "body": [
                  {
                    "id": "u:a0b36d55d540",
                    "type": "form",
                    "title": "表单",
                    "mode": "flex",
                    "labelAlign": "left",
                    "dsType": "api",
                    "feat": "Edit",
                    "body": [
                      {
                        "type": "picker",
                        "label": "设备组",
                        "name": "group_id",
                        "overflowConfig": {
                          "maxTagCount": -1
                        },
                        "modalClassName": "app-popover :AMISCSSWrapper",
                        "id": "u:f831f83ee73b",
                        "multiple": false,
                        "value": "${\"abc\"}",
                        "source": {
                          "method": "post",
                          "url": "http://localhost:8000/api/v1/devices/group/list?page=${page}&size=${perPage}",
                          "requestAdaptor": "",
                          "adaptor": "",
                          "messages": {},
                          "dataType": "json"
                        },
                        "labelField": "name",
                        "valueField": "id"
                      }
                    ],
                    "api": {
                      "url": "http://localhost:8000//api/v1/devices/update/1",
                      "method": "get"
                    },
                    "actions": [
                      {
                        "type": "button",
                        "label": "提交",
                        "onEvent": {
                          "click": {
                            "actions": [
                              {
                                "actionType": "submit",
                                "componentId": "u:a0b36d55d540"
                              }
                            ]
                          }
                        },
                        "level": "primary"
                      }
                    ],
                    "resetAfterSubmit": true,
                    "initApi": ""
                  }
                ],
                "id": "u:7795f12070d5",
                "actions": [
                  {
                    "type": "button",
                    "actionType": "cancel",
                    "label": "取消",
                    "id": "u:5080f7523d0a"
                  },
                  {
                    "type": "button",
                    "actionType": "confirm",
                    "label": "确定",
                    "primary": true,
                    "id": "u:392fc5786caa"
                  }
                ],
                "showCloseButton": true,
                "closeOnOutside": false,
                "closeOnEsc": false,
                "showErrorMsg": true,
                "showLoading": true,
                "draggable": false,
                "actionType": "dialog"
              }
            }
          ]
        }
      },
      "id": "u:cdf66fba427e"
    }
  ],
  "definitions": {}
}

问题:当picker的value有值时,点击编辑按钮打开对话框时,会执行picker配置的source分页拉取接口,但是传给接口的page、perPage为空。当picker的value未设置时,点击编辑按钮打开对话框时,不会执行picker配置的source分页拉取接口。

期望:不管picker的value有没有值,点击编辑按钮打开对话框时,都不需要执行picker配置的source分页拉取接口。

@github-actions github-actions bot added bug Something isn't working feat labels Feb 18, 2025
Copy link

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

Please review the labels and make any necessary changes.

@BrentHuang BrentHuang changed the title picker设置了默认值的bug picker设置了默认值时的bug Feb 18, 2025
@BrentHuang
Copy link
Author

@2betop 请看一下这个问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feat need confirm
Projects
None yet
Development

No branches or pull requests

1 participant