tree数据扁平化 /** * tree数据扁平化 * 添加深度 * 添加父级节点(不能添加,只能使用父节点ID,添加echart会爆栈) */ flatTree(data, treeMap = [], depth = 0) { if (!(data && data.length)) return; depth++; return data.reduce((acc, cur) => { cur.depth = depth; acc.push(cur); if (cur.children && cur.children.length) { this.