baidu / amis

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

picker组件的table模式单选时无法正常选中点击的记录 #9279

Open tujiajun opened 10 months ago

tujiajun commented 10 months ago

描述问题:

1、单选时,当点击父节点,会自动选中叶子节点的最后一个,无法选中父节点 2、另外当多选时选中父节点会自动选择所有子节点,这个功能应当给予一个开关去控制,现在只能自动选中

截图或视频:

image

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

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

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

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

    {
    "type": "page",
    "data": {
    "rows": [
      {
        "engine": "Trident",
        "browser": "Internet Explorer 4.0",
        "platform": "Win 95+",
        "version": "4",
        "grade": "X",
        "id": 1,
        "children": [
          {
            "engine": "Trident",
            "browser": "Internet Explorer 4.0",
            "platform": "Win 95+",
            "version": "4",
            "grade": "X",
            "id": 1001
          },
          {
            "engine": "Trident",
            "browser": "Internet Explorer 5.0",
            "platform": "Win 95+",
            "version": "5",
            "grade": "C",
            "id": 1002
          }
        ]
      },
      {
        "engine": "Trident",
        "browser": "Internet Explorer 5.0",
        "platform": "Win 95+",
        "version": "5",
        "grade": "C",
        "id": 2,
        "children": [
          {
            "engine": "Trident",
            "browser": "Internet Explorer 4.0",
            "platform": "Win 95+",
            "version": "4",
            "grade": "X",
            "id": 2001
          },
          {
            "engine": "Trident",
            "browser": "Internet Explorer 5.0",
            "platform": "Win 95+",
            "version": "5",
            "grade": "C",
            "id": 2002
          }
        ]
      },
      {
        "engine": "Trident",
        "browser": "Internet Explorer 5.5",
        "platform": "Win 95+",
        "version": "5.5",
        "grade": "A",
        "id": 3,
        "children": [
          {
            "engine": "Trident",
            "browser": "Internet Explorer 4.0",
            "platform": "Win 95+",
            "version": "4",
            "grade": "X",
            "id": 3001
          },
          {
            "engine": "Trident",
            "browser": "Internet Explorer 5.0",
            "platform": "Win 95+",
            "version": "5",
            "grade": "C",
            "id": 3002
          }
        ]
      },
      {
        "engine": "Trident",
        "browser": "Internet Explorer 6",
        "platform": "Win 98+",
        "version": "6",
        "grade": "A",
        "id": 4,
        "children": [
          {
            "engine": "Trident",
            "browser": "Internet Explorer 4.0",
            "platform": "Win 95+",
            "version": "4",
            "grade": "X",
            "id": 4001
          },
          {
            "engine": "Trident",
            "browser": "Internet Explorer 5.0",
            "platform": "Win 95+",
            "version": "5",
            "grade": "C",
            "id": 4002
          }
        ]
      },
      {
        "engine": "Trident",
        "browser": "Internet Explorer 7",
        "platform": "Win XP SP2+",
        "version": "7",
        "grade": "A",
        "id": 5,
        "children": [
          {
            "engine": "Trident",
            "browser": "Internet Explorer 4.0",
            "platform": "Win 95+",
            "version": "4",
            "grade": "X",
            "id": 5001
          },
          {
            "engine": "Trident",
            "browser": "Internet Explorer 5.0",
            "platform": "Win 95+",
            "version": "5",
            "grade": "C",
            "id": 5002
          }
        ]
      }
    ]
    },
    "body": {
    "type": "form",
    "api": "/amis/api/mock2/form/saveForm",
    "body": [
      {
        "type": "picker",
        "name": "type4",
        "joinValues": true,
        "valueField": "id",
        "labelField": "engine",
        "label": "Picker",
        "embed": true,
        "source": "/amis/api/mock2/crud/tree?waitSeconds=1",
        "size": "lg",
        "pickerSchema": {
          "mode": "table",
          "name": "thelist",
          "quickSaveApi": "/amis/api/mock2/sample/bulkUpdate",
          "quickSaveItemApi": "/amis/api/mock2/sample/$id",
          "draggable": true,
          "headerToolbar": {
            "wrapWithPanel": false,
            "type": "form",
            "className": "text-right",
            "target": "thelist",
            "mode": "inline",
            "body": [
              {
                "type": "input-text",
                "name": "keywords",
                "addOn": {
                  "type": "submit",
                  "label": "搜索",
                  "level": "primary",
                  "icon": "fa fa-search pull-left"
                }
              }
            ]
          },
          "columns": [
            {
              "name": "engine",
              "label": "Engine"
            },
            {
              "name": "grade",
              "label": "Grade"
            },
            {
              "name": "version",
              "label": "Version"
            },
            {
              "name": "browser",
              "label": "Browser"
            },
            {
              "name": "id",
              "label": "ID"
            },
            {
              "name": "platform",
              "label": "Platform"
            }
          ]
        }
      }
    ]
    }
    }
  4. 操作步骤 先展开节点,然后点击父节点

172299478 commented 5 months ago

我也发现这个问题了, 6.0.0版本,弹出框,显示单选的树列表,有带子节点的父节点都无法选中,只能选中子节点。 请问这是代码的bug 还是 配置有问题,同样的json 在 3.4.0版本没有问题。 这个问题比较明显,不知道什么时候可以解决?谢谢