请选择 进入手机版 | 继续访问电脑版

树形组件Tree使用getCheckedNodes 选择所有页节点会出现重复j?

[复制链接]
查看: 688   回复: 3     已解决

2

主题

2

回帖

2万

积分

论坛元老

Rank: 8Rank: 8

积分
24662
2023-3-21 11:34:35   显示全部楼层   阅读模式  
1、使用树形组件Tree数据在表单提交中是没有的,需要自己加进去。



      tree_unit=JSON.stringify(this.$refs.vFormRef.getWidgetRef('tree_unit').getCheckedNodes(true))
      formData.tree_unit=tree_unit


2、如果getCheckedNodes(false))选择所有节点,则会产生重复。

实际应该为:


admin已获得悬赏 200 威望

最佳答案

没有问题,返回的还是3个节点,只不过是第一个节点有children属性。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册账号

x
回复

使用道具 举报

7

主题

237

回帖

23万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
237375
2023-3-21 11:51:44   显示全部楼层  
能否截图看看这一部分treeData的具体内容?
回复

使用道具 举报

2

主题

2

回帖

2万

积分

论坛元老

Rank: 8Rank: 8

积分
24662
yinxiaodan (楼主)
2023-3-21 12:10:04   显示全部楼层  
本帖最后由 yinxiaodan 于 2023-3-21 12:11 编辑

  

[
  {
    "id": 100000017,
    "label": "宣汉县",
    "children": [
      {
        "id": 100000005,
        "label": "县级部门",
        "children": [
          {
            "id": 100000004,
            "label": "县公安局",
            "children": []
          },
          {
            "id": 100000014,
            "label": "县民政局",
            "children": []
          }
        ]
      },
      {
        "id": 100000006,
        "label": "乡镇",
        "children": [
          {
            "id": 100000015,
            "label": "东乡街道",
            "children": []
          },
          {
            "id": 100000016,
            "label": "蒲江街道",
            "children": []
          },
          {
            "id": 100000018,
            "label": "testtesttesttest",
            "children": []
          }
        ]
      },
      {
        "id": 100000007,
        "label": "企业",
        "children": [
          {
            "id": 100000003,
            "label": "宣汉移动",
            "children": []
          }
        ]
      }
    ]
  }
]

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册账号

x
回复

使用道具 举报

7

主题

237

回帖

23万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
237375
2023-3-21 13:16:22   显示全部楼层  



没有问题,返回的还是3个节点,只不过是第一个节点有children属性。


本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册账号

x
回复

使用道具 举报

您需要登录后才可以回帖   登录 注册账号

高级模式