数组项类型 / item type
原始扁平数据数组 / original flat data array
OptionalchildrenKey: string = 'children'子节点字段名 / children field name
OptionalidKey: keyof T = ...表示节点 id 的字段名 / field name for node id
OptionalpidKey: keyof T = ...表示父节点 id 的字段名 / field name for parent id
OptionalrootPid: string | number | null = ''根节点的父 id 值(用于识别顶层节点)/ parent id value of root nodes
转换后的树数组 / tree array after conversion
将扁平数组转换为树结构
Convert a flat array into a tree structure.