feat:角色 role 的分配菜单 100%(基于 VbenTree)

This commit is contained in:
YunaiV
2025-04-01 13:55:11 +08:00
parent d7545cbd27
commit ee711fc8ab
5 changed files with 265 additions and 8 deletions

View File

@@ -18,7 +18,6 @@ import { useAssignDataPermissionFormSchema } from '../data';
import { SystemDataScopeEnum } from '#/utils/constants';
const emit = defineEmits(['success']);
const formData = ref<SystemRoleApi.SystemRole>();
const deptTree = ref<SystemDeptApi.SystemDept[]>([]); // 部门树
const deptLoading = ref(false); // 加载部门列表
@@ -70,8 +69,7 @@ const [Modal, modalApi] = useVbenModal({
}
modalApi.lock();
try {
formData.value = await getRole(data.id as number);
await formApi.setValues(formData.value);
await formApi.setValues(await getRole(data.id as number));
// 加载部门列表
await loadDeptTree();
toggleExpandAll();
@@ -104,7 +102,7 @@ function toggleSelectAll() {
}
/** 展开/折叠所有节点 */
async function toggleExpandAll() {
function toggleExpandAll() {
isExpanded.value = !isExpanded.value;
if (isExpanded.value) {
// 获取所有节点的 ID