fix: 修复使用AI创建任务顺序错误的问题

This commit is contained in:
kuaifan 2024-12-11 22:36:57 +08:00
parent 7132413837
commit e15bea9342

View File

@ -3301,12 +3301,15 @@ export default {
const typeCall = type === 'subtask' ? 'taskAddSub' : 'taskAdd';
const typeLabel = type === 'subtask' ? '子任务' : '任务';
const results = await Promise.all(taskList.map(item =>
this.$store.dispatch(typeCall, item).then(
success => ({ success: true, data: success }),
error => ({ success: false, error: error })
)
));
const results = [];
for (const item of taskList) {
try {
const success = await this.$store.dispatch(typeCall, item);
results.push({ success: true, data: success });
} catch (error) {
results.push({ success: false, error: error });
}
}
const successTasks = results.filter(r => r.success).map(r => r.data);
const failedTasks = results.filter(r => !r.success).map(r => r.error);
let notice = `${this.$store.state.userInfo.nickname} 成功创建 ${successTasks.length}${typeLabel}`;