From 5869c34abb78ef970170f9713819e91aa8b64a65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E5=B8=86?= <201379873@qq.com> Date: Wed, 10 Apr 2024 23:05:09 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=AF=BC=E5=87=BA=E5=8A=A0?= =?UTF-8?q?=E8=BD=BD=E6=9D=A1=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8=EF=BC=8C?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/apis/system/log.ts | 2 +- src/apis/system/type.ts | 5 ++++- src/hooks/modules/useDownload.ts | 7 +++---- src/utils/http.ts | 1 + src/views/system/log/LoginLog.vue | 2 +- src/views/system/log/OperationLog.vue | 2 +- 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/apis/system/log.ts b/src/apis/system/log.ts index ce39036..15d0394 100644 --- a/src/apis/system/log.ts +++ b/src/apis/system/log.ts @@ -4,7 +4,7 @@ import type * as System from './type' const BASE_URL = '/system/log' /** @desc 查询日志列表 */ -export function listLog(query: System.LogQuery) { +export function listLog(query: System.PageLogQuery) { return http.get>(`${BASE_URL}`, query) } diff --git a/src/apis/system/type.ts b/src/apis/system/type.ts index f7cc7fa..8de1008 100644 --- a/src/apis/system/type.ts +++ b/src/apis/system/type.ts @@ -44,7 +44,10 @@ export interface LogDetailResp extends LogResp { responseHeaders: string responseBody: string } -export interface LogQuery extends PageQuery { +// 系统日志分页查询条件 +export interface PageLogQuery extends PageQuery,LogQuery{} +// 系统日志查询条件 +export interface LogQuery{ description?: string module?: string ip?: string diff --git a/src/hooks/modules/useDownload.ts b/src/hooks/modules/useDownload.ts index 12154b9..ee26467 100644 --- a/src/hooks/modules/useDownload.ts +++ b/src/hooks/modules/useDownload.ts @@ -11,14 +11,13 @@ interface NavigatorWithMsSaveOrOpenBlob extends Navigator { msSaveOrOpenBlob(blob: Blob, fileName: string): void } export const useDownload = async ( - api: (param: any) => Promise, - tempName: string = '', - params: any = {}, + api: () => Promise, isNotify = true, + tempName: string = '', fileType = '.xlsx' ) => { try { - const res = await api(params) + const res = await api() if (res.headers['content-disposition']) { tempName = decodeURI(res.headers['content-disposition'].split(';')[1].split('=')[1]); } else { diff --git a/src/utils/http.ts b/src/utils/http.ts index 7ed4fef..da66f85 100644 --- a/src/utils/http.ts +++ b/src/utils/http.ts @@ -62,6 +62,7 @@ http.interceptors.response.use( const { data } = response const { success, code, msg } = data if(response.request.responseType==='blob'){ + NProgress.done() return response } // 成功 diff --git a/src/views/system/log/LoginLog.vue b/src/views/system/log/LoginLog.vue index ee2d443..f4edbd4 100644 --- a/src/views/system/log/LoginLog.vue +++ b/src/views/system/log/LoginLog.vue @@ -97,7 +97,7 @@ const columns: TableInstance['columns'] = [ ] //导出登录日志 const onExportFile = ()=>{ - useDownload(exportLog,'',queryForm) + useDownload(()=>exportLog(queryForm)) } const queryForm = reactive({ module: '登录', diff --git a/src/views/system/log/OperationLog.vue b/src/views/system/log/OperationLog.vue index c0b206b..f4462b2 100644 --- a/src/views/system/log/OperationLog.vue +++ b/src/views/system/log/OperationLog.vue @@ -111,7 +111,7 @@ const columns: TableInstance['columns'] = [ ] //导出操作日志 const onExportFile = ()=>{ - useDownload(exportOperateLog,'',queryForm) + useDownload(()=>exportOperateLog(queryForm)) } const queryForm = reactive({ description: undefined,