原始的数据是平铺的比如originalData:[{company:'AAA',department:'AAA-D1',office:'AAA-D1-O1',pass:1,onhold:3},{company:'AAA',department:'AAA-D1',office:'AAA-D1-O2',pass:3,onhold:5},{company:'AAA',department:'AAA-D2',office:'AAA-D2-O1',pass:2,onhold:7},{company:'BBB',department:'BBB-D1',office:'BBB-D1-O1',pass:1,onhold:3},{company:'BBB',department:'BBB-D2',office:'BBB-D2-O1',pass:4,onhold:3},{company:'BBB',department:'BBB-D3',office:'BBB-D3-O1',pass:1,onhold:3},........]希望转换成treeData:[{label:'AAA',department:'AAA-D1',office:'AAA-D1-O1',pass:6,onhold:15,//companylevelchildren:[//departmentlevel{label:'AAA-D1',pass:4,onhold:8,children:[//officelevel{label:'AAA-D1-O1',pass:1,onhold:3},{label:'AAA-D1-O2',pass:1,onhold:3},]},{label:'AAA-D2',pass:2,onhold:7,children:[{label:'AAA-D2-O1',pass:1,onhold:3},]},]},......]根据指定的列转换成父子结构的数据比如上面的是根据['company','department','office']不知道怎么写了请大神指导:(:(:(:(:(
慕婉清6462132
跃然一笑
相关分类