debug: 添加更多调试日志

This commit is contained in:
Your Name 2026-01-08 18:13:01 +08:00
parent 3b2e8d404f
commit ebc84ce241

View File

@ -2435,7 +2435,9 @@ const effectiveDeptType = computed(() => {
// 获取当前有效的部门ID
const effectiveDeptId = computed(() => {
return currentDeptView.value !== undefined ? currentDeptView.value : userDeptId.value
const result = currentDeptView.value !== undefined ? currentDeptView.value : userDeptId.value
console.log('effectiveDeptId计算:', {currentDeptView: currentDeptView.value, userDeptId: userDeptId.value, result})
return result
})
// 初始化部门视角数据
@ -2460,6 +2462,7 @@ const initDeptViewData = async () => {
}
if (user) {
console.log('初始化部门视角 - 用户信息:', {deptId: user.deptId, deptName: user.deptName, deptType: user.deptType, managedDepartments: user.managedDepartments})
userDeptId.value = user.deptId
userDeptName.value = user.deptName || '我的部门'
userDeptType.value = user.deptType || 'demand'
@ -3932,9 +3935,10 @@ const loadDashboardStats = async () => {
const month = selectedMonth.value?.format('YYYY-MM')
const params: { month?: string; deptId?: number } = {}
if (month) params.month = month
// 如果切换了部门视角,传递部门ID
if (currentDeptView.value !== undefined) {
params.deptId = currentDeptView.value
// 获取有效的部门ID(切换的部门或用户自己的部门)
const effectiveDept = effectiveDeptId.value
if (effectiveDept) {
params.deptId = effectiveDept
}
console.log('loadDashboardStats 调用参数:', params, 'effectiveDeptType:', effectiveDeptType.value)
const response = await taskApi.getDashboardStats(Object.keys(params).length > 0 ? params : undefined)