Pre Merge pull request !523 from 口口口/N/A
commit
68693ce42d
|
|
@ -374,6 +374,7 @@ export const treeToString = (tree: any[], nodeId) => {
|
|||
return node.name
|
||||
}
|
||||
let str = ''
|
||||
let list = <any[]>[]
|
||||
|
||||
function performAThoroughValidation(arr) {
|
||||
if (typeof arr === 'undefined' || !Array.isArray(arr) || arr.length === 0) {
|
||||
|
|
@ -381,11 +382,13 @@ export const treeToString = (tree: any[], nodeId) => {
|
|||
}
|
||||
for (const item of arr) {
|
||||
if (item.id === nodeId) {
|
||||
str += ` / ${item.name}`
|
||||
list.push(item.name)
|
||||
// str += ` / ${item.name}`
|
||||
return true
|
||||
} else if (typeof item.children !== 'undefined' && item.children.length !== 0) {
|
||||
str += ` / ${item.name}`
|
||||
// str += ` / ${item.name}`
|
||||
if (performAThoroughValidation(item.children)) {
|
||||
list.push(item.name)
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
|
@ -394,10 +397,16 @@ export const treeToString = (tree: any[], nodeId) => {
|
|||
}
|
||||
|
||||
for (const item of tree) {
|
||||
list = []
|
||||
str = `${item.name}`
|
||||
if (performAThoroughValidation(item.children)) {
|
||||
break
|
||||
}
|
||||
}
|
||||
if (list.length > 0) {
|
||||
list.reverse().forEach((name) => {
|
||||
str += ` / ${name}`
|
||||
})
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue