|
@@ -22,6 +22,8 @@
|
|
|
<!-- 分配菜单弹窗 -->
|
|
|
<el-dialog v-model="menuDialogVisible" title="权限分配" width="700px">
|
|
|
<el-scrollbar v-loading="loading" max-height="600px">
|
|
|
+ <el-button type="primary" @click="toggleCheckAll">全选</el-button>
|
|
|
+ <el-button @click="resetChecked">清空</el-button>
|
|
|
<el-tree
|
|
|
ref="treeRef"
|
|
|
:data="menuList"
|
|
@@ -34,6 +36,7 @@
|
|
|
}"
|
|
|
node-key="id"
|
|
|
show-checkbox
|
|
|
+ style="margin-top: 20px"
|
|
|
>
|
|
|
<template #default="{ data }">
|
|
|
{{ data.menuName }}
|
|
@@ -156,4 +159,12 @@ const handleRoleMenuSubmit = async () => {
|
|
|
menuDialogVisible.value = false;
|
|
|
});
|
|
|
};
|
|
|
+
|
|
|
+const toggleCheckAll = () => {
|
|
|
+ const allKeys = menuList.value.map((item) => item.id);
|
|
|
+ treeRef.value.setCheckedKeys(allKeys);
|
|
|
+};
|
|
|
+const resetChecked = () => {
|
|
|
+ treeRef.value.setCheckedKeys([], false);
|
|
|
+};
|
|
|
</script>
|