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)
- 岗位管理 部门参数错误
- 角色管理 菜单分配 节点独立下的回显及提交问题
- 租户管理 套餐管理 回显时候`已选中节点`数量为0
**OTHERS**

View File

@ -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();
}
});
/**
*