zhangxiaoxu123
2023-01-04 cf1da9992ed87f5c014794da046e651e70693263
下载bug修改
1个文件已修改
42 ■■■■ 已修改文件
src/components/page/invoice/invoiceForm.vue 42 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/page/invoice/invoiceForm.vue
@@ -162,28 +162,50 @@
                if(this.filedId.length == 0){
                    alert("请至少选择一项")
                }else {
                    let url = this.$systemconfig.basePath + '/fileInfo/download/downloadPng';
                    this.filedId.forEach(item => {
                    if(this.filedId.length == 1) {
                        let url = this.$systemconfig.basePath + '/fileInfo/download/downloadPng';
                        this.filedId.forEach(item => {
                            let param = {
                                    fileId : item
                            }
                            this.$byutil.exportData(this,url,param,res => {
                                console.log(res,'res====')
                                let date = new Date()
                                let time = this.$moment(date).format('YYYY-MM-DD HH:mm:ss') + '-' + item
                                console.log(time,'time===========')
                                let blob = new Blob([res], {type: 'image/png'});
                                let downloadElement = document.createElement("a");
                                downloadElement.style.display = "none";
                                let href = window.URL.createObjectURL(blob); //创建下载的链接
                                downloadElement.href = href;
                                downloadElement.download = time
                                document.body.appendChild(downloadElement);
                                downloadElement.click(); //点击下载
                                document.body.removeChild(downloadElement); //下载完成移除元素
                                window.URL.revokeObjectURL(href); //释放掉blob对象
                            })
                        })
                    }else if(this.filedId.length > 1) {
                        let result =  this.filedId.join(",")
                        console.log(result,'result---------')
                        let url = this.$systemconfig.basePath + '/fileInfo/download/downloadZips';
                        let param = {
                                fileId : item
                            fileIds : result
                        }
                        this.$byutil.exportData(this,url,param,res => {
                            console.log(res,'res====')
                            let date = new Date()
                            let time = this.$moment(date).format('YYYY-MM-DD HH:mm:ss') + '-' + item
                            console.log(time,'time===========')
                            let blob = new Blob([res], {type: 'image/png'});
                            console.log(res,'res=========')
                            let blob = new Blob([res], {type: 'application/zip'});
                            let downloadElement = document.createElement("a");
                            downloadElement.style.display = "none";
                            let href = window.URL.createObjectURL(blob); //创建下载的链接
                            downloadElement.href = href;
                            downloadElement.download = time
                            downloadElement.download = '发票下载.zip'
                            document.body.appendChild(downloadElement);
                            downloadElement.click(); //点击下载
                            document.body.removeChild(downloadElement); //下载完成移除元素
                            window.URL.revokeObjectURL(href); //释放掉blob对象
                        })
                    })
                    }
                }
            },
            changeDate(){