diff --git a/frontend/src/components/ApiEndpointPermissions.vue b/frontend/src/components/ApiEndpointPermissions.vue index d7ac2c18..b407b4d5 100644 --- a/frontend/src/components/ApiEndpointPermissions.vue +++ b/frontend/src/components/ApiEndpointPermissions.vue @@ -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); }; diff --git a/frontend/src/components/PermissionMonitoring.vue b/frontend/src/components/PermissionMonitoring.vue index 6bd71e24..117534cd 100644 --- a/frontend/src/components/PermissionMonitoring.vue +++ b/frontend/src/components/PermissionMonitoring.vue @@ -65,7 +65,7 @@
缓存项目数
-
{{ cacheStats?.cache_items.total_count || 0 }}
+
{{ health?.cache_stats?.cache_items.total_count || 0 }}
@@ -136,7 +136,7 @@ defineProps(); defineEmits(); const cacheStats = computed(() => { - // 从 health 中提取 cache_stats + // 从 health 中提取 cache_stats,如果没有则返回 null return null; }); diff --git a/frontend/src/components/ProjectPermissionsModule.vue b/frontend/src/components/ProjectPermissionsModule.vue index 44503020..4ba4bc81 100644 --- a/frontend/src/components/ProjectPermissionsModule.vue +++ b/frontend/src/components/ProjectPermissionsModule.vue @@ -65,8 +65,8 @@ const tableData = computed(() => { const onPermissionChange = () => { if (!props.matrix) return; - const updatedMatrix = { - ...props.matrix, + const updatedMatrix: ProjectRolePermissionsResponse = { + modules: props.matrix.modules, roles: { ...props.matrix.roles }, }; diff --git a/frontend/src/views/admin/ApiPermissions.vue b/frontend/src/views/admin/ApiPermissions.vue index df7f367a..7b8213c9 100644 --- a/frontend/src/views/admin/ApiPermissions.vue +++ b/frontend/src/views/admin/ApiPermissions.vue @@ -103,7 +103,10 @@ const saving = ref(false); const resetting = ref(false); const project = computed(() => studyStore.currentStudy); -const studyId = computed(() => route.params.id as string); +const studyId = computed(() => { + const id = route.params.id || route.params.projectId; + return typeof id === "string" ? id : (id as string[])[0]; +}); // 权限数据 const moduleMatrix = ref(null); @@ -183,6 +186,9 @@ const save = async () => { dirty.value = false; ElMessage.success("权限已保存"); + + // 重新加载数据以确保同步 + await loadPermissionData(); } catch (error) { ElMessage.error("保存权限失败"); console.error(error);