前端权限管理:修复组件数据结构和路由参数处理

修复内容:
- 修复 ApiPermissions.vue 中的路由参数处理,支持 id 和 projectId 两种参数
- 修复 ApiEndpointPermissions.vue 中的权限数据结构处理
- 修复 PermissionMonitoring.vue 中的缓存统计显示
- 修复 ProjectPermissionsModule.vue 中的权限矩阵更新逻辑
- 优化保存逻辑,保存后重新加载数据以确保同步

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Cheng Zhou
2026-05-14 09:21:33 +08:00
parent 387d035b08
commit c73c00d932
4 changed files with 15 additions and 7 deletions
@@ -157,7 +157,9 @@ const filteredEndpoints = computed(() => {
// 检查端点是否允许
const isEndpointAllowed = (endpoint_key: string, role: string): boolean => {
if (!props.matrix || !props.matrix[role]) return false;
return props.matrix[role][endpoint_key]?.allowed ?? false;
const perm = props.matrix[role][endpoint_key];
if (!perm) return false;
return typeof perm === "boolean" ? perm : perm.allowed;
};
// 获取方法的标签类型
@@ -181,7 +183,7 @@ const onPermissionChange = (endpoint_key: string, role: string, allowed: boolean
updatedMatrix[role] = {};
}
updatedMatrix[role][endpoint_key] = { allowed };
updatedMatrix[role][endpoint_key] = allowed;
emit("update", updatedMatrix);
};