fix(cmdb-ui):service tree search (#487)

This commit is contained in:
dagongren 2024-04-19 13:32:12 +08:00 committed by GitHub
parent 506dcbb40e
commit 3454a98cfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 2 deletions

View File

@ -1762,12 +1762,29 @@ export default {
}
if (node.children) {
node.children = node.children.filter((child) => {
if (predicateCiIds.some((id) => child.key.includes(String(id)))) {
if (
predicateCiIds.some(
(id) =>
child.key
.split('@^@')
.map((item) => Number(item.split('%')[0]))
.indexOf(id) > -1
)
) {
return true
}
return filterTree(child, predicate)
})
if (node.children.length && !predicateCiIds.some((id) => node.key.includes(String(id)))) {
if (
node.children.length &&
!predicateCiIds.some(
(id) =>
node.key
.split('@^@')
.map((item) => Number(item.split('%')[0]))
.indexOf(id) > -1
)
) {
_expandedKeys.push(node.key)
}
return node.children.length > 0