fix: 数据总览初始加载时从localStorage获取deptId
This commit is contained in:
parent
f2b37c8780
commit
008441a929
@ -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
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user