Browse Source

Merge branch 'v0.1.1_alarm' of http://10.87.21.221:8000/jzyd_yyds/soc_web into v0.1.1_alarm

jiawuxian 1 year ago
parent
commit
70951f4d8b
2 changed files with 39 additions and 18 deletions
  1. 9 0
      src/api/system/logManagement.js
  2. 30 18
      src/views/system/logManagement/dialog.info.vue

+ 9 - 0
src/api/system/logManagement.js

@@ -34,3 +34,12 @@ export function getLogList(serverId, checkId) {
     method: 'get'
   })
 }
+
+// 转存目标服务器上的日志到 挂载目录下
+export function transferLogData(data) {
+  return request({
+    url: '/system/server/transferLog',
+    method: 'post',
+    data: data
+  })
+}

+ 30 - 18
src/views/system/logManagement/dialog.info.vue

@@ -3,11 +3,11 @@
     <DialogCom :title="this.title" :visible.sync="isShow" append-to-body>
       <div class="page-body">
         <div class="extend_mod" style="max-height: 500px;">
-          <el-table :data="logList" border style="width: 100%;max-height: 500px;overflow-y: auto;">
+          <el-table :data="logList" border style="width: 100%;max-height: 500px;overflow-y: auto;" row-key="id" :default-expand-all="false" :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
             <el-table-column
               prop="fileName"
               label="文件名称"
-              align="center"
+              align="left"
             ></el-table-column>
             <el-table-column
               prop="fileType"
@@ -15,7 +15,7 @@
               align="center"
             >
               <template slot-scope="scope">
-                {{ scope.row.fileType == 1 ? '目录' : '文件' }}
+                {{ scope.row.fileType == 1 ? '文件' : '目录' }}
               </template>
 
             </el-table-column>
@@ -36,21 +36,16 @@
                   size="mini"
                   type="text"
                   icon="el-icon-edit-outline"
-                  @click="handleUpdate(scope.row)"
+                  v-if="scope.row.fileType ==1 "
+                  @click="transferLog(scope.row)"
                 >获取日志
                 </el-button>
                 <el-button
                   size="mini"
                   type="text"
-                  icon="el-icon-edit-outline"
-                  @click="handleUpdate(scope.row)"
-                >重新获取
-                </el-button>
-                <el-button
-                  size="mini"
-                  type="text"
                   icon="el-icon-delete"
-                  @click="handleDelete(scope.row)"
+                  v-if="scope.row.exit == 1"
+
                 >下载
                 </el-button>
               </template>
@@ -67,8 +62,8 @@
 </template>
 
 <script>
-import {mapState, mapMutations} from "vuex";
-import {getLogList} from "@/api/system/logManagement";
+import {mapMutations, mapState} from "vuex";
+import {getLogList, transferLogData} from "@/api/system/logManagement";
 import {getLabel} from "@/views/commonOption";
 
 export default {
@@ -82,6 +77,8 @@ export default {
       formData: this.reset(),
       title: '',
       logList: [],
+      serverId: null,
+      serviceId: null,
     };
   },
 
@@ -95,7 +92,6 @@ export default {
     getLabel,
     reset(other = {}) {
       return {
-        id: null,
         fileName: null,
         fileSize: null,
         fileType: null,
@@ -103,22 +99,38 @@ export default {
       };
     },
     async refresh(serverId, serviceId) {
-
       if (!serverId || !serviceId) {
         this.reset(serverId);
       } else {
-        getLogList(serverId, serverId).then((response) => {
+        getLogList(serverId, serviceId).then((response) => {
           this.logList = response.data;
           this.loading = false;
         });
       }
     },
     async show(server, service, other = {}) {
-      this.id = server;
+      this.serverId = server.id;
+      this.serviceId = service.id;
       this.title = service.checkName + "日志详情页";
       await this.refresh(server.id, service.id);
       this.isShow = true;
     },
+
+    transferLog(row) {
+      console.log(row)
+      let data = {
+        serverId: this.serverId,
+        parentPath: row.parentPath,
+        path: row.path,
+        rootDir: row.path,
+      };
+      transferLogData(data).then((response) => {
+        this.$message.success("获取成功");
+      });
+    },
+    checkExit(row) {
+      return;
+    },
     // 事件
     onHide() {
       this.isShow = false;