diff --git a/frontend/src/views/TaskHall.vue b/frontend/src/views/TaskHall.vue index 24a0b45..2225fbc 100644 --- a/frontend/src/views/TaskHall.vue +++ b/frontend/src/views/TaskHall.vue @@ -4462,25 +4462,22 @@ const loadInProgressTasks = async () => { } else { // 需求部门视角:看该部门发起的任务(通过 deptId 参数) console.log('需求部门视角切换,查询部门ID:', currentDeptView.value) - // 需求部门负责人:不传递status参数,查询所有非草稿的任务 + // 需求部门负责人:使用 excludeStatuses 排除草稿和已完成的任务 const { status, ...paramsWithoutStatus } = params const taskResponse = await taskApi.getTasks({ ...paramsWithoutStatus, - publisherDeptId: currentDeptView.value // 按发布者部门过滤 + publisherDeptId: currentDeptView.value, // 按发布者部门过滤 + excludeStatuses: 'draft,completed,cancelled' // 🔥 后端排除指定状态 }) if (taskResponse.data && taskResponse.data.records) { - // 需求部门负责人:显示所有已发布且未完成的任务(pending、in_progress、review等) - const tasksWithInProgress = taskResponse.data.records.filter((task: any) => { - // 排除草稿和已完成的任务 - const excludeStatuses = ['draft', 'completed', 'cancelled'] - return !excludeStatuses.includes(task.status) - }) - console.log('需求部门视角切换 - 过滤后任务数:', tasksWithInProgress.length) - allTasks = tasksWithInProgress.map((task: any) => ({ + // 需求部门负责人:显示所有处理中的任务(后端已过滤) + console.log('需求部门视角切换 - 返回任务数:', taskResponse.data.records.length, '总数:', taskResponse.data.total) + allTasks = taskResponse.data.records.map((task: any) => ({ ...task, isSubTask: false })) - totalCount = allTasks.length + // 🔥 使用后端返回的总数,确保分页正确 + totalCount = taskResponse.data.total || allTasks.length } } } else {