From 84ad5590bafc58e17ebcf7ebdce2cd70c0c22ea9 Mon Sep 17 00:00:00 2001
From: heyujie <516346543@qq.com>
Date: 星期五, 24 九月 2021 18:54:56 +0800
Subject: [PATCH] 日期时间新版

---
 src/pages/syslog/views/operationLog.vue |   44 ++++++++++++++++++++++++--------------------
 1 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/src/pages/syslog/views/operationLog.vue b/src/pages/syslog/views/operationLog.vue
index 523cf69..7483c66 100644
--- a/src/pages/syslog/views/operationLog.vue
+++ b/src/pages/syslog/views/operationLog.vue
@@ -27,7 +27,7 @@
             <el-button
               slot="append"
               icon="el-icon-search"
-              @click="getOperationLog"
+              @click="getOperationLog(1)"
             ></el-button>
           </el-input>
         </div>
@@ -59,7 +59,7 @@
             placeholder="璇烽�夋嫨"
             size="small"
             :disabled="curModule == ''"
-            @change="getOperationLog"
+            @change="getOperationLog(1)"
           >
             <!-- :disabled="gongnengOptions.length==0" -->
             <el-option
@@ -77,7 +77,7 @@
             v-model="result"
             placeholder="璇烽�夋嫨"
             size="small"
-            @change="getOperationLog"
+            @change="getOperationLog(1)"
           >
             <el-option
               v-for="item in resultOptions"
@@ -97,7 +97,6 @@
         highlight-current-row
         :data="tableData"
         :header-cell-style="{ background: '#f8f8f8', color: '#222222' }"
-        @selection-change="handleSelectionChange"
         style="width: 100%"
       >
         <el-table-column :align="'center'" label="搴忓彿" type="index" width="50">
@@ -123,7 +122,7 @@
         ></el-table-column>
         <el-table-column
           :align="'center'"
-          prop="procName"
+          prop="function"
           label="鎿嶄綔鍔熻兘"
         ></el-table-column>
         <el-table-column
@@ -203,7 +202,7 @@
     };
   },
   mounted() {
-    this.getTimeRange(24 * 60 * 60 * 1000);
+    this.getTimeRange();
     this.getOperationLog();
     this.getOptions();
   },
@@ -217,7 +216,7 @@
       this.getOperationLog();
     },
     moduleChange(val) {
-      this.getOperationLog();
+      this.getOperationLog(1);
       this.gongneng = "";
       getOperations({
         module: this.curModule,
@@ -233,7 +232,7 @@
     choseRange(item, i) {
       switch (item) {
         case "浠婃棩":
-          this.getTimeRange(24 * 60 * 60 * 1000);
+          this.getTimeRange();
           break;
         case "杩戜笁澶�":
           this.getTimeRange(24 * 60 * 60 * 1000 * 3);
@@ -250,11 +249,14 @@
         default:
           break;
       }
-      this.getOperationLog();
+      this.getOperationLog(1);
       this.activeDateChoise = i;
     },
-    getOperationLog(timeStart, timeEnd) {
-      const data = {
+    getOperationLog(typ) {
+      if (typ == 1) {
+        this.page = 1;
+      }
+      queryOperationLog({
         timeStart: this.timeStart,
         timeEnd: this.timeEnd,
         page: this.page,
@@ -263,8 +265,7 @@
         function: this.gongneng,
         result: this.result,
         fuzzySearch: this.fuzzySearch,
-      };
-      queryOperationLog(data).then((res) => {
+      }).then((res) => {
         this.tableData = res.data.logs;
         this.total = res.data.total;
       });
@@ -278,10 +279,11 @@
       return `${date.getFullYear()}-${month}-${day} ${hour}:${minute}:${second}`;
     },
     getTimeRange(gap) {
-      var date = new Date(); //褰撳墠鏃堕棿
-      var preDay = new Date(new Date().getTime() - gap);
+      var preDay;
+      preDay = gap
+        ? new Date(new Date().getTime() - gap)
+        : new Date(new Date().setHours(0, 0, 0, 0));
       this.timeStart = this.getTimeStr(preDay);
-      this.timeEnd = this.getTimeStr(date);
     },
   },
 };
@@ -350,7 +352,8 @@
         display: flex;
         align-items: baseline;
         width: fit-content;
-        margin-right: 20px;    min-width: 120px;
+        margin-right: 20px;
+        min-width: 120px;
         .name {
           margin-right: 5px;
           min-width: fit-content;
@@ -378,9 +381,10 @@
     }
   }
   .el-pagination {
-    padding: 20px 5px;    height: 100%;
-    box-sizing: border-box;    background-color: white;
-
+    padding: 20px 5px;
+    height: 100%;
+    box-sizing: border-box;
+    background-color: white;
   }
 }
 </style>

--
Gitblit v1.8.0