From 6b16d393c71e36f0a10061049f50e0497296b40b Mon Sep 17 00:00:00 2001 From: songlh Date: Tue, 12 Nov 2024 10:58:09 +0800 Subject: [PATCH] fix(ui): ipam - filter search value error --- .../src/components/CMDBFilterComp/expression.vue | 14 +++++++++----- .../cmdb/views/ipam/components/ipamTree.vue | 3 ++- cmdb-ui/src/modules/cmdb/views/ipam/index.vue | 1 + 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/cmdb-ui/src/components/CMDBFilterComp/expression.vue b/cmdb-ui/src/components/CMDBFilterComp/expression.vue index 2520604..3facb3a 100644 --- a/cmdb-ui/src/components/CMDBFilterComp/expression.vue +++ b/cmdb-ui/src/components/CMDBFilterComp/expression.vue @@ -139,9 +139,9 @@ :normalizer=" (node) => { return { - id: String(node[0] || ''), - label: node[1] ? node[1].label || node[0] : node[0], - children: node.children && node.children.length ? node.children : undefined, + id: node.id, + label: node.label, + children: node.children, } } " @@ -352,8 +352,12 @@ export default { }, getChoiceValueByProperty(property) { const _find = this.canSearchPreferenceAttrList.find((item) => item.name === property) - if (_find) { - return _find.choice_value + if (_find?.choice_value?.length) { + return _find.choice_value.map((node) => ({ + id: String(node?.[0] ?? ''), + label: node?.[1]?.label || node?.[0] || '', + children: node?.children?.length ? node.children : undefined + })) } return [] }, diff --git a/cmdb-ui/src/modules/cmdb/views/ipam/components/ipamTree.vue b/cmdb-ui/src/modules/cmdb/views/ipam/components/ipamTree.vue index d5bfdf1..e2c3787 100644 --- a/cmdb-ui/src/modules/cmdb/views/ipam/components/ipamTree.vue +++ b/cmdb-ui/src/modules/cmdb/views/ipam/components/ipamTree.vue @@ -9,6 +9,7 @@
li:first-child { + .ipam-tree-node-all { .ant-tree-switcher { display: none; } diff --git a/cmdb-ui/src/modules/cmdb/views/ipam/index.vue b/cmdb-ui/src/modules/cmdb/views/ipam/index.vue index fc75476..de6fc13 100644 --- a/cmdb-ui/src/modules/cmdb/views/ipam/index.vue +++ b/cmdb-ui/src/modules/cmdb/views/ipam/index.vue @@ -185,6 +185,7 @@ export default { showCatalogBtn: rootShowCatalogBtn, showSubnetBtn: rootShowSubnetBtn, parentId: '', + class: 'ipam-tree-node-all' }) this.treeData = treeData