From 137fee1495124434f7b68ab9d24bca553fbc05f3 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Tue, 18 Jan 2022 13:59:08 +0800
Subject: [PATCH] 登录情况统计修改,新增登录情况导出,题库新增查询修改,优化

---
 src/views/securityAnalysis/child/loginRecord.vue |   68 ++++++++++++++++++++++++---------
 1 files changed, 49 insertions(+), 19 deletions(-)

diff --git a/src/views/securityAnalysis/child/loginRecord.vue b/src/views/securityAnalysis/child/loginRecord.vue
index 571f0a8..c573352 100644
--- a/src/views/securityAnalysis/child/loginRecord.vue
+++ b/src/views/securityAnalysis/child/loginRecord.vue
@@ -16,12 +16,25 @@
       @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() {
@@ -80,21 +93,6 @@
           {
             label: "所属辖区",
             prop: "jurisdictionName",
-            type: "select",
-            dicData: [
-              {
-                label: "男",
-                value: 1,
-              },
-              {
-                label: "女",
-                value: 2,
-              },
-              {
-                label: "未知",
-                value: 3,
-              },
-            ],
             display: false,
           },
           {
@@ -155,12 +153,13 @@
       },
     };
   },
+  computed:{
+    ...mapGetters(["userInfo", "permission"]),
+  },
   methods: {
     onLoad(page, params = {}) {
       params = this.search;
-      if (this.card.jurisdiction == 1372091709474910209) {
-        this.card.jurisdiction = "";
-      }
+      params['jurisdiction'] = this.userInfo.jurisdiction;
 
       const { releaseTimeRange } = this.query;
 
@@ -199,6 +198,37 @@
       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>

--
Gitblit v1.9.3