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组件的嵌套crud模式多选时能否支持下选中节点时不要自动把子节点自动选中 #9295

Open
yinlianghui opened this issue Jan 2, 2024 · 4 comments
Assignees
Labels
bug Something isn't working need confirm

Comments

@yinlianghui
Copy link
Contributor

描述问题:

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

截图或视频:

image

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

  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"
            }
          ]
        }
      }
    ]
  }
}

image

  1. 操作步骤

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

@github-actions github-actions bot added the bug Something isn't working label Jan 2, 2024
Copy link

github-actions bot commented Jan 2, 2024

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

Please review the labels and make any necessary changes.

@Ladtor
Copy link

Ladtor commented Mar 29, 2024

+1, 期望能提供配置

@yinlianghui yinlianghui changed the title picker组件的table模式多选时能否支持下选中节点时不要自动把子节点自动选中 picker组件的嵌套模式多选时能否支持下选中节点时不要自动把子节点自动选中 May 27, 2024
@yinlianghui yinlianghui changed the title picker组件的嵌套模式多选时能否支持下选中节点时不要自动把子节点自动选中 picker组件的嵌套crud模式多选时能否支持下选中节点时不要自动把子节点自动选中 May 27, 2024
@yinlianghui
Copy link
Contributor Author

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

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

@yinlianghui
Copy link
Contributor Author

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

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

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

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

No branches or pull requests

3 participants