diff --git a/src/utils/stream.js b/src/utils/stream.js index 90a964f..d2e59d1 100644 --- a/src/utils/stream.js +++ b/src/utils/stream.js @@ -64,6 +64,13 @@ function downLoadFileConcurrency(obj, arr, callback) { let res = await downLoadFileConcurrency(obj, arr, callback) resolve(res) } + }).catch(err => { + if (callback) { + callback({ + type: 'error' + }) + } + console.log(err) }) }) } diff --git a/src/views/trials/trials-inspection/index.vue b/src/views/trials/trials-inspection/index.vue index 473e64e..3d52474 100644 --- a/src/views/trials/trials-inspection/index.vue +++ b/src/views/trials/trials-inspection/index.vue @@ -313,7 +313,7 @@ export default { }, methods: { handleClose(done) { - this.downLoadType = '' + this.downLoadType = 'start' this.percentage = 0 this.downLoadImageCount = 0 this.downloadVisible = false @@ -338,6 +338,7 @@ export default { if (!confirm) return false this.downloadId = res.OtherInfo.downloadId this.downloadImage(res.Result, res.OtherInfo) + this.downloadVisible = true } } catch (err) { console.log(err) @@ -356,7 +357,7 @@ export default { async downloadImage(data, OtherInfo) { try { let { files, name } = this.formatDownloadFile(data) - let res = await downLoadFile(files, name, 'zip', (data) => { + let res = await downLoadFile(files, name, 'zip', async (data) => { let { type } = data this.downloadType = type if (type === 'start') { @@ -374,8 +375,15 @@ export default { } if (type === 'downLoaded') { } + if (type === 'error') { + let confirm = await this.$confirm(this.$t('trials:imageSummary:confirm:downloadError')) + this.downLoadType = 'start' + this.percentage = 0 + this.downLoadImageCount = 0 + this.downloadVisible = false + } if (type === 'zipEnd') { - this.downLoadType = '' + this.downLoadType = 'start' this.percentage = 0 this.downLoadImageCount = 0 this.downloadVisible = false