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