From 79c65e15cf5d394c6e48e51f390c382c3b789f59 Mon Sep 17 00:00:00 2001 From: xingyuv Date: Mon, 20 Mar 2023 15:49:39 +0800 Subject: [PATCH] feat(view): post init --- src/api/system/post/index.ts | 2 +- src/utils/http/axios/Axios.ts | 4 ++-- src/views/system/post/index.vue | 21 ++++++++++++++++++--- 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/api/system/post/index.ts b/src/api/system/post/index.ts index b541f45..a767105 100644 --- a/src/api/system/post/index.ts +++ b/src/api/system/post/index.ts @@ -54,5 +54,5 @@ export const deletePostApi = (id: number) => { // 导出岗位 export const exportPostApi = (params: PostExportReqVO) => { - return defHttp.download({ url: '/system/post/export', params }) + return defHttp.download({ url: '/system/post/export', params }, '导出岗位.xls') } diff --git a/src/utils/http/axios/Axios.ts b/src/utils/http/axios/Axios.ts index a4a416d..20d0170 100644 --- a/src/utils/http/axios/Axios.ts +++ b/src/utils/http/axios/Axios.ts @@ -236,7 +236,7 @@ export class VAxios { return this.request({ ...config, method: 'DELETE' }, options) } - download(config: AxiosRequestConfig, title: string, options?: RequestOptions): Promise { + download(config: AxiosRequestConfig, title?: string, options?: RequestOptions): Promise { let conf: CreateAxiosOptions = cloneDeep({ ...config, method: 'GET', @@ -264,7 +264,7 @@ export class VAxios { resolve(res as unknown as Promise) // download file if (typeof res != undefined) { - downloadByData(res?.data as unknown as BlobPart, title) + downloadByData(res?.data as unknown as BlobPart, title || 'export') } }) .catch((e: Error | AxiosError) => { diff --git a/src/views/system/post/index.vue b/src/views/system/post/index.vue index cc75456..1b1156c 100644 --- a/src/views/system/post/index.vue +++ b/src/views/system/post/index.vue @@ -3,6 +3,7 @@