fix: TaskCenter待办列表改用getDashboardData去重todos,与概览91一致(原211未去重)
This commit is contained in:
@@ -246,12 +246,9 @@ router.get('/workspace/next-actions', authMiddleware, async (req: AuthRequest, r
|
||||
const now = new Date()
|
||||
const in30Days = new Date(now.getTime() + 30 * 24 * 60 * 60 * 1000)
|
||||
|
||||
// 1. 待办风险项(全部)
|
||||
const riskItems = await prisma.riskItem.findMany({
|
||||
where: { orgId, status: 'PENDING' },
|
||||
orderBy: { createdAt: 'desc' },
|
||||
select: { id: true, title: true, type: true, level: true, deadline: true, actionUrl: true, employeeId: true },
|
||||
})
|
||||
// 1. 待办风险项(使用 getDashboardData 的去重 todos,与概览一致)
|
||||
const dashboardData = await getDashboardData(orgId)
|
||||
const dedupedTodos = dashboardData.todos
|
||||
|
||||
// 2. 草稿发薪批次
|
||||
const draftBatches = await prisma.payrollBatch.findMany({
|
||||
@@ -293,13 +290,13 @@ router.get('/workspace/next-actions', authMiddleware, async (req: AuthRequest, r
|
||||
{
|
||||
category: '待办事项',
|
||||
priority: 'high',
|
||||
items: riskItems.map(r => ({
|
||||
id: r.id,
|
||||
title: r.title,
|
||||
type: r.type,
|
||||
level: r.level,
|
||||
dueDate: r.deadline?.toISOString().slice(0, 10),
|
||||
link: r.actionUrl || '/',
|
||||
items: dedupedTodos.map(t => ({
|
||||
id: t.id,
|
||||
title: t.title,
|
||||
type: t.type,
|
||||
level: t.level,
|
||||
dueDate: t.deadline,
|
||||
link: t.actionUrl || '/',
|
||||
})),
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user