新模块的第一次测试修复了部分bug

This commit is contained in:
2025-07-16 00:24:31 +08:00
parent de30b60256
commit 6b0562b498
17 changed files with 1695 additions and 378 deletions

View File

@ -1,6 +1,6 @@
<template>
<!-- 搜索框 -->
<div class="search-box">
<div class="search-box" v-if="hasPermission">
<div class="search-container">
<a-form layout="inline">
<a-space>
@ -762,8 +762,46 @@ const getUserList = async () => {
loading.value = false;
}
};
// 新增权限控制变量
const hasPermission = ref(true);
onMounted(async () => {
// 检查用户权限
await checkPermission();
// 如果有权限才加载数据
if (hasPermission.value) {
getUserList();
}
});
// 检查用户权限
const checkPermission = async () => {
try {
// 获取当前用户角色
const userRole = store.loginUser.userRole;
// 如果是管理员,显示提示并隐藏内容
if (userRole === 'admin') {
hasPermission.value = false;
// 使用Modal显示提示
Modal.warning({
title: '权限提示',
content: '管理员无权限查看管理员列表',
okText: '确定',
onOk() {
// 可以添加额外的处理逻辑
}
});
} else {
hasPermission.value = true;
}
} catch (error) {
console.error('权限检查失败:', error);
message.error('权限检查失败');
hasPermission.value = false;
}
};
onMounted(getUserList);
// ID查询方法
interface User {