fix: 修复选择部门视角后进行中任务数量不一致的问题
部门负责人切换到需求部门视角时,也使用 excludeStatuses 后端过滤
This commit is contained in:
parent
130e0afcb2
commit
c2ee27ee69
@ -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 {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user