From 751b2725ad30e4954df4321f7d10bbf7998a4e6e Mon Sep 17 00:00:00 2001 From: mk <2403457699@qq.com> Date: Wed, 13 Dec 2023 15:16:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=8D=A0=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wennuanzhaoren/personList.vue | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/views/modules/communityService/wennuanzhaoren/personList.vue b/src/views/modules/communityService/wennuanzhaoren/personList.vue index 0431b081d..854160ea8 100644 --- a/src/views/modules/communityService/wennuanzhaoren/personList.vue +++ b/src/views/modules/communityService/wennuanzhaoren/personList.vue @@ -99,6 +99,7 @@
+ 标记享受服务人员 查询
@@ -434,7 +435,43 @@ export default { handleCurrentChange (pageNo) { this.searchFormData.pageNo = pageNo this.handleSearch() - } + }, + // 导出人员 + async handleExport () { + //导出接口>>> + const url = ""; + const { pageSize, pageNo, searchFormData } = this; + axios({ + url: window.SITE_CONFIG["apiURL"] + url, + method: "post", + data: { + pageSize, + pageNo, + ...searchFormData, + }, + responseType: "blob", + }) + .then((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.openxmlformats-officedocument.spreadsheetml.sheet" }); + 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("网络错误"); + }); + }, }, props: { serviceId: {