diff --git a/src/api/distribution/distributionSignfor.js b/src/api/distribution/distributionSignfor.js index 2cbb6b70..b4dd09ec 100644 --- a/src/api/distribution/distributionSignfor.js +++ b/src/api/distribution/distributionSignfor.js @@ -66,6 +66,7 @@ export const handlePicture = ids => { params: { ids }, + responseType: 'blob', }) }; diff --git a/src/views/distribution/signfor/distributionSignfor.vue b/src/views/distribution/signfor/distributionSignfor.vue index afa0d120..cd7dfd54 100644 --- a/src/views/distribution/signfor/distributionSignfor.vue +++ b/src/views/distribution/signfor/distributionSignfor.vue @@ -115,6 +115,7 @@ 导出 + 导出图片 @@ -215,9 +216,29 @@ + + + +
+ + +
+ + 取 消 + 确 定 + +
+ + + + >>>>>>>>>",this.selectionList); if (this.selectionList.length < 1){ this.$message({ @@ -729,16 +756,69 @@ export default { message: '请选择签收记录!', }); } - const idList= this.selectionList.map(item=>{ - return item.id - }) - console.log(idList); - const ids = idList.join(','); - console.log("ids>>>>>>>>>>>>",ids); - handlePicture(ids).then(res=>{ - console.log("res><>>>>>>>>>>>>>",res); + + const idList= this.selectionList.map(item=>{ + console.log('>>>>>>>>>',item); + return{id:item.id,reservationCode:item.reservationCode,client:item.consignee} }) + const _arr = []; + console.log(idList); + if (idList.length > 0){ + // this.fullscreenLoading = true; + // this.dialogVisible = true; + + idList.forEach(item=>{ + return _arr.push(handlePicture(item.id)); + }) + + + console.log('arr>>>>>>>>>>>>>>>>>>>>',_arr); + function delayedTimer() { + console.log('Delayed timer executed!'); + } + const timerId = setTimeout(delayedTimer, 500); + Promise.all(_arr).then((response)=>{ + + console.log('response>>>>>>>>>>>>>>>>>>>>>',response); + response.forEach((res, index) =>{ + console.log('res>>>>>>>>>>>>>>>>>>>>>',res.data); + if (res.data.size > 0){ + const _item = idList[index]; + const blob = new Blob([res.data], {type: 'application/zip'}); + let a = document.createElement("a"); + a.href = window.URL.createObjectURL(blob); + // a.href = 'http://192.168.10.25:2888/D:/Test'; + a.download = _item.client +'-'+_item.reservationCode +".zip"; + // a.download = 'aaa' + ".zip"; + a.style.display = "none"; + document.body.appendChild(a); + a.click(); // 模拟点击了a标签,会触发a标签的href的读取,浏览器就会自动下载了 + a.remove(); + } + }) + for (let i = 0; i < 100; i++) { + this.fileSize = i; + } + // this.dialogVisible = false; + setTimeout(() => { + clearTimeout(timerId); + console.log('延迟执行完成'); + this.fullscreenLoading = false; + + this.$notify({ + title: '提示', + message: ('i', { style: 'color: teal'}, '开始下载...') + }); + }, 3000); + }) + + + // 在 3 秒之后,自动清除定时器 + + } + + // row.signingStatus = '2'; // row = { ...row, ...this.query }; @@ -748,6 +828,7 @@ export default { // downloadXls(res.data, '签收数据.xlsx'); // }); }, + showdrawer(value) { this.drawerShow = value; },