简历批量下载更改
continuous-integration/drone/push Build is passing Details

uat_us
caiyiling 2026-02-05 14:41:28 +08:00
parent 231a993f8b
commit 849142bd23
1 changed files with 54 additions and 5 deletions

View File

@ -712,11 +712,12 @@ export default {
this.model_cfg.visible = false this.model_cfg.visible = false
this.model_cfg.showClose = true this.model_cfg.showClose = true
console.log(res.Result) console.log(res.Result)
for (let i = 0; res.Result.length > i; i++) { this.downloadAllInOneZip(res.Result)
let item = res.Result[i] // for (let i = 0; res.Result.length > i; i++) {
console.log(item) // let item = res.Result[i]
await this.handleBatchDown(item) // console.log(item)
} // await this.handleBatchDown(item)
// }
} catch (e) { } catch (e) {
console.log(e) console.log(e)
} }
@ -736,6 +737,54 @@ export default {
// this.model_cfg.showClose = true // this.model_cfg.showClose = true
// }) // })
}, },
async downloadAllInOneZip(arr) {
if (!arr.length) {
return
}
const zip = new JSZip()
const allTasks = []
arr.forEach((reviewer) => {
if (!reviewer?.FileList?.length) return
reviewer.FileList.forEach((fileItem) => {
const fileUrl = this.OSSclientConfig.basePath + fileItem.Path
const zipPath = `${reviewer.Name}_${fileItem.FileName}`
const task = this.getFileData(fileUrl)
.then((response) => {
zip.file(zipPath, response.data, { binary: true })
})
.catch((err) => {
console.error(`文件下载失败 [${zipPath}]:`, err)
});
allTasks.push(task)
})
})
if (allTasks.length === 0) {
console.log('无可下载的文件')
return
}
try {
await Promise.all(allTasks)
// ZIP
const zipBlob = await zip.generateAsync({
type: 'blob',
compression: 'DEFLATE',
compressionOptions: { level: 9 },
})
//
saveAs(zipBlob, `CV_${new Date().getTime()}.zip`)
console.error('ZIP 生成成功')
} catch (err) {
console.error('ZIP 生成失败:', err)
} finally {
}
},
// //
handleSelectSearch() { handleSelectSearch() {
this.searchData.PageIndex = 1 this.searchData.PageIndex = 1