From 79d9fc857559982b00b68b2d709807bdc4cd286f Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 11 Apr 2022 10:58:17 +0800
Subject: [PATCH] minio 地址修改

---
 src/views/securityAnalysis/child/loginRecord.vue |  146 ++++++++++++++++++++++++++++++------------------
 1 files changed, 92 insertions(+), 54 deletions(-)

diff --git a/src/views/securityAnalysis/child/loginRecord.vue b/src/views/securityAnalysis/child/loginRecord.vue
index 571f0a8..3ae3092 100644
--- a/src/views/securityAnalysis/child/loginRecord.vue
+++ b/src/views/securityAnalysis/child/loginRecord.vue
@@ -2,26 +2,41 @@
   <div
     :class="[
       'certificateTJ',
-      $store.state.control.windowWidth >= 1024 ? 'oneRowSearch' : '',
+      $store.state.control.screenSize == 1366 ? 'smallSize' : 'normalSize',
+      $store.state.control.windowWidth >= 1024 ? 'tooRowSearch1' : ''
     ]"
   >
     <avue-crud
+      class="tablesss"
       :option="option"
       :data="data"
       :page.sync="page"
       :search.sync="search"
       :table-loading="loading"
-      @on-load="onLoad(page)"
+      @on-load="onLoad"
       @search-change="searchChange"
       @search-reset="searchReset"
       @refresh-change="refreshChange"
     >
+      <template slot="menuLeft">
+        <el-button
+          type="warning"
+          size="small"
+          plain
+          icon="el-icon-download"
+          @click="handleExportLoginRecord"
+          >导出
+        </el-button>
+      </template>
     </avue-crud>
   </div>
 </template>
 
 <script>
-import { getInformationLoginPage } from "@/api/loginRecord/loginRecord"; // 保安员
+import { getInformationLoginPage } from "@/api/loginRecord/loginRecord";
+import Qs from "qs";
+import { getToken } from "@/util/auth";
+import { mapGetters } from "vuex";
 export default {
   props: ["card"],
   data() {
@@ -33,7 +48,7 @@
         pageSize: 10,
         currentPage: 1,
         total: 0,
-        ...this.$store.state.control.changePageSize,
+        ...this.$store.state.control.changePageSize
       },
       query: {},
       search: {},
@@ -65,9 +80,9 @@
               {
                 required: true,
                 message: "请输入登录时间",
-                trigger: "blur",
-              },
-            ],
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "企业名称",
@@ -75,27 +90,12 @@
             disabled: true,
             overHidden: true,
             searchSpan: 5,
-            search: true,
+            search: true
           },
           {
             label: "所属辖区",
             prop: "jurisdictionName",
-            type: "select",
-            dicData: [
-              {
-                label: "男",
-                value: 1,
-              },
-              {
-                label: "女",
-                value: 2,
-              },
-              {
-                label: "未知",
-                value: 3,
-              },
-            ],
-            display: false,
+            display: false
           },
           {
             label: "企业属性",
@@ -105,67 +105,72 @@
             dicUrl: "/api/blade-system/dict-biz/dictionary?code=stats",
             props: {
               label: "dictValue",
-              value: "dictKey",
+              value: "dictKey"
             },
             type: "select",
             rules: [
               {
                 required: true,
                 message: "请选择企业属性",
-                trigger: "blur",
-              },
-            ],
+                trigger: "blur"
+              }
+            ]
           },
           {
             label: "最近一次登录时间",
             prop: "createTime",
             minWidth: 100,
-            display: false,
+            display: false
           },
           {
             label: "登录次数",
             prop: "num",
-            disabled: false,
+            disabled: false
           },
           {
             label: "是否有登录",
             prop: "types",
             search: true,
             disabled: false,
-            searchLabelWidth:110,
+            searchLabelWidth: 110,
             type: "select",
             searchSpan: 5,
-            hide:true,
+            hide: true,
             dicData: [
               {
                 label: "全部",
-                value: 3,
+                value: 3
               },
               {
                 label: "是",
-                value: 2,
+                value: 2
               },
               {
                 label: "否",
-                value: 1,
-              },
-            ],
-          },
-        ],
-      },
+                value: 1
+              }
+            ]
+          }
+        ]
+      }
     };
+  },
+  computed: {
+    ...mapGetters(["userInfo", "permission"])
+  },
+  mounted() {
+    this.$store.commit("setWindowSizeHeightAdd");
   },
   methods: {
     onLoad(page, params = {}) {
+      this.loading = true;
       params = this.search;
-      if (this.card.jurisdiction == 1372091709474910209) {
-        this.card.jurisdiction = "";
-      }
+      params["jurisdiction"] = this.userInfo.jurisdiction;
 
       const { releaseTimeRange } = this.query;
 
       let values = {
-        ...params,
+        ...params
       };
       if (releaseTimeRange) {
         values = {
@@ -173,17 +178,20 @@
           ...params,
           startTime: releaseTimeRange[0],
           endTime: releaseTimeRange[1],
-          ...this.query,
+          ...this.query
         };
         values.releaseTimeRange = null;
       }
 
-      getInformationLoginPage(page.currentPage, page.pageSize, values).then((res) => {
-        const data = res.data.data;
-        this.data = data.records;
-        this.page.total = data.total;
-        this.loading = false;
-      });
+      getInformationLoginPage(page.currentPage, page.pageSize, values).then(
+        res => {
+          const data = res.data.data;
+          this.data = data.records;
+          this.page.total = data.total;
+          this.$store.commit("setWindowSizeHeightAdd");
+          this.loading = false;
+        }
+      );
     },
     refreshChange() {
       this.onLoad(this.page, this.query);
@@ -199,9 +207,39 @@
       this.page.currentPage = 1;
       this.refreshChange();
     },
-  },
+    //登录数据导出
+    handleExportLoginRecord() {
+      this.$confirm("是否导出企业登录记录数据?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning"
+      }).then(() => {
+        //获取查询条件
+        const { releaseTimeRange } = this.search;
+        if (releaseTimeRange) {
+          this.search["startTime"] = releaseTimeRange[0];
+          this.search["endTime"] = releaseTimeRange[1];
+        }
+        var data = {
+          jurisdiction: this.userInfo.jurisdiction,
+          stats: this.search.stats,
+          deptName: this.search.deptName,
+          types: this.search.types,
+          startTime: this.search.startTime,
+          endTime: this.search.endTime
+        };
+        // console.log(data,123);
+        //序列号url形式,用&拼接
+        data = Qs.stringify(data);
+        window.open(
+          `/api/loginRecord/export-login-record?${
+            this.website.tokenHeader
+          }=${getToken()}&` + data
+        );
+      });
+    }
+  }
 };
 </script>
 
-<style scoped>
-</style>
\ No newline at end of file
+<style scoped></style>

--
Gitblit v1.9.3