From f6a88767966d13be00a818b1c69cb8cf310cc9c9 Mon Sep 17 00:00:00 2001 From: jianjun Date: Wed, 24 Aug 2022 15:07:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A4=BE=E4=BC=9A=E7=BB=84=E7=BB=87=E5=86=8D?= =?UTF-8?q?=E6=AC=A1=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../communityService/shzz/cpts/edit.vue | 10 ++-- .../modules/communityService/shzz/index.vue | 53 ++++++++++++++++--- 2 files changed, 52 insertions(+), 11 deletions(-) diff --git a/src/views/modules/communityService/shzz/cpts/edit.vue b/src/views/modules/communityService/shzz/cpts/edit.vue index bcd5c95be..8acdd3a6e 100644 --- a/src/views/modules/communityService/shzz/cpts/edit.vue +++ b/src/views/modules/communityService/shzz/cpts/edit.vue @@ -31,7 +31,7 @@ :on-progress="handleProgress" :on-success="handleImgSuccess" :before-upload="beforeImgUpload" - accept=".jpg,.jpeg,.png,.gif,.bmp,.pdf,.JPG,.JPEG,.PBG,.GIF,.BMP"> + accept=".jpg,.jpeg,.png,.gif,.bmp,.JPG,.JPEG,.PBG,.GIF,.BMP"> @@ -71,7 +71,7 @@ > - - + --> - +
-
联系电话
+
服务电话
新增 + 下载模板 - - + --> { + // 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("网络错误"); + }); + }, + }, };