فهرست منبع

日志管理功能代码提交

jingyuanchao 1 سال پیش
والد
کامیت
cb2935c3c3
3فایلهای تغییر یافته به همراه123 افزوده شده و 162 حذف شده
  1. 9 1
      src/api/system/logManagement.js
  2. 82 72
      src/views/system/logManagement/dialog.info.vue
  3. 32 89
      src/views/system/logManagement/index.vue

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

@@ -18,7 +18,7 @@ export function detail(id) {
   })
 }
 
-// 新增服务器信息
+// 新增/编辑 服务器信息
 export function edit(data) {
   return request({
     url: '/system/server',
@@ -26,3 +26,11 @@ export function edit(data) {
     data: data
   })
 }
+
+// 获取服务下的日志列表
+export function getLogList(serverId, checkId) {
+  return request({
+    url: '/system/server/getLogList/' + serverId + '/' + checkId,
+    method: 'get'
+  })
+}

+ 82 - 72
src/views/system/logManagement/dialog.info.vue

@@ -1,31 +1,62 @@
 <template>
   <div class="edu-training-edit">
-    <DialogCom title="演练范本详情" :visible.sync="isShow" width="1000px" append-to-body>
+    <DialogCom :title="this.title" :visible.sync="isShow" append-to-body>
       <div class="page-body">
-        <el-descriptions
-          class="contentArea"
-          :column="1"
-          size="medium"
-          border
-          :contentStyle="content_style"
-          :label-style="labelStyle"
-        >
-          <el-descriptions-item labelClassName="gx_info_label" label="演练类型">
-            {{
-              getLabel(dict.type.core_drill_type, formData.drillType, "未知")
-            }}
-          </el-descriptions-item>
-          <el-descriptions-item labelClassName="gx_info_label" label="演练场景">
-            {{ formData.drillProjects }}
-          </el-descriptions-item>
-          <el-descriptions-item
-            labelClassName="gx_info_label"
-            span="2"
-            label="预设案由"
-          >
-            <p class="text-content text_nbsp"> {{ formData.defaultCause }}</p>
-          </el-descriptions-item>
-        </el-descriptions>
+        <div class="extend_mod" style="max-height: 500px;">
+          <el-table :data="logList" border style="width: 100%;max-height: 500px;overflow-y: auto;">
+            <el-table-column
+              prop="fileName"
+              label="文件名称"
+              align="center"
+            ></el-table-column>
+            <el-table-column
+              prop="fileType"
+              label="文件类型"
+              align="center"
+            >
+              <template slot-scope="scope">
+                {{ scope.row.fileType == 1 ? '目录' : '文件' }}
+              </template>
+
+            </el-table-column>
+            <el-table-column
+              prop="fileSize"
+              label="文件大小"
+              align="center"
+            >
+            </el-table-column>
+            <el-table-column
+              label="操作"
+              align="center"
+              width="200"
+              class-name="small-padding fixed-width"
+            >
+              <template slot-scope="scope">
+                <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-edit-outline"
+                  @click="handleUpdate(scope.row)"
+                >重新获取
+                </el-button>
+                <el-button
+                  size="mini"
+                  type="text"
+                  icon="el-icon-delete"
+                  @click="handleDelete(scope.row)"
+                >下载
+                </el-button>
+              </template>
+            </el-table-column>
+          </el-table>
+        </div>
       </div>
 
       <div slot="footer" class="dialog-footer">
@@ -36,35 +67,24 @@
 </template>
 
 <script>
-import { mapState, mapMutations } from "vuex";
-import { getDrillDictionary } from "@/api/core/drill/drillDictionary";
-import { getLabel } from "@/views/commonOption";
+import {mapState, mapMutations} from "vuex";
+import {getLogList} from "@/api/system/logManagement";
+import {getLabel} from "@/views/commonOption";
+
 export default {
-  components: { },
-  dicts: ["drill_task_status", "core_drill_type"],
+  components: {},
+  dicts: [],
   data() {
     const params = this.$route.params;
     return {
       id: params ? params.id : null,
       isShow: false,
       formData: this.reset(),
-      drillTypeOptions: [],
-      formFileListDefualtValue: [],
-      labelStyle: {
-        color: "#000",
-        "text-align": "center",
-        height: "40px",
-        "min-width": "150px",
-        "word-break": "keep-all",
-      },
-      content_style: {
-        "text-align": "left",
-        "min-width": "300px",
-        "word-break": "break-all",
-      },
-      iconClasses: ["icon-rate-face-1", "icon-rate-face-2", "icon-rate-face-3"], // 等同于 { 2: 'icon-rate-face-1', 4: { value: 'icon-rate-face-2', excluded: true }, 5: 'icon-rate-face-3' }
+      title: '',
+      logList: [],
     };
   },
+
   props: {},
   watch: {},
   computed: {
@@ -76,51 +96,41 @@ export default {
     reset(other = {}) {
       return {
         id: null,
-        drillType: null,
-        defaultCause: null,
-        drillProjects: null,
+        fileName: null,
+        fileSize: null,
+        fileType: null,
         ...other,
       };
     },
-    async refresh(id, other) {
-      if (!id) {
-        this.reset(other);
+    async refresh(serverId, serviceId) {
+
+      if (!serverId || !serviceId) {
+        this.reset(serverId);
       } else {
-        getDrillDictionary(id).then((response) => {
-          this.formData = response.data;
+        getLogList(serverId, serverId).then((response) => {
+          this.logList = response.data;
           this.loading = false;
-      });
-        // getDrillTask(id).then((response) => {
-        //   this.formData = response.data;
-        //   this.formFileListDefualtValue = response.data.fileList;
-        //   this.formData.signImageList = this.getSingImageList();
-        //   this.loading = false;
-        // });
+        });
       }
     },
-    async show(id, other = {}) {
-      this.id = id;
-      await this.refresh(id, other);
+    async show(server, service, other = {}) {
+      this.id = server;
+      this.title = service.checkName + "日志详情页";
+      await this.refresh(server.id, service.id);
       this.isShow = true;
     },
     // 事件
     onHide() {
       this.isShow = false;
     },
-    initDrillTypeOptions() {
-      initList().then((response) => {
-        this.drillTypeOptions = response;
-      });
-    },
-    // 事件
-    //apimark//
   },
-  mounted() {},
+  mounted() {
+  },
 };
 </script>
 
 <style lang="scss" scoped>
-.text-content{
+.text-content {
   margin: 0;
   max-height: 500px;
   overflow: auto;

+ 32 - 89
src/views/system/logManagement/index.vue

@@ -1,11 +1,6 @@
 <template>
   <div class="app-container">
     <el-row :gutter="10">
-      <!--机构数据-->
-      <!-- <el-col :span="4" :xs="24">
-        <org-tree v-model="queryParams.orgId" @defaultKey="getDefaultKey" @checkChange="checkChange"
-                  @click="clickTreeNode" wholeTree></org-tree>
-      </el-col> -->
       <el-col :span="24" :xs="24">
         <div class="main-right-box">
           <div class="main-search-box">
@@ -16,20 +11,6 @@
               :inline="true"
               v-show="showSearch"
             >
-              <!-- <el-form-item label="编号" prop="id">
-            <el-input v-model="queryParams.id" placeholder="请输入编号" clearable
-                      @keyup.enter.native="handleQuery"/>
-          </el-form-item> -->
-              <el-form-item label="机构名称">
-                <org-tree
-                  v-model="queryParams.orgId"
-                  @defaultKey="getDefaultKey"
-                  @checkChange="checkChange"
-                  @click="clickTreeNode"
-                  wholeTree
-                  ref="orgTree"
-                ></org-tree>
-              </el-form-item>
               <el-form-item label="服务器名称" prop="serverName">
                 <el-input
                   v-model="queryParams.serverName"
@@ -75,38 +56,32 @@
                 >新增服务器信息
                 </el-button>
               </el-col>
-              <!--          <el-col :span="1.5">
-            <el-button
-              type="warning"
-              plain
-              icon="el-icon-download"
-              size="mini"
-              @click="handleExport"
-              v-hasPermi="['core:drillDictionary:export']"
-            >导出
-            </el-button>
-          </el-col>-->
-              <right-toolbar
-                :showSearch.sync="showSearch"
-                @queryTable="getList"
-              ></right-toolbar>
+              <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
             </el-row>
           </div>
-          <el-table
-            border
-            height="646"
-            size="small"
-            v-loading="loading"
-            :data="serverDataList"
-            @selection-change="handleSelectionChange"
-          >
+          <el-table border height="646" size="small" v-loading="loading" :data="serverDataList" @selection-change="handleSelectionChange">
+            <el-table-column type="expand">
+              <template slot-scope="props">
+                <el-table :data="props.row.serverList" class="sonTable" border style="width: 90%">
+                  <el-table-column prop="checkName" label="服务名称" align="center"/>
+                  <el-table-column prop="displayName" label="描述" align="center"/>
+                  <el-table-column prop="pid" label="进程PID" align="center"/>
+                  <el-table-column prop="startLong" label="运行时长" align="center"/>
+                  <el-table-column prop="checkStatusText" label="服务状态" align="center"/>
+                  <el-table-column label="操作" align="center" width="200" class-name="small-padding fixed-width">
+                    <template slot-scope="scope">
+                    <el-button size="mini" type="text" icon="el-icon-edit-outline" @click="handleGetLog(props.row,scope.row)">
+                      日志获取
+                    </el-button>
+                  </template>
+
+                  </el-table-column>
+                </el-table>
+              </template>
+            </el-table-column>
             <el-table-column type="index" label="序号" align="center" width="100" prop="no">
               <template slot-scope="scope">
-                {{
-                  (queryParams.pageNum - 1) * queryParams.pageSize +
-                  scope.$index +
-                  1
-                }}
+                {{(queryParams.pageNum - 1) * queryParams.pageSize +scope.$index +1}}
               </template>
             </el-table-column>
             <el-table-column label="服务器名称" align="center" prop="serverName"/>
@@ -122,14 +97,6 @@
               class-name="small-padding fixed-width"
             >
               <template slot-scope="scope">
-                <!--                <el-button
-                                  size="mini"
-                                  type="text"
-                                  icon="el-icon-view"
-                                  @click="handleDetail(scope.row.id)"
-                                  v-hasPermi="['core:drillDictionary:query']"
-                                  >详情
-                                </el-button>-->
                 <el-button
                   size="mini"
                   type="text"
@@ -198,18 +165,15 @@
 
 <script>
 import {detail, edit, listData,} from "@/api/system/logManagement";
-import OrgTree from "@/components/orgTree/orgQuerySelector.vue";
 import BtnTip from "@/components/btnTip";
 import tableList from "@/mixins/tableList";
-import {queryKnowledgeList} from "@/api/core/edu/knowledge";
-import KTextarea from "@/components/common/textarea.vue";
 import {mapGetters} from "vuex";
 import DialogInfo from "./dialog.info";
 
 export default {
   name: "DrillDictionary",
-  components: {OrgTree, BtnTip, KTextarea, DialogInfo},
-  dicts: ["core_drill_type", "core_drill_category"],
+  components: { BtnTip, DialogInfo},
+  dicts: [],
   mixins: [tableList],
   data() {
     return {
@@ -236,7 +200,6 @@ export default {
         pageNum: 1,
         pageSize: 10,
         serverName: null,
-        checkSub: true,
       },
       // 表单参数
       form: {},
@@ -258,7 +221,7 @@ export default {
     ...mapGetters(["orgId"]),
   },
   created() {
-    // this.getList();
+     this.getList();
   },
   methods: {
     validateIp(rule, value, callback) {
@@ -309,26 +272,7 @@ export default {
       };
       this.resetForm("form");
     },
-    getDefaultKey(key) {
-      this.queryParams.orgId = key;
-      this.getList();
-    },
-    //单选框状态改变
-    checkChange(state) {
-      this.queryParams.checkSub = state;
-      this.handleQuery();
-    },
 
-    // 节点单击事件
-    clickTreeNode(data) {
-      this.queryParams.orgId = data.id;
-      this.handleQuery();
-    },
-    initKnowledgeList() {
-      queryKnowledgeList().then((response) => {
-        this.knowledgeList = response;
-      });
-    },
     /** 搜索按钮操作 */
     handleQuery() {
       this.queryParams.pageNum = 1;
@@ -337,9 +281,6 @@ export default {
     /** 重置按钮操作 */
     resetQuery() {
       this.resetForm("queryForm");
-      this.$refs["orgTree"].setSelectTop();
-      this.queryParams.checkSub = true;
-      this.$refs["orgTree"].setCheckSub(this.queryParams.checkSub)
       this.handleQuery();
     },
     // 多选框选中数据
@@ -354,9 +295,7 @@ export default {
       this.open = true;
       this.title = "新增服务器信息";
     },
-    canEdit(row) {
-      return row.orgId == this.$store.getters.orgId;
-    },
+
     /** 修改按钮操作 */
     handleUpdate(row) {
       this.reset();
@@ -367,8 +306,9 @@ export default {
         this.title = "编辑服务器信息";
       });
     },
-    handleDetail(id) {
-      this.$refs["infoDialog"].show(id, {});
+
+    handleGetLog(server,service) {
+      this.$refs["infoDialog"].show(server,service, {});
     },
     /** 提交按钮 */
     submitForm() {
@@ -424,4 +364,7 @@ export default {
   overflow: hidden;
   text-overflow: ellipsis;
 }
+.sonTable {
+  margin: 0 auto;
+}
 </style>