From e7c29a0a575095cd98f307b405044daf4ae8c6e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?IT=E7=8B=97?= Date: Tue, 21 Jul 2026 11:17:33 +0800 Subject: [PATCH] Add RECALC button to Roster page to refresh data --- frontend/src/pages/roster/Roster.jsx | 31 +++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/frontend/src/pages/roster/Roster.jsx b/frontend/src/pages/roster/Roster.jsx index 1a39bce..03f53a3 100644 --- a/frontend/src/pages/roster/Roster.jsx +++ b/frontend/src/pages/roster/Roster.jsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react' -import { Upload, CheckCircle, Trash2, Clock, Users } from 'lucide-react' +import { Upload, CheckCircle, Trash2, Clock, Users, RefreshCw } from 'lucide-react' import api from '../../api' import toast from 'react-hot-toast' @@ -63,6 +63,21 @@ export default function RosterPage() { } } + const handleRecalc = async () => { + setLoading(true) + try { + await Promise.all([ + api.get('/api/roster/info'), + api.get('/api/roster/data').catch(() => ({ data: { headers: [], rows: [] } })) + ]) + toast.success('已重新計算') + } catch { + toast.error('重新計算失敗') + } finally { + loadRosterData() + } + } + if (loading) { return
載入中...
} @@ -106,10 +121,16 @@ export default function RosterPage() {

- +
+ + +
)}