From d4e5321ccc237b55efd164c14e64da7317424405 Mon Sep 17 00:00:00 2001 From: 13176889840 <13176889840@163.com> Date: Wed, 15 Dec 2021 10:56:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=8E=AA=E6=96=BD=E5=AF=BC?= =?UTF-8?q?=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/communityParty/elegant/index.vue | 24 +++---- src/views/modules/visual/measure/service.vue | 62 ++++++++++++++++++- 2 files changed, 71 insertions(+), 15 deletions(-) diff --git a/src/views/modules/communityParty/elegant/index.vue b/src/views/modules/communityParty/elegant/index.vue index e7898638..91fcc877 100644 --- a/src/views/modules/communityParty/elegant/index.vue +++ b/src/views/modules/communityParty/elegant/index.vue @@ -339,18 +339,18 @@ export default { .then((res) => { this.importLoading = false this.importBtnTitle = '导入人员数据' - 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对象 this.getTableData() }) .catch( err => { diff --git a/src/views/modules/visual/measure/service.vue b/src/views/modules/visual/measure/service.vue index b0d9a180..3ea56996 100644 --- a/src/views/modules/visual/measure/service.vue +++ b/src/views/modules/visual/measure/service.vue @@ -116,7 +116,9 @@
- +
+ 导出 +
{ + 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对象 + }) + .catch((err) => { + console.log('获取导出情失败', err) + return this.$message.error('网络错误') + }) + }, getTreeData(data){ if (!Array.isArray(data)) return [] let arr = data.map(item => { @@ -468,6 +511,7 @@ export default { if (item.categoryName == params.name) code = item.categoryCode }) if (code) { + this.categoryCode = code const _arr = this.selectAgency[this.selectAgency.length - 1].split('-') const orgType = _arr[1] !== 'grid' ? 'agency': 'grid' this.getServiceList(_arr[0], orgType, code) @@ -508,6 +552,9 @@ export default { scoped >