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/exam/addsubject.vue                    |  423 +++++++++++++++++++++++++---------------------
 src/views/securityAnalysis/index.vue             |    4 
 src/views/securityAnalysis/child/loginRecord.vue |   68 +++++--
 src/views/exam/subject.vue                       |    7 
 4 files changed, 285 insertions(+), 217 deletions(-)

diff --git a/src/views/exam/addsubject.vue b/src/views/exam/addsubject.vue
index e9cbc27..ff399ab 100644
--- a/src/views/exam/addsubject.vue
+++ b/src/views/exam/addsubject.vue
@@ -77,6 +77,7 @@
       optionContentBId: null,
       optionContentCId: null,
       optionContentDId: null,
+      optionContentEId: null,
       arrContent: ["1"],
       list: [
         {
@@ -94,7 +95,6 @@
       choicesType: "0",
       loading: true,
       form: {
-        score: 1,
       },
       option: {
         height: "auto",
@@ -126,34 +126,34 @@
             ],
             span: 24,
           },
-          {
-            label: "类型",
-            prop: "tktype",
-            slot: true,
-            type: "checkbox",
-            dicData: [
-              {
-                label: "简易题库",
-                value: "A",
-              },
-              {
-                label: "复杂题库",
-                value: "B",
-              },
-              {
-                label: "模拟题库",
-                value: "C",
-              },
-            ],
-            rules: [
-              {
-                required: true,
-                message: "请选择类型",
-                trigger: "blur",
-              },
-            ],
-            span: 24,
-          },
+          // {
+          //   label: "类型",
+          //   prop: "tktype",
+          //   slot: true,
+          //   type: "checkbox",
+          //   dicData: [
+          //     {
+          //       label: "简易题库",
+          //       value: "A",
+          //     },
+          //     {
+          //       label: "复杂题库",
+          //       value: "B",
+          //     },
+          //     {
+          //       label: "模拟题库",
+          //       value: "C",
+          //     },
+          //   ],
+          //   rules: [
+          //     {
+          //       required: true,
+          //       message: "请选择类型",
+          //       trigger: "blur",
+          //     },
+          //   ],
+          //   span: 24,
+          // },
           {
             label: "选项",
             prop: "",
@@ -244,28 +244,27 @@
               },
             ],
           },
-          {
-            label: "解析",
-            prop: "analysis",
-            span: 24,
-            type: "textarea",
-          },
-          {
-            label: "分值",
-            prop: "score",
-            span: 24,
-            rules: [
-              {
-                required: true,
-                message: "请输入分值",
-                trigger: "blur",
-              },
-            ],
-          },
+          // {
+          //   label: "解析",
+          //   prop: "analysis",
+          //   span: 24,
+          //   type: "textarea",
+          // },
+          // {
+          //   label: "分值",
+          //   prop: "score",
+          //   span: 24,
+          //   rules: [
+          //     {
+          //       required: true,
+          //       message: "请输入分值",
+          //       trigger: "blur",
+          //     },
+          //   ],
+          // },
         ],
       },
       formCheckbox: {
-        score: 1,
       },
       optionCheckbox: {
         height: "auto",
@@ -297,34 +296,34 @@
             ],
             span: 24,
           },
-          {
-            label: "类型",
-            prop: "tktype",
-            slot: true,
-            type: "checkbox",
-            dicData: [
-              {
-                label: "简易题库",
-                value: "A",
-              },
-              {
-                label: "复杂题库",
-                value: "B",
-              },
-              {
-                label: "模拟题库",
-                value: "C",
-              },
-            ],
-            rules: [
-              {
-                required: true,
-                message: "请选择类型",
-                trigger: "blur",
-              },
-            ],
-            span: 24,
-          },
+          // {
+          //   label: "类型",
+          //   prop: "tktype",
+          //   slot: true,
+          //   type: "checkbox",
+          //   dicData: [
+          //     {
+          //       label: "简易题库",
+          //       value: "A",
+          //     },
+          //     {
+          //       label: "复杂题库",
+          //       value: "B",
+          //     },
+          //     {
+          //       label: "模拟题库",
+          //       value: "C",
+          //     },
+          //   ],
+          //   rules: [
+          //     {
+          //       required: true,
+          //       message: "请选择类型",
+          //       trigger: "blur",
+          //     },
+          //   ],
+          //   span: 24,
+          // },
           {
             label: "选项",
             prop: "",
@@ -384,6 +383,19 @@
             ],
           },
           {
+            label: "E",
+            prop: "optionContentE",
+            span: 24,
+            placeholder: "请输入内容",
+            rules: [
+              {
+                required: false,
+                message: "请输入内容",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
             label: "答案",
             prop: "answer",
             span: 24,
@@ -406,6 +418,10 @@
                 label: "D",
                 value: "D",
               },
+              {
+                label: "E",
+                value: "E",
+              },
             ],
             rules: [
               {
@@ -415,29 +431,27 @@
               },
             ],
           },
-          {
-            label: "解析",
-            prop: "analysis",
-            span: 24,
-            type: "textarea",
-          },
-          {
-            label: "分值",
-            prop: "score",
-            span: 24,
-            rules: [
-              {
-                required: true,
-                message: "请输入分值",
-                trigger: "blur",
-              },
-            ],
-          },
+          // {
+          //   label: "解析",
+          //   prop: "analysis",
+          //   span: 24,
+          //   type: "textarea",
+          // },
+          // {
+          //   label: "分值",
+          //   prop: "score",
+          //   span: 24,
+          //   rules: [
+          //     {
+          //       required: true,
+          //       message: "请输入分值",
+          //       trigger: "blur",
+          //     },
+          //   ],
+          // },
         ],
       },
-      formJudge: {
-        score: 1,
-      },
+      formJudge: {},
       optionJudge: {
         height: "auto",
         calcHeight: 80,
@@ -468,34 +482,34 @@
             ],
             span: 24,
           },
-          {
-            label: "类型",
-            prop: "tktype",
-            slot: true,
-            type: "checkbox",
-            dicData: [
-              {
-                label: "简易题库",
-                value: "A",
-              },
-              {
-                label: "复杂题库",
-                value: "B",
-              },
-              {
-                label: "模拟题库",
-                value: "C",
-              },
-            ],
-            rules: [
-              {
-                required: true,
-                message: "请选择类型",
-                trigger: "blur",
-              },
-            ],
-            span: 24,
-          },
+          // {
+          //   label: "类型",
+          //   prop: "tktype",
+          //   slot: true,
+          //   type: "checkbox",
+          //   dicData: [
+          //     {
+          //       label: "简易题库",
+          //       value: "A",
+          //     },
+          //     {
+          //       label: "复杂题库",
+          //       value: "B",
+          //     },
+          //     {
+          //       label: "模拟题库",
+          //       value: "C",
+          //     },
+          //   ],
+          //   rules: [
+          //     {
+          //       required: true,
+          //       message: "请选择类型",
+          //       trigger: "blur",
+          //     },
+          //   ],
+          //   span: 24,
+          // },
           // {
           //   label: "选项",
           //   prop: "",
@@ -538,29 +552,28 @@
               },
             ],
           },
-          {
-            label: "解析",
-            prop: "analysis",
-            span: 24,
-            type: "textarea",
-          },
-          {
-            label: "分值",
-            prop: "score",
-            defaultValue: 2,
-            span: 24,
-            rules: [
-              {
-                required: true,
-                message: "请输入分值",
-                trigger: "blur",
-              },
-            ],
-          },
+          // {
+          //   label: "解析",
+          //   prop: "analysis",
+          //   span: 24,
+          //   type: "textarea",
+          // },
+          // {
+          //   label: "分值",
+          //   prop: "score",
+          //   defaultValue: 2,
+          //   span: 24,
+          //   rules: [
+          //     {
+          //       required: true,
+          //       message: "请输入分值",
+          //       trigger: "blur",
+          //     },
+          //   ],
+          // },
         ],
       },
       formFill: {
-        score: 1,
       },
       optionFill: {
         height: "auto",
@@ -592,34 +605,34 @@
             ],
             span: 24,
           },
-          {
-            label: "类型",
-            prop: "tktype",
-            slot: true,
-            type: "checkbox",
-            dicData: [
-              {
-                label: "简易题库",
-                value: "A",
-              },
-              {
-                label: "复杂题库",
-                value: "B",
-              },
-              {
-                label: "模拟题库",
-                value: "C",
-              },
-            ],
-            rules: [
-              {
-                required: true,
-                message: "请选择类型",
-                trigger: "blur",
-              },
-            ],
-            span: 24,
-          },
+          // {
+          //   label: "类型",
+          //   prop: "tktype",
+          //   slot: true,
+          //   type: "checkbox",
+          //   dicData: [
+          //     {
+          //       label: "简易题库",
+          //       value: "A",
+          //     },
+          //     {
+          //       label: "复杂题库",
+          //       value: "B",
+          //     },
+          //     {
+          //       label: "模拟题库",
+          //       value: "C",
+          //     },
+          //   ],
+          //   rules: [
+          //     {
+          //       required: true,
+          //       message: "请选择类型",
+          //       trigger: "blur",
+          //     },
+          //   ],
+          //   span: 24,
+          // },
           {
             label: "选项",
             prop: "",
@@ -682,24 +695,24 @@
               },
             ],
           },
-          {
-            label: "解析",
-            prop: "analysis",
-            span: 24,
-            type: "textarea",
-          },
-          {
-            label: "分值",
-            prop: "score",
-            span: 24,
-            rules: [
-              {
-                required: true,
-                message: "请输入分值",
-                trigger: "blur",
-              },
-            ],
-          },
+          // {
+          //   label: "解析",
+          //   prop: "analysis",
+          //   span: 24,
+          //   type: "textarea",
+          // },
+          // {
+          //   label: "分值",
+          //   prop: "score",
+          //   span: 24,
+          //   rules: [
+          //     {
+          //       required: true,
+          //       message: "请输入分值",
+          //       trigger: "blur",
+          //     },
+          //   ],
+          // },
         ],
       },
       data: [],
@@ -750,6 +763,7 @@
           that.optionContentBId = data.examSubjectOptions[1].id;
           that.optionContentCId = data.examSubjectOptions[2].id;
           that.optionContentDId = data.examSubjectOptions[3].id;
+          that.optionContentEId = data.examSubjectOptions[4].id;
           that.formCheckbox.optionContentA =
             data.examSubjectOptions[0].optionContent;
           that.formCheckbox.optionContentB =
@@ -758,6 +772,8 @@
             data.examSubjectOptions[2].optionContent;
           that.formCheckbox.optionContentD =
             data.examSubjectOptions[3].optionContent;
+          that.formCheckbox.optionContentE =
+            data.examSubjectOptions[4].optionContent;
         }
         //判断题
         if (data.choicesType == 2) {
@@ -805,7 +821,8 @@
       var that = this;
       row["choicesType"] = this.choicesType;
       row["creator"] = this.userInfo.user_name;
-      row.tktype = row.tktype.join(",");
+      row['score'] = 2;
+      // row.tktype = row.tktype.join(",");
       //选项信息
       const examSubjectOptions = [
         {
@@ -840,6 +857,7 @@
             type: "success",
             message: "操作成功!",
           });
+          that.refreshPage();
           that.visible = false;
           that.$refs.form.resetFields();
           done();
@@ -855,7 +873,8 @@
       var that = this;
       row["choicesType"] = this.choicesType;
       row["creator"] = this.userInfo.user_name;
-      row.tktype = row.tktype.join(",");
+      row['score'] = 2;
+      // row.tktype = row.tktype.join(",");
       row.answer = row.answer.join(",");
       //选项信息
       const examSubjectOptions = [
@@ -883,6 +902,12 @@
           optionContent: row.optionContentD,
           creator: this.userInfo.user_name,
         },
+        {
+          id: that.optionContentEId,
+          optionName: "E",
+          optionContent: row.optionContentE,
+          creator: this.userInfo.user_name,
+        },
       ];
       row["examSubjectOptions"] = examSubjectOptions;
       saveSubjectChoicesAndOption(row).then(
@@ -891,6 +916,7 @@
             type: "success",
             message: "操作成功!",
           });
+          that.refreshPage();
           that.visible = false;
           that.$refs.formCheckbox.resetFields();
           done();
@@ -906,13 +932,15 @@
       var that = this;
       row["choicesType"] = this.choicesType;
       row["creator"] = this.userInfo.user_name;
-      row.tktype = row.tktype.join(",");
+      row['score'] = 1;
+      // row.tktype = row.tktype.join(",");
       saveSubjectChoicesAndOption(row).then(
         () => {
           this.$message({
             type: "success",
             message: "操作成功!",
           });
+          that.refreshPage();
           that.visible = false;
           that.$refs.formJudge.resetFields();
           done();
@@ -923,12 +951,16 @@
         }
       );
     },
+    refreshPage(){
+      this.$emit('refreshPage',null);
+    },
     //填空排序题提交(新增)数据
     submitFill(row, done, loading) {
       var that = this;
       row["choicesType"] = this.choicesType;
       row["creator"] = this.userInfo.user_name;
-      row.tktype = row.tktype.join(",");
+      row['score'] = 2;
+      // row.tktype = row.tktype.join(",");
       //选项信息
       var examSubjectOptions = [];
       if (row.optionContent1) {
@@ -973,6 +1005,7 @@
             type: "success",
             message: "操作成功!",
           });
+          that.refreshPage();
           that.visible = false;
           that.$refs.formFill.resetFields();
           done();
diff --git a/src/views/exam/subject.vue b/src/views/exam/subject.vue
index e0a2e3c..1d1434b 100644
--- a/src/views/exam/subject.vue
+++ b/src/views/exam/subject.vue
@@ -103,7 +103,7 @@
         </el-card>
       </el-col>
     </el-row>
-    <addsubject ref="addsubject"></addsubject>
+    <addsubject ref="addsubject" v-on:refreshPage="refreshPage"></addsubject>
   </div>
 </template>
 
@@ -277,10 +277,15 @@
     },
   },
   methods: {
+    //触发页面刷新
+    refreshPage(){
+      this.questionBankOnLoad(this.questionBankPage);
+    },
     questionBankHandleAdd(row) {
       this.$refs.addsubject.inits(row.id);
     },
     questionBankOnLoad(page, params = {}) {
+      params = this.questionBankSearch;
       this.questionBankLoading = false;
       getList(
         page.currentPage,
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>
diff --git a/src/views/securityAnalysis/index.vue b/src/views/securityAnalysis/index.vue
index 172a3f1..e6b3b88 100644
--- a/src/views/securityAnalysis/index.vue
+++ b/src/views/securityAnalysis/index.vue
@@ -322,11 +322,11 @@
           var data = [
             {
               value:b[0],
-              name:"近7天登录企业数"
+              name:"近14天登录企业数"
             },
             {
               value:b[1],
-              name:"近7天未登录企业数"
+              name:"近14天未登录企业数"
             }
           ]
           that.setEC1s(data);

--
Gitblit v1.9.3