角色分配权限

This commit is contained in:
陈红丽 2024-08-02 09:48:59 +08:00
parent 8b3d7553d3
commit c34dfa5cf8

View File

@ -71,6 +71,8 @@ const menuTree = ref<any[]>([]);
// //
const getDeptAllCheckedKeys = () => { const getDeptAllCheckedKeys = () => {
const checkedKeys = treeRef.value?.getCheckedKeys(); const checkedKeys = treeRef.value?.getCheckedKeys();
const halfCheckedKeys = treeRef.value?.getHalfCheckedKeys()!;
checkedKeys?.unshift.apply(checkedKeys, halfCheckedKeys);
return checkedKeys; return checkedKeys;
}; };
@ -109,13 +111,11 @@ const setFormData = async () => {
menuTree.value = buildTree(data); menuTree.value = buildTree(data);
menuArray.value =data; menuArray.value =data;
nextTick(()=>{ nextTick(()=>{
let ids = [];
menuArray.value.map(item=>{ menuArray.value.map(item=>{
if(item.checked){ if(item.checked){
ids.push(item.id) treeRef.value?.setChecked(item.id,true, false);
} }
}) })
treeRef.value?.setCheckedKeys(ids,true, false);
}) })
}; };