From c2ee27ee6968a2f0ec629a969417b788dc965c6f Mon Sep 17 00:00:00 2001 From: Your Name Date: Fri, 16 Jan 2026 16:22:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E9=83=A8=E9=97=A8=E8=A7=86=E8=A7=92=E5=90=8E=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E4=B8=AD=E4=BB=BB=E5=8A=A1=E6=95=B0=E9=87=8F=E4=B8=8D=E4=B8=80?= =?UTF-8?q?=E8=87=B4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 部门负责人切换到需求部门视角时,也使用 excludeStatuses 后端过滤 --- frontend/src/views/TaskHall.vue | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) 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 {