// 通过 code 反查全路径
// 参数:list: 属性数据 targetCode: 目标code fullPathList: 记录查找路径list
getFullListByCode(list, targetCode, fullPathList = []) { // fullPathList 全路径
let fullList
for (let i = 0; i < list.length; i++) {
let item = list[i]
let { code, name, childList } = item
let newfullPathList = [...fullPathList, { code, name }] // 存储上一级路径的数据
if (item.code === targetCode) {
return newfullPathList
} if (childList && childList.length) {
fullList = this.getFullListByCode(childList, targetCode, newfullPathList)
if (fullList) return tabList
}
}
return fullList
},