From d0c0be09842102a119731c91b4a872c265632ff3 Mon Sep 17 00:00:00 2001 From: selfrelease Date: Sat, 1 Aug 2026 08:11:14 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20TaskCenter=E5=BE=85=E5=8A=9E=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=94=B9=E7=94=A8getDashboardData=E5=8E=BB=E9=87=8Dto?= =?UTF-8?q?dos=EF=BC=8C=E4=B8=8E=E6=A6=82=E8=A7=8891=E4=B8=80=E8=87=B4(?= =?UTF-8?q?=E5=8E=9F211=E6=9C=AA=E5=8E=BB=E9=87=8D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/routes/dashboard.routes.ts | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/backend/src/routes/dashboard.routes.ts b/backend/src/routes/dashboard.routes.ts index 6686a49..e10c075 100644 --- a/backend/src/routes/dashboard.routes.ts +++ b/backend/src/routes/dashboard.routes.ts @@ -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 || '/', })), }, {