fix: 租户管理 套餐管理 回显时候已选中节点数量为0

This commit is contained in:
dap 2024-10-23 13:53:04 +08:00
parent a38fc307d0
commit 73acf6a3c6
2 changed files with 21 additions and 17 deletions

View File

@ -19,6 +19,7 @@
- VxeTable表格刷新 默认为reload 修改为在当前页刷新(query) - VxeTable表格刷新 默认为reload 修改为在当前页刷新(query)
- 岗位管理 部门参数错误 - 岗位管理 部门参数错误
- 角色管理 菜单分配 节点独立下的回显及提交问题 - 角色管理 菜单分配 节点独立下的回显及提交问题
- 租户管理 套餐管理 回显时候`已选中节点`数量为0
**OTHERS** **OTHERS**

View File

@ -74,24 +74,27 @@ const checkedRealKeys = ref<(number | string)[]>([]);
* 取第一次的menuTree id 设置到checkedMenuKeys * 取第一次的menuTree id 设置到checkedMenuKeys
* 主要为了解决没有任何修改 直接点击保存的情况 * 主要为了解决没有任何修改 直接点击保存的情况
*/ */
const stop = watch( const stop = watch([checkedKeys, () => props.treeData], () => {
() => props.treeData, if (
() => { props.checkStrictly &&
/** 节点关联情况下是不带父节点的 */ checkedKeys.value.length > 0 &&
if (props.checkStrictly) { props.treeData.length > 0
/** 找到父节点 添加上 */ ) {
const parentIds = findGroupParentIds( /** 找到父节点 添加上 */
props.treeData, const parentIds = findGroupParentIds(
checkedKeys.value as any, props.treeData,
); checkedKeys.value as any,
checkedRealKeys.value = [...parentIds, ...checkedKeys.value]; { id: props.fieldNames.key },
} else { );
/** 节点独立 这里是全部的节点 */ checkedRealKeys.value = [...parentIds, ...checkedKeys.value];
checkedRealKeys.value = checkedKeys.value;
}
stop(); stop();
}, }
); if (!props.checkStrictly && checkedKeys.value.length > 0) {
/** 节点独立 这里是全部的节点 */
checkedRealKeys.value = checkedKeys.value;
stop();
}
});
/** /**
* *