From b66f26b23e4627907818d0be241b621fe3735f27 Mon Sep 17 00:00:00 2001
From: 王旭 <1377869194@qq.com>
Date: 星期日, 09 十月 2022 17:57:46 +0800
Subject: [PATCH] 登录,操作,资源日志列表接口对接

---
 src/views/maintenance/operationLog.vue |  233 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 116 insertions(+), 117 deletions(-)

diff --git a/src/views/maintenance/operationLog.vue b/src/views/maintenance/operationLog.vue
index 0e90af4..5c17742 100644
--- a/src/views/maintenance/operationLog.vue
+++ b/src/views/maintenance/operationLog.vue
@@ -76,29 +76,50 @@
         </el-table-column>
         <!-- <el-table-column prop="Accessnumber" label="璁块棶缂栧彿" /> -->
         <el-table-column
-          prop="name"
-          :label="$t('operatManage.operationLogObj.resourceName')"
+          align="center"
+          prop="modular"
+          :label="$t('operatManage.operationLogObj.operationModule')"
         />
         <el-table-column
-          prop="operatingsystem"
-          :label="$t('operatManage.operationLogObj.operationType')"
+          align="center"
+          prop="url"
+          :label="$t('operatManage.operationLogObj.url')"
         />
 
         <!-- <el-table-column prop="loginaddress" label="鐧诲綍鍦扮偣" /> -->
         <el-table-column
-          prop="browser"
+          align="center"
+          prop="clazz"
+          :label="$t('operatManage.operationLogObj.className')"
+        />
+        <el-table-column
+          align="center"
+          :formatter="formatType"
+          prop="type"
+          :label="$t('operatManage.operationLogObj.operationType')"
+        />
+        <el-table-column
+          align="center"
+          prop="userid"
           :label="$t('operatManage.operationLogObj.username')"
         />
         <el-table-column
-          prop="operatinginformation"
-          :label="$t('operatManage.operationLogObj.systematicName')"
+          prop="ip"
+          :label="$t('operatManage.operationLogObj.IP')"
         />
-        <el-table-column prop="ip" label="IP" />
 
         <el-table-column
-          prop="date"
+          align="center"
+          prop="optime"
+          :formatter="formatData"
           :label="$t('operatManage.operationLogObj.operatingTime')"
         />
+        <el-table-column
+          align="center"
+          prop="bak"
+          :label="$t('operatManage.operationLogObj.bak')"
+        />
+
         <!-- <el-table-column fixed="right" label="鎿嶄綔" width="100">
           <template #default>
 
@@ -110,11 +131,11 @@
         <el-pagination
           @size-change="handleSizeChange"
           @current-change="handleCurrentChange"
-          :current-page="currentPage4"
+          :current-page="listData.pageIndex"
           :page-sizes="[10, 20, 30, 40]"
-          :page-size="10"
+          :page-size="listData.pageSize"
           layout="total, sizes, prev, pager, next, jumper"
-          :total="9"
+          :total="count"
         >
         </el-pagination>
       </div>
@@ -124,7 +145,7 @@
 
 <script>
 import MyBread from "../../components/MyBread.vue";
-
+import { operateSelectByPageAndCount } from "../../api/api";
 export default {
   //import寮曞叆鐨勭粍浠堕渶瑕佹敞鍏ュ埌瀵硅薄涓墠鑳戒娇鐢�
   components: {
@@ -139,121 +160,99 @@
         region: "",
         jurisdiction: "",
       },
-      tableData: [
-        {
-          date: "2022-08-05",
-          name: "admin",
-          Accessnumber: "1",
-          loginaddress: "鍖椾含甯�",
-          browser: "chrome",
-          operatingsystem: "windows10",
-          state: "鎴愬姛",
-          operatinginformation: "鐧诲綍鎴愬姛",
-          ip: "221.182.31.12",
-        },
-        {
-          date: "2022-08-05",
-          name: "admin",
-          Accessnumber: "1",
-          loginaddress: "鍖椾含甯�",
-          browser: "IE11",
-          operatingsystem: "windows10",
-          state: "鎴愬姛",
-          operatinginformation: "鐧诲綍鎴愬姛",
-          ip: "221.182.31.12",
-        },
-        {
-          date: "2022-08-05",
-          name: "admin",
-          Accessnumber: "1",
-          loginaddress: "鍖椾含甯�",
-          browser: "chrome",
-          operatingsystem: "windows10",
-          state: "鎴愬姛",
-          operatinginformation: "鐧诲綍鎴愬姛",
-          ip: "221.182.31.12",
-        },
-        {
-          date: "2022-08-05",
-          name: "admin",
-          Accessnumber: "1",
-          loginaddress: "鍖椾含甯�",
-          browser: "chrome",
-          operatingsystem: "windows10",
-          state: "鎴愬姛",
-          operatinginformation: "鐧诲綍鎴愬姛",
-          ip: "221.182.31.12",
-        },
-        {
-          date: "2022-08-05",
-          name: "admin",
-          Accessnumber: "1",
-          loginaddress: "鍖椾含甯�",
-          browser: "chrome",
-          operatingsystem: "windows10",
-          state: "鎴愬姛",
-          operatinginformation: "鐧诲綍鎴愬姛",
-          ip: "221.182.31.12",
-        },
-        {
-          date: "2022-08-05",
-          name: "admin",
-          Accessnumber: "1",
-          loginaddress: "鍖椾含甯�",
-          browser: "IE11",
-          operatingsystem: "windows10",
-          state: "鎴愬姛",
-          operatinginformation: "鐧诲綍鎴愬姛",
-          ip: "221.182.31.12",
-        },
-        {
-          date: "2022-08-05",
-          name: "admin",
-          Accessnumber: "1",
-          loginaddress: "鍖椾含甯�",
-          browser: "chrome",
-          operatingsystem: "windows10",
-          state: "鎴愬姛",
-          operatinginformation: "鐧诲綍鎴愬姛",
-          ip: "221.182.31.12",
-        },
-        {
-          date: "2022-08-05",
-          name: "admin",
-          Accessnumber: "1",
-          loginaddress: "鍖椾含甯�",
-          browser: "chrome",
-          operatingsystem: "windows10",
-          state: "鎴愬姛",
-          operatinginformation: "鐧诲綍鎴愬姛",
-          ip: "221.182.31.12",
-        },
-        {
-          date: "2022-08-05",
-          name: "admin",
-          Accessnumber: "1",
-          loginaddress: "鍖椾含甯�",
-          browser: "IE11",
-          operatingsystem: "windows10",
-          state: "鎴愬姛",
-          operatinginformation: "鐧诲綍鎴愬姛",
-          ip: "221.182.31.12",
-        },
-      ],
+      tableData: [],
+      listData: {
+        pageIndex: 1,
+        pageSize: 10,
+      },
+      count: 0,
     };
   },
   methods: {
+    //鏍煎紡鍖栨椂闂�
+    add0(m) {
+      return m < 10 ? "0" + m : m;
+    },
+    //鏍煎紡鍖栨椂闂�
+    format(shijianchuo) {
+      //shijianchuo鏄暣鏁帮紝鍚﹀垯瑕乸arseInt杞崲
+      var time = new Date(shijianchuo);
+      var y = time.getFullYear();
+      var m = time.getMonth() + 1;
+      var d = time.getDate();
+      var h = time.getHours();
+      var mm = time.getMinutes();
+      var s = time.getSeconds();
+      return (
+        y + "-" + this.add0(m) + "-" + this.add0(d)
+        // " " +
+        // this.add0(h) +
+        // ":" +
+        // this.add0(mm) +
+        // ":" +
+        // this.add0(s)
+      );
+    },
+    //鏍煎紡鍖栧垪琛�
+    formatData(row, column) {
+      let data = row[column.property];
+      if (data == null) {
+        return data;
+      }
+      return this.format(data);
+    },
+    //鏍煎紡鍖栫被鍒�
+    formatType(row, column) {
+      let data;
+      switch (row[column.property]) {
+        case 0:
+          data = "鍏跺畠";
+          break;
+        case 1:
+          data = "鏌ョ湅";
+          break;
+        case 2:
+          data = "鏂板";
+          break;
+        case 3:
+          data = "淇敼";
+          break;
+        case 4:
+          data = "鍒犻櫎";
+          break;
+        case 5:
+          data = "涓婁紶";
+          break;
+        case 6:
+          data = "涓嬭浇";
+          break;
+      }
+      return data;
+    },
     handleSizeChange(val) {
-      console.log(`姣忛〉 ${val} 鏉);
+      this.listData.pageSize = val;
+      this.getList();
     },
     handleCurrentChange(val) {
-      console.log(`褰撳墠椤�: ${val}`);
+      this.listData.pageIndex = val;
+      this.getList();
     },
     onSubmit() {
       console.log("submit!");
     },
+    async getList() {
+      const data = await operateSelectByPageAndCount(this.listData);
+      console.log(data);
+      if (data.code != 200) {
+        this.$message.error("鍒楄〃璋冪敤澶辫触");
+      }
+      this.tableData = data.result;
+      this.count = data.count;
+    },
   },
-  created() { },
+  created() {
+    this.getList();
+  },
 };
 </script>
 <style lang="less" scoped>

--
Gitblit v1.9.3