merge: maestro/tsk_sTHRFtFoHf-G [tsk_sTHRFtFoHf-G]

This commit is contained in:
maestro
2026-06-30 07:45:44 +08:00
3 changed files with 18 additions and 9 deletions
+8 -3
View File
@@ -350,8 +350,13 @@ export function App() {
try {
const task = await api.createTask(currentId, body);
if (files && files.length) {
try { await api.uploadAttachments(task.id, files); toast('ok', `附件已上传 · ${files.length}`); }
catch (e) { toast('warn', e.message); }
try {
// 消费后端去重后的权威列表:新建任务原本无附件,stored 即本批去重后入库条数
const { attachments } = await api.uploadAttachments(task.id, files);
const stored = attachments.length;
const deduped = files.length - stored; // >0 表示有同内容文件被去重
toast('ok', t.attUploaded.replace('{n}', stored) + (deduped > 0 ? t.attDeduped.replace('{n}', deduped) : ''));
} catch (e) { toast('warn', e.message); }
}
toast('ok', t.toastCreated);
loadProject(currentId); loadGlobal();
@@ -389,7 +394,7 @@ export function App() {
},
// 删除已建任务的单个附件(name = 磁盘文件名 basename(att.path)),成功后局部刷新
delAttachment: async (taskId, name) => {
try { await api.deleteAttachment(taskId, name); toast('warn', t.attDeleted); loadProject(currentId); }
try { await api.deleteAttachment(taskId, name); toast('ok', t.attDeleted); loadProject(currentId); }
catch (e) { toast('warn', t.attDeleteFailed + e.message); }
},
};