From e7d80dc36ebb42b141016698bdfeb6206da7ae70 Mon Sep 17 00:00:00 2001 From: timerzz Date: Sun, 30 Mar 2025 21:37:45 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E6=B7=BB=E5=8A=A0=E4=B8=8B=E8=BD=BDexce?= =?UTF-8?q?l?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/tools.js | 25 +++++++++++++ src/componse/tools/ExportCheaper.vue | 56 ++++++++++++++++++++++++++++ src/views/tools/index.vue | 20 +++++++--- vite.config.js | 9 ++++- 4 files changed, 103 insertions(+), 7 deletions(-) create mode 100644 src/api/tools.js create mode 100644 src/componse/tools/ExportCheaper.vue diff --git a/src/api/tools.js b/src/api/tools.js new file mode 100644 index 0000000..811a95b --- /dev/null +++ b/src/api/tools.js @@ -0,0 +1,25 @@ +import {mande} from "mande"; + +const tools = mande('/api/v2/tools') + +// 下载Coach Outlet Excel文件 +export const DownloadCoachOutletExcel = (providerId) => { + // return tools.get(`/excel/coach-outlet/${providerId}`, { + // responseType: 'blob' // 指定响应类型为blob,用于文件下载 + // }) + return fetch(`/api/v2/tools/excel/coach-outlet/${providerId}`, { + method: "get", + mode: "no-cors", + referrerPolicy: "no-referrer", + }) + .then((res) => res.blob()) + .then((res) => { + const aElement = document.createElement("a"); + aElement.setAttribute("download", providerId + ".xlsx"); + const href = URL.createObjectURL(res); + aElement.href = href; + aElement.setAttribute("target", "_blank"); + aElement.click(); + URL.revokeObjectURL(href); + }); +} \ No newline at end of file diff --git a/src/componse/tools/ExportCheaper.vue b/src/componse/tools/ExportCheaper.vue new file mode 100644 index 0000000..875b14a --- /dev/null +++ b/src/componse/tools/ExportCheaper.vue @@ -0,0 +1,56 @@ + + + + + \ No newline at end of file diff --git a/src/views/tools/index.vue b/src/views/tools/index.vue index 749589d..8662e67 100644 --- a/src/views/tools/index.vue +++ b/src/views/tools/index.vue @@ -1,15 +1,23 @@ - \ No newline at end of file diff --git a/vite.config.js b/vite.config.js index 53da80f..f750890 100644 --- a/vite.config.js +++ b/vite.config.js @@ -82,7 +82,14 @@ export default defineConfig({ changeOrigin: true, secure: false, ws: true, - } + }, + '/api/v2/tools': { + // target: 'https://ht.timerzz.com:20443/', + target: 'http://localhost:8085/', + changeOrigin: true, + secure: false, + ws: true, + }, }, }, resolve: {