// 将树形数据扁平化
export function flattenTree(tree) {
    const result = []
    
    function flatten(node) {
      if (!node) return
      
      result.push({
        id: node.id,
        name: node.name,
        parentId: node.parentId,
        avatar: node.avatar,
        relation: node.relation,
        birthDate: node.birthDate,
        phone: node.phone,
        isCurrentUser: node.isCurrentUser
      })
      
      if (Array.isArray(node.children)) {
        node.children.forEach(child => flatten(child))
      }
    }
    
    flatten(tree)
    return result
  }