|
@@ -510,36 +510,22 @@
|
|
this.listQuery.endTime = formatDate(endDate, 'yyyy-MM-dd hh:mm:ss');
|
|
this.listQuery.endTime = formatDate(endDate, 'yyyy-MM-dd hh:mm:ss');
|
|
},
|
|
},
|
|
handleExportExcel(fileName){
|
|
handleExportExcel(fileName){
|
|
- if(!fileName || typeof fileName != "string"){
|
|
|
|
- fileName = "订单"
|
|
|
|
- }
|
|
|
|
- exportExcel(this.listQuery).then(res => {
|
|
|
|
- console.log('new Blob([res])',new Blob([res]));
|
|
|
|
- if (!res) {
|
|
|
|
- this.$message("文件下载失败")
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- if (typeof window.navigator.msSaveBlob !== 'undefined') {
|
|
|
|
- window.navigator.msSaveBlob(new Blob([res]), fileName+'.xlsx')
|
|
|
|
- }else{
|
|
|
|
- let blob = new Blob([res], {
|
|
|
|
- type: 'application/vnd.ms-excel'
|
|
|
|
- });
|
|
|
|
- console.log('blob',blob);
|
|
|
|
- let url = window.URL.createObjectURL(blob)
|
|
|
|
- // let url = window.URL.createObjectURL(new Blob([res]))
|
|
|
|
- let link = document.createElement('a')
|
|
|
|
- link.style.display = 'none'
|
|
|
|
- link.href = url
|
|
|
|
- link.setAttribute('download', fileName+new Date().getTime()+'.xlsx')
|
|
|
|
- document.body.appendChild(link)
|
|
|
|
- link.click()
|
|
|
|
- document.body.removeChild(link); //下载完成移除元素
|
|
|
|
- window.URL.revokeObjectURL(url); //释放掉blob对象
|
|
|
|
- }
|
|
|
|
- // console.log(res)
|
|
|
|
- }).catch(err =>{
|
|
|
|
- console.log(err)
|
|
|
|
|
|
+ this.$confirm('确定要导出当前查询的数据吗?', '提示', {
|
|
|
|
+ confirmButtonText: '确定 ',
|
|
|
|
+ cancelButtonText: '取消 ',
|
|
|
|
+ type: 'warning'
|
|
|
|
+ }).then(() => {
|
|
|
|
+ // this.exportFullscreenLoading = true;
|
|
|
|
+ exportExcel(this.listQuery).then(response => {
|
|
|
|
+ this.exportExcel(response, '订单');
|
|
|
|
+ // this.exportFullscreenLoading = false;
|
|
|
|
+ }).catch((error) => {
|
|
|
|
+ this.msgError('导出Excel异常!');
|
|
|
|
+ // this.exportFullscreenLoading = false;
|
|
|
|
+ });
|
|
|
|
+ }).catch(() => {
|
|
|
|
+ this.msgInfo('您已取消导出!');
|
|
|
|
+ // this.exportFullscreenLoading = false;
|
|
});
|
|
});
|
|
|
|
|
|
},
|
|
},
|