const handleExport = async () => {
const selectRows: ApplyInfoModel[] = getSelectRows();
//数据
if (!selectRows) {
return;
}
loadingRef.value = true;
const maxConcurrentRequests = 10; // 并发请求限制
let currentIndex = 0;
const processQueue = async () => {
while (currentIndex < selectRows.length) {
const promises = [];
for (let i = 0; i < maxConcurrentRequests && currentIndex < selectRows.length; i++, currentIndex++) {
promises.push(exportDocx_user(selectRows[currentIndex]));
}
console.log(promises)
await Promise.all(promises);
await new Promise(resolve => setTimeout(resolve, 2000)); // 关键 2秒钟
}
};
try {
await processQueue();
} catch (error) {
console.log('handleExport>>>', error);
}
setTimeout(() => {
loadingRef.value = false;
}, 1000);
};
01-07
12-07
1221