From f5752a3cdb0b0889ef8e306065c3b2ebfdc14a43 Mon Sep 17 00:00:00 2001 From: GAOANG <1140589958@qq.com> Date: Mon, 21 Jul 2025 18:43:14 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BB=84=E7=BB=87=E6=A0=91=E5=A4=9A?= =?UTF-8?q?=E6=AC=A1=E7=82=B9=E5=87=BB=E5=90=8E=E5=B1=95=E5=BC=80=E4=B8=8B?= =?UTF-8?q?=E7=BA=A7=E6=B6=88=E5=A4=B1=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Form/src/components/SelectDepartmentTreeV2.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/Form/src/components/SelectDepartmentTreeV2.vue b/src/components/Form/src/components/SelectDepartmentTreeV2.vue index 5c0879a..256eee4 100644 --- a/src/components/Form/src/components/SelectDepartmentTreeV2.vue +++ b/src/components/Form/src/components/SelectDepartmentTreeV2.vue @@ -9,13 +9,11 @@ @search="searchDepart">
-
@@ -61,6 +59,7 @@ const selectedKeys = ref([]); const checkedKeys = ref([]); const checkable = ref(false) const treeData = ref([]) +const treeKey = ref(0) const params = ref({ id: '', code: '', @@ -109,9 +108,11 @@ function searchDepart() { async function getList(type = 'default') { if (props.parentNode) { params.value.id = props.parentNode + } let list = resetTreeList(await getQueryDeptTrees(params.value), type, true) treeData.value = list + treeKey.value++ emit('query-completed'); } function resetTreeList(list, type='default', isFirst = false) { @@ -119,14 +120,14 @@ function resetTreeList(list, type='default', isFirst = false) { expandedKeys.value = [] } const result = list.map(item => { - if(type == 'search' && item.children && item.children.length) { + if(type == 'search' && item.children && item.children.length && params.value.name) { expandedKeys.value.push(item.id) } return { ...item, ...{ key: item.id, - children: resetTreeList(item.children, type), + children: item.children.length ? resetTreeList(item.children, type) : [], title: item.name } }