From 73acf6a3c689b0078cbc35d2af3d496346de73d6 Mon Sep 17 00:00:00 2001 From: dap <15891557205@163.com> Date: Wed, 23 Oct 2024 13:53:04 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=9F=E6=88=B7=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E5=A5=97=E9=A4=90=E7=AE=A1=E7=90=86=20=E5=9B=9E=E6=98=BE?= =?UTF-8?q?=E6=97=B6=E5=80=99`=E5=B7=B2=E9=80=89=E4=B8=AD=E8=8A=82?= =?UTF-8?q?=E7=82=B9`=E6=95=B0=E9=87=8F=E4=B8=BA0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + .../components/tree/src/tree-select-panel.vue | 37 ++++++++++--------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 125dd6d9..7ad1a62a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - VxeTable表格刷新 默认为reload 修改为在当前页刷新(query) - 岗位管理 部门参数错误 - 角色管理 菜单分配 节点独立下的回显及提交问题 +- 租户管理 套餐管理 回显时候`已选中节点`数量为0 **OTHERS** diff --git a/apps/web-antd/src/components/tree/src/tree-select-panel.vue b/apps/web-antd/src/components/tree/src/tree-select-panel.vue index 9e2e59e0..5c9a6a81 100644 --- a/apps/web-antd/src/components/tree/src/tree-select-panel.vue +++ b/apps/web-antd/src/components/tree/src/tree-select-panel.vue @@ -74,24 +74,27 @@ const checkedRealKeys = ref<(number | string)[]>([]); * 取第一次的menuTree id 设置到checkedMenuKeys * 主要为了解决没有任何修改 直接点击保存的情况 */ -const stop = watch( - () => props.treeData, - () => { - /** 节点关联情况下是不带父节点的 */ - if (props.checkStrictly) { - /** 找到父节点 添加上 */ - const parentIds = findGroupParentIds( - props.treeData, - checkedKeys.value as any, - ); - checkedRealKeys.value = [...parentIds, ...checkedKeys.value]; - } else { - /** 节点独立 这里是全部的节点 */ - checkedRealKeys.value = checkedKeys.value; - } +const stop = watch([checkedKeys, () => props.treeData], () => { + if ( + props.checkStrictly && + checkedKeys.value.length > 0 && + props.treeData.length > 0 + ) { + /** 找到父节点 添加上 */ + const parentIds = findGroupParentIds( + props.treeData, + checkedKeys.value as any, + { id: props.fieldNames.key }, + ); + checkedRealKeys.value = [...parentIds, ...checkedKeys.value]; stop(); - }, -); + } + if (!props.checkStrictly && checkedKeys.value.length > 0) { + /** 节点独立 这里是全部的节点 */ + checkedRealKeys.value = checkedKeys.value; + stop(); + } +}); /** *