From b0f6da53f74dff22d26b7d9f9dc50d0b7a1aff2e Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 15 Jan 2026 17:59:40 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DloadDashboardStats?= =?UTF-8?q?=E4=B8=ADuserInfo=E6=9C=AA=E5=AE=9A=E4=B9=89=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/TaskHall.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/views/TaskHall.vue b/frontend/src/views/TaskHall.vue index 86edd12..9c308c1 100644 --- a/frontend/src/views/TaskHall.vue +++ b/frontend/src/views/TaskHall.vue @@ -4278,9 +4278,12 @@ const loadDashboardStats = async () => { const params: { month?: string; deptId?: number } = {} if (month) params.month = month + // 从 localStorage 获取用户信息 + const userInfo = JSON.parse(localStorage.getItem('userInfo') || '{}') + // 只有部门负责人切换了部门视角时才传递 deptId // 普通用户不传 deptId,后端会根据 userId 查询个人数据 - const isDeptLeader = userInfo.value?.isDepartmentLeader || false + const isDeptLeader = userInfo.isDepartmentLeader === 1 || userInfo.isDepartmentLeader === true || managedDepartments.value.length > 0 if (isDeptLeader && currentDeptView.value !== undefined) { // 部门负责人且切换了部门视角 params.deptId = currentDeptView.value