ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
> 使用blob流下载Excel文档 ``` this.$api.exportData(this,'admin/u/p/order/grow/rate/export',{ createTime:this.createTime, content: this.content}).then(res =>{ const content = res let blob = new Blob([content],{ type: "application/ms-excel" }) let url = window.URL.createObjectURL(blob) if ('download' in document.createElement('a')) { let link = document.createElement('a') link.style.display ='none' link.href = url link.setAttribute('download','订单增长率.xls') document.body.appendChild(link) link.click() }else{ navigator.msSaveBlob(blob, 'excel.xls') } }) }, ``` ***** ``` exportDownload() { //..导出订单折扣明细表 this.loading = true this.timeData.push(this.formData.time\[0\]) //..开始时间 this.timeData.push(this.formData.time\[1\]+ 24\*60\*60\*1000) //..结束时间选择当天加上一天 this.$api.exportData(this,'admin/u/p/order/orderDiscountDownLoad',{ type: this.formData.type, //..订单类型 time: this.timeData, //..订单时间 businessUnitId: this.formData.businessUnitId, //..事业部ID itemCode: this.formData.itemCode, //..货品编码 status: this.formData.status //..订单状态 }).then(res =>{ this.loading = false if(res.code == undefined) { <!-- 请求成功后的操作 --> this.timeData = [] //..成功下载Excel后初始化选中时间 this.formData.status = [] //..成功夏侯Excel后初始化订单状态 } const content = res let blob = new Blob(\[content\],{ type: "application/ms-excel" }) let url = window.URL.createObjectURL(blob) if ('download' in document.createElement('a')) { let link = document.createElement('a') link.style.display ='none' link.href = url link.setAttribute('download','订单折扣明细表.xls') document.body.appendChild(link) link.click() }else{ navigator.msSaveBlob(blob, '订单折扣明细表.xls') } }) }, ```