From 8fcdf95cf533f050f63fe273dd7cce89ae9b0655 Mon Sep 17 00:00:00 2001 From: zhangyuan Date: Tue, 31 May 2022 11:13:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../stats/factagencyuserhousedaily.vue | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/src/views/modules/plugins/stats/factagencyuserhousedaily.vue b/src/views/modules/plugins/stats/factagencyuserhousedaily.vue index 8071612e..597c874b 100644 --- a/src/views/modules/plugins/stats/factagencyuserhousedaily.vue +++ b/src/views/modules/plugins/stats/factagencyuserhousedaily.vue @@ -47,10 +47,10 @@
- 总计 - 导出
@@ -121,7 +121,8 @@ export default { getDataListURL: '/data/stats/factAgencyUserHouseDaily/page', getDataListIsPage: true, deleteURL: '/data/stats/factAgencyUserHouseDaily', - deleteIsBatch: true + deleteIsBatch: true, + exportURL: '/data/stats/factAgencyUserHouseDaily/export' }, optionsA: [], totalVisible: false, @@ -151,7 +152,7 @@ export default { } }, methods: { - handleTotal () { + totalHandle () { this.tableData = [] this.$http .get('/data/stats/factAgencyUserHouseDaily/total',{params: this.dataForm}) @@ -168,6 +169,34 @@ export default { }) this.totalVisible = true }, + exportHandle () { + const url = this.mixinViewModuleOptions.exportURL + this.$http({ + method: 'GET', + url, + responseType: 'blob', + params: this.dataForm + }).then(res => { + // this.download(res.data, title + '.xls') + if (res.headers["content-disposition"]) { + let fileName = window.decodeURI(res.headers["content-disposition"].split(";")[1].split("=")[1]) + console.log('filename', fileName) + let blob = new Blob([res.data], { type: 'application/vnd.ms-excel' }) + var url = window.URL.createObjectURL(blob) + var aLink = document.createElement('a') + aLink.style.display = 'none' + aLink.href = url + aLink.setAttribute('download', fileName) + document.body.appendChild(aLink) + aLink.click() + document.body.removeChild(aLink) //下载完成移除元素 + window.URL.revokeObjectURL(url) //释放掉blob对象 + } else this.$message.error('下载失败') + }).catch(err => { + console.log('err', err) + return this.$message.error('网络错误') + }) + }, cascaderClick (nodeData) { this.dataForm.agencyId = nodeData.agencyId; this.dataForm.level = nodeData.level