Browse Source

更改日志下载方式

yukai 1 year ago
parent
commit
a543145eb7
2 changed files with 6 additions and 8 deletions
  1. 1 0
      src/api/system/index.ts
  2. 5 8
      src/views/system/monitor/lastLinesLog/index.vue

+ 1 - 0
src/api/system/index.ts

@@ -175,5 +175,6 @@ export default {
   lastLinesLog: {
   lastLinesLog: {
     getList: (params: object) => get('/system/monitor/listLogs', params),
     getList: (params: object) => get('/system/monitor/listLogs', params),
     detail: (params: object) => get('/system/monitor/lastLinesLog', params),
     detail: (params: object) => get('/system/monitor/lastLinesLog', params),
+    down:(params:object)=>file('system/monitor/downloadLog',params),
   },
   },
 }
 }

+ 5 - 8
src/views/system/monitor/lastLinesLog/index.vue

@@ -30,8 +30,8 @@
 import api from '/@/api/system';
 import api from '/@/api/system';
 import { useSearch } from '/@/hooks/useCommon';
 import { useSearch } from '/@/hooks/useCommon';
 import getOrigin from '/@/utils/origin'
 import getOrigin from '/@/utils/origin'
+import downloadFile from '/@/utils/download';
 import { ref } from 'vue';
 import { ref } from 'vue';
-const queryRef = ref();
 const { params, tableData, getList, loading } = useSearch<any[]>(api.lastLinesLog.getList, 'list', { keyWord: '' });
 const { params, tableData, getList, loading } = useSearch<any[]>(api.lastLinesLog.getList, 'list', { keyWord: '' });
 getList();
 getList();
 
 
@@ -44,19 +44,16 @@ const view = (row: any) => {
 	es.addEventListener('log', ({ data }) => {
 	es.addEventListener('log', ({ data }) => {
 		topmsg.value=data;
 		topmsg.value=data;
 	});
 	});
-
 	api.lastLinesLog.detail({name:row.name}).then((res: any) => {
 	api.lastLinesLog.detail({name:row.name}).then((res: any) => {
 		errorMessage.value=res.list;
 		errorMessage.value=res.list;
+		dialogVisible.value=true;
     });
     });
-
-	dialogVisible.value=true;
-
 };
 };
-
-
 const down = (row: any) => {
 const down = (row: any) => {
-	window.open(getOrigin(import.meta.env.VITE_SERVER_URL + "api/v1/system/monitor/downloadLog?name="+row.name));
+	// window.open(getOrigin(import.meta.env.VITE_SERVER_URL + "system/monitor/downloadLog?name="+row.name));
+	api.lastLinesLog.down({ name: row.name }).then((res: any) => downloadFile(res,row.name))
 };
 };
+
 </script>
 </script>
 <style scoped>
 <style scoped>
 .error-line {
 .error-line {