From f3a6a0a09252b0112771749026f20dedd58bbdb7 Mon Sep 17 00:00:00 2001 From: lancer <1905818361@qq.com> Date: Thu, 23 Dec 2021 16:14:13 +0800 Subject: [PATCH] init --- src/util/util.js | 35 +++++++++++++++++++ src/views/Customer/index.vue | 9 +++++ src/views/ReceivingRecords/index.vue | 16 +++++++++ src/views/Statistics/BuildingContrast.vue | 31 ++++++++++++++++ src/views/Statistics/ConsultantBrand.vue | 21 +++++++++++ src/views/Statistics/MentoringAbility.vue | 22 ++++++++++++ src/views/Statistics/ReceptionStatistical.vue | 26 ++++++++++++++ src/views/Statistics/TheTeamCompared.vue | 25 +++++++++++++ src/views/Statistics/TrendAnalysis.vue | 12 +++++++ src/views/Template/PinspeakwordsList.vue | 12 +++++++ src/views/Template/taboo.vue | 12 +++++++ src/views/Template/wrongword.vue | 10 ++++++ src/views/admin/user/index.vue | 1 + src/views/building/index.vue | 2 +- 14 files changed, 233 insertions(+), 1 deletion(-) diff --git a/src/util/util.js b/src/util/util.js index 85d74bf..fdc64e0 100644 --- a/src/util/util.js +++ b/src/util/util.js @@ -370,3 +370,38 @@ export function getQueryString(url, paraName) { return '' } } +// 导出.Excel公用方法 +export function exportMethodPost(url, name, data = {}) { + axios({ + method: "get", + url: url, + params:data, + responseType: "blob", + }) + .then((res) => { + let blob = new Blob([res], { type: "application/vnd.ms-excel" }); + let date = new Date(); + let time = date.toLocaleDateString(); + // console.log(time, "时间"); + if ("download" in document.createElement("a")) { + const link = document.createElement("a"); + link.style.display = "none"; + link.href = URL.createObjectURL(blob); + // link.download = res.headers['content-disposition'] //下载后文件名 + link.download = (name || "导出文件") + time + ".xlsx"; //下载的文件名 + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } else { + // console.log("--------------------jingla") + let fileName = (name || "导出文件") + time + ".xlsx"; //下载的文件名 + navigator.msSaveBlob(blob, fileName); + } + }) + .catch((error) => { + // Message.error({ + // message: '网络连接错误' + // }) + console.log(error); + }); +} diff --git a/src/views/Customer/index.vue b/src/views/Customer/index.vue index b93275a..c01c371 100644 --- a/src/views/Customer/index.vue +++ b/src/views/Customer/index.vue @@ -213,6 +213,9 @@ 筛选 清空筛选条件 +
+ 导出 +
@@ -310,6 +313,7 @@