From e605e1b43128cb7c130065767992b09c4c69fa0a Mon Sep 17 00:00:00 2001 From: 13176889840 <13176889840@163.com> Date: Thu, 25 Nov 2021 15:56:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=9A=E5=91=98=E9=A3=8E=E9=87=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/communityParty/elegant/index.vue | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/src/views/modules/communityParty/elegant/index.vue b/src/views/modules/communityParty/elegant/index.vue index 6dac5ac4..18fb80d3 100644 --- a/src/views/modules/communityParty/elegant/index.vue +++ b/src/views/modules/communityParty/elegant/index.vue @@ -356,31 +356,33 @@ export default { }) }, handleExport() { - let params = {} - // window.location.href = window.SITE_CONFIG['apiURL'] + '/resi/partymember/icpartymemberstyle/export' + let params = { + agencyId: this.$store.state.user.agencyId, + pageSize: 9999, + pageNo: this.currentPage + } // .post('epmetuser/icresiuser/exportExcel', params) - // axios({ - // url: window.SITE_CONFIG['apiURL'] + '/resi/partymember/icpartymemberstyle/export', - // // url: 'epmetuser/icresiuser/exportExcel', - // method: 'post', - // data: params, - // responseType: 'blob' - // }) - this.$http.post('/resi/partymember/icpartymemberstyle/export') + axios({ + url: window.SITE_CONFIG['apiURL'] + '/resi/partymember/icpartymemberstyle/export', + // url: 'epmetuser/icresiuser/exportExcel', + method: 'post', + data: params, + responseType: 'blob' + }) .then(res => { console.log('resllll', res) - // 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对象 + 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对象 }) .catch((err) => { console.log('获取导出情失败', err)