vxe-table中树形结构

如图,同事让帮忙实现一个需求

vxe-table中树形结构_第1张图片

 从二级树节点开始,同时选中的只能有一个二级树节点,选中的二级树节点之下的子节点都可以被选中。否则不能被选中

直接上代码

需要注意的是,文中树状图传递的数据是打平的数据,设置代码是下图,而不是树状图!!

:tree-config="{transform: true, rowField: 'cguid', parentField: 'cparentid'}" 

 上述的这一点非常重要

下面的全乎的数据图





  
  
  
  
  
  
  
  
  
  



  
1:删除 2:节点禁用 3:筛选

json打平的数据结构是

const dataList = [
    {
        "cguid": "5422",
        "ccode": "01",
        "cname": "01 资产",
        "cparentid": "000000",
        "ileaf": "0"
    },
    {
        "cguid": "70",
        "ccode": "1004",
        "cname": "1004 汇总科目",
        "cparentid": "5422",
        "ileaf": "0"
    },
    {
        "cguid": "78",
        "ccode": "100401",
        "cname": "100401 汇总科目1",
        "cparentid": "70",
        "ileaf": "1"
    },
    {
        "cguid": "95",
        "ccode": "100402",
        "cname": "100402 汇总科目2",
        "cparentid": "70",
        "ileaf": "1"
    },
    {
        "cguid": "47",
        "ccode": "100403",
        "cname": "100403 汇总科目3",
        "cparentid": "70",
        "ileaf": "1"
    },
    {
        "cguid": "87",
        "ccode": "100404",
        "cname": "100404 汇总科目4",
        "cparentid": "70",
        "ileaf": "0"
    },
    {
        "cguid": "97",
        "ccode": "10040401",
        "cname": "10040401 汇总科目4-1",
        "cparentid": "87",
        "ileaf": "1"
    },
    {
        "cguid": "41",
        "ccode": "90000201",
        "cname": "90000201 B2c1",
        "cparentid": "31",
        "ileaf": "1"
    },
    {
        "cguid": "77",
        "ccode": "90000202",
        "cname": "90000202 B2c2",
        "cparentid": "31",
        "ileaf": "1"
    },
    {
        "cguid": "428",
        "ccode": "1001",
        "cname": "1001 库xxx",
        "cparentid": "422",
        "ileaf": "1"
    },
    {
        "cguid": "430",
        "ccode": "1002",
        "cname": "1002 银xxx",
        "cparentid": "422",
        "ileaf": "1"
    },
    
]

你可能感兴趣的:(arcgis,javascript,html)