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