auto-sync: 2026-05-19 14:02:26
This commit is contained in:
@@ -425,22 +425,13 @@ export default function EdictBoard() {
|
||||
))}
|
||||
<span style={{ fontSize: 10, color: 'var(--muted)', marginLeft: 4 }}>活跃{activeCount} · 归档{archivedCount} · 共{topLevelTasks.length}</span>
|
||||
<button onClick={async () => {
|
||||
// 一键归档已完成
|
||||
const pid = selectedProjectId;
|
||||
if (!pid) return;
|
||||
const doneTasks = topLevelTasks.filter(t => t.status === 'done' && !t.archived);
|
||||
if (doneTasks.length === 0) { toast('没有可归档的任务'); return; }
|
||||
try {
|
||||
let count = 0;
|
||||
for (const t of doneTasks) {
|
||||
const res = await fetch(`/api/projects/${pid}/tasks/${t.id}`, {
|
||||
method: 'PATCH', headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ archived: 1 }),
|
||||
});
|
||||
if (res.ok) count++;
|
||||
}
|
||||
toast(`📦 已归档 ${count} 个任务`);
|
||||
loadV2Tasks();
|
||||
const res = await fetch(`/api/projects/${pid}/tasks/archive-done`, { method: 'POST' });
|
||||
const r = await res.json();
|
||||
if (r.ok || r.count) { toast(`📦 已归档 ${r.count || 0} 个任务`); loadV2Tasks(); }
|
||||
else toast('归档失败', 'err');
|
||||
} catch { toast('归档失败', 'err'); }
|
||||
}} style={{
|
||||
marginLeft: 'auto', padding: '3px 10px', borderRadius: 6, fontSize: 11,
|
||||
|
||||
Reference in New Issue
Block a user