/**
* @description 将树形结构的多维数组转为一维数组
* @param {array} data - 多维数组
* @param {array} arr - 存储数据
* @param {string} childKey - 需要转化的子数组key
* @returns {array} 一维数组
* @example
*/
function flatMultidimensionalArray(data, arr,childKey) { notArrayDefault(data).forEach(item => { const item_={...item}; const isChildrenExit=childKey&&item[childKey]; isChildrenExit&&delete item_[childKey]; arr.push(item_); isChildrenExit&& flatMultidimensionalArray(item[childKey], arr,childKey); }); return arr; }