From 008441a929e9a4918676b9c83cfa2d55cce6c289 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 8 Jan 2026 18:19:19 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=95=B0=E6=8D=AE=E6=80=BB=E8=A7=88?= =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8A=A0=E8=BD=BD=E6=97=B6=E4=BB=8ElocalStor?= =?UTF-8?q?age=E8=8E=B7=E5=8F=96deptId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/TaskHall.vue | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/frontend/src/views/TaskHall.vue b/frontend/src/views/TaskHall.vue index 78974c1..b68132e 100644 --- a/frontend/src/views/TaskHall.vue +++ b/frontend/src/views/TaskHall.vue @@ -3936,8 +3936,18 @@ const loadDashboardStats = async () => { const params: { month?: string; deptId?: number } = {} if (month) params.month = month // 获取有效的部门ID(切换的部门或用户自己的部门) - const effectiveDept = effectiveDeptId.value - console.log('loadDashboardStats - userDeptId:', userDeptId.value, 'currentDeptView:', currentDeptView.value, 'effectiveDept:', effectiveDept) + let effectiveDept = effectiveDeptId.value + // 如果 effectiveDeptId 为空,尝试从 localStorage 获取 + if (!effectiveDept) { + const userStr = localStorage.getItem('userInfo') + if (userStr) { + try { + const user = JSON.parse(userStr) + effectiveDept = user.deptId + } catch (e) { /* ignore */ } + } + } + console.log('loadDashboardStats - effectiveDept:', effectiveDept, 'userDeptId:', userDeptId.value, 'currentDeptView:', currentDeptView.value) if (effectiveDept) { params.deptId = effectiveDept }