amis picker组件的嵌套crud模式多选时能否支持下选中节点时不要自动把子节点自动选中

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

amis 3.6之前,比如amis 3.2不会选中节点时自动把子节点选中,看了下提交代码记录,是amis这边在3.5版本的时候给多选的picker功能增加了自动把子节点自动选中的能力,但是并没有提供开关来保持amis 3.2的时候的模式。

截图或视频:

如何复现(请务必完整填写下面内容):
  1. 你是如何使用 amis 的?
    sdk
  2. amis 版本是什么?请先在最新 beta 版本测试问题是否存在
    amis 3.6和6.0都存在此问题
  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",
        "multiple": true,
        "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"
            }
          ]
        }
      }
    ]
  }
}

  1. 操作步骤

bug效果如上图所示,选中任何一个有子节点的选项,会自动把其所有子节点值自动选中作为字段选择项。

zaqlnxep

zaqlnxep1#

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

Please review the labels and make any necessary changes.

xpcnnkqh

xpcnnkqh2#

+1, 期望能提供配置

xn1cxnb4

xn1cxnb43#

  • amis 6.3和6.4还是有此问题
  • 而且单选更严重,自动选中了最后一个子节点

另外嵌套懒加载模式时,在子节点已经展开和未展开两种情况下表现也不一致,前者会自动选中最后一个子节点。

pn9klfpd

pn9klfpd4#

  • amis 6.3和6.4还是有此问题
  • 而且单选更严重,自动选中了最后一个子节点

另外嵌套懒加载模式时,在子节点已经展开和未展开两种情况下表现也不一致,前者会自动选中最后一个子节点。

基于amis 6.3源码,按以下提交修改可以修正此issue提及的问题: steedos@ef8d3e3

相关问题