From 14df83036ff529bcf8eae9c792b1b8f2a54efaf0 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Sat, 21 Aug 2021 15:35:18 +0800
Subject: [PATCH] 考试成绩查询修改

---
 src/views/securityGuard/securityGuard.vue |   54 ++++++------
 src/views/trainExam/performance.vue       |   43 +++++++---
 src/views/trainExam/singleperformance.vue |   44 ++++++++---
 src/views/exam/performance.vue            |   44 ++++++++---
 src/views/exam/singleperformance.vue      |   46 ++++++++---
 5 files changed, 155 insertions(+), 76 deletions(-)

diff --git a/src/views/exam/performance.vue b/src/views/exam/performance.vue
index d68d933..6188a0d 100644
--- a/src/views/exam/performance.vue
+++ b/src/views/exam/performance.vue
@@ -108,6 +108,8 @@
 <script>
 import { getList, update } from "@/api/examapi/performance";
 import { mapGetters } from "vuex";
+import { getRoleDetail } from "@/api/system/role";
+
 export default {
   data() {
     var validatePass = (rule, value, callback) => {
@@ -508,19 +510,37 @@
   mounted() {},
   methods: {
     questionBankOnLoad(page, params = {}) {
-      this.questionBankLoading = false;
-      params["examType"] = 1;
-      getList(
-        page.currentPage,
-        page.pageSize,
-        Object.assign(params, this.query)
-      ).then((res) => {
-        const data = res.data.data;
-        this.questionBankPage.total = data.total;
-        this.questionBankData = data.records;
-        this.questionBankLoading = false;
-        this.questionBankSelectionClear();
+      //判断角色,如果是保安公司管理员或保安,只能查看当前公司的考试成绩
+      var that = this;
+      //获取当前登录人员的角色信息
+      var roleIds = this.userInfo.role_id.split(",");
+      roleIds.forEach((roleId) => {
+        getRoleDetail(roleId).then((res) => {
+            var roleAlias = res.data.data.roleAlias;
+            if (
+              roleAlias == "保安公司管理员" ||
+              roleAlias == "保安" ||
+              roleAlias == "未持证保安"
+            ) {
+              //如果是保安公司管理员
+              params["deptId"] = that.userInfo.dept_id;
+            }
+            that.questionBankLoading = false;
+            params["examType"] = 1;
+            getList(
+              page.currentPage,
+              page.pageSize,
+              Object.assign(params, this.query)
+            ).then((res) => {
+              const data = res.data.data;
+              that.questionBankPage.total = data.total;
+              that.questionBankData = data.records;
+              that.questionBankLoading = false;
+              that.questionBankSelectionClear();
+            });
+        })
       });
+      
     },
     questionBankSelectionClear() {
       this.questionBankSelectionList = [];
diff --git a/src/views/exam/singleperformance.vue b/src/views/exam/singleperformance.vue
index a5833ba..a5d56aa 100644
--- a/src/views/exam/singleperformance.vue
+++ b/src/views/exam/singleperformance.vue
@@ -84,6 +84,8 @@
 <script>
 import { getList, update } from "@/api/examapi/performance";
 import { mapGetters } from "vuex";
+import { getRoleDetail } from "@/api/system/role";
+
 export default {
   data() {
     var validatePass = (rule, value, callback) => {
@@ -437,20 +439,38 @@
         query: obj,
       });
     },
-    questionBankOnLoad(page, params = {}) {
-      this.questionBankLoading = false;
-      params["examType"] = 1;
-      getList(
-        page.currentPage,
-        page.pageSize,
-        Object.assign(params, this.query)
-      ).then((res) => {
-        const data = res.data.data;
-        this.questionBankPage.total = data.total;
-        this.questionBankData = data.records;
-        this.questionBankLoading = false;
-        this.questionBankSelectionClear();
+        questionBankOnLoad(page, params = {}) {
+      //判断角色,如果是保安公司管理员或保安,只能查看当前公司的考试成绩
+      var that = this;
+      //获取当前登录人员的角色信息
+      var roleIds = this.userInfo.role_id.split(",");
+      roleIds.forEach((roleId) => {
+        getRoleDetail(roleId).then((res) => {
+            var roleAlias = res.data.data.roleAlias;
+            if (
+              roleAlias == "保安公司管理员" ||
+              roleAlias == "保安" ||
+              roleAlias == "未持证保安"
+            ) {
+              //如果是保安公司管理员
+              params["deptId"] = that.userInfo.dept_id;
+            }
+            that.questionBankLoading = false;
+            params["examType"] = 1;
+            getList(
+              page.currentPage,
+              page.pageSize,
+              Object.assign(params, this.query)
+            ).then((res) => {
+              const data = res.data.data;
+              that.questionBankPage.total = data.total;
+              that.questionBankData = data.records;
+              that.questionBankLoading = false;
+              that.questionBankSelectionClear();
+            });
+        })
       });
+      
     },
     questionBankSelectionClear() {
       this.questionBankSelectionList = [];
diff --git a/src/views/securityGuard/securityGuard.vue b/src/views/securityGuard/securityGuard.vue
index 1a13380..4b96a44 100644
--- a/src/views/securityGuard/securityGuard.vue
+++ b/src/views/securityGuard/securityGuard.vue
@@ -853,32 +853,32 @@
             tip: "请上传 .xls,.xlsx 标准格式文件",
             action: "/api/blade-user/import-user",
           },
-          {
-            label: "数据覆盖",
-            prop: "isCovered",
-            type: "switch",
-            align: "center",
-            width: 80,
-            dicData: [
-              {
-                label: "否",
-                value: 0,
-              },
-              {
-                label: "是",
-                value: 1,
-              },
-            ],
-            value: 0,
-            slot: true,
-            rules: [
-              {
-                required: true,
-                message: "请选择是否覆盖",
-                trigger: "blur",
-              },
-            ],
-          },
+          // {
+          //   label: "数据覆盖",
+          //   prop: "isCovered",
+          //   type: "switch",
+          //   align: "center",
+          //   width: 80,
+          //   dicData: [
+          //     {
+          //       label: "否",
+          //       value: 0,
+          //     },
+          //     {
+          //       label: "是",
+          //       value: 1,
+          //     },
+          //   ],
+          //   value: 0,
+          //   slot: true,
+          //   rules: [
+          //     {
+          //       required: true,
+          //       message: "请选择是否覆盖",
+          //       trigger: "blur",
+          //     },
+          //   ],
+          // },
           {
             label: "模板下载",
             prop: "excelTemplate",
@@ -954,7 +954,7 @@
       done();
     },
     handleTemplate1() {
-      window.open(`/api/examSubjectChoices/export-template`);
+      window.open(`/api/blade-user/export-template-security`);
     },
 
     //行点击事件
diff --git a/src/views/trainExam/performance.vue b/src/views/trainExam/performance.vue
index 8f93899..902491e 100644
--- a/src/views/trainExam/performance.vue
+++ b/src/views/trainExam/performance.vue
@@ -94,6 +94,7 @@
 <script>
 import { getList, update } from "@/api/examapi/performance";
 import { mapGetters } from "vuex";
+import { getRoleDetail } from "@/api/system/role";
 export default {
   data() {
     var validatePass = (rule, value, callback) => {
@@ -492,19 +493,37 @@
   },
   methods: {
     questionBankOnLoad(page, params = {}) {
-      this.questionBankLoading = false;
-      params["examType"] = 2;
-      getList(
-        page.currentPage,
-        page.pageSize,
-        Object.assign(params, this.query)
-      ).then((res) => {
-        const data = res.data.data;
-        this.questionBankPage.total = data.total;
-        this.questionBankData = data.records;
-        this.questionBankLoading = false;
-        this.questionBankSelectionClear();
+      //判断角色,如果是保安公司管理员或保安,只能查看当前公司的考试成绩
+      var that = this;
+      //获取当前登录人员的角色信息
+      var roleIds = this.userInfo.role_id.split(",");
+      roleIds.forEach((roleId) => {
+        getRoleDetail(roleId).then((res) => {
+            var roleAlias = res.data.data.roleAlias;
+            if (
+              roleAlias == "保安公司管理员" ||
+              roleAlias == "保安" ||
+              roleAlias == "未持证保安"
+            ) {
+              //如果是保安公司管理员
+              params["deptId"] = that.userInfo.dept_id;
+            }
+            that.questionBankLoading = false;
+            params["examType"] = 1;
+            getList(
+              page.currentPage,
+              page.pageSize,
+              Object.assign(params, this.query)
+            ).then((res) => {
+              const data = res.data.data;
+              that.questionBankPage.total = data.total;
+              that.questionBankData = data.records;
+              that.questionBankLoading = false;
+              that.questionBankSelectionClear();
+            });
+        })
       });
+      
     },
     questionBankSelectionClear() {
       this.questionBankSelectionList = [];
diff --git a/src/views/trainExam/singleperformance.vue b/src/views/trainExam/singleperformance.vue
index 9b1a5a5..96644ac 100644
--- a/src/views/trainExam/singleperformance.vue
+++ b/src/views/trainExam/singleperformance.vue
@@ -84,6 +84,8 @@
 <script>
 import { getList, update } from "@/api/examapi/performance";
 import { mapGetters } from "vuex";
+import { getRoleDetail } from "@/api/system/role";
+
 export default {
   data() {
     var validatePass = (rule, value, callback) => {
@@ -438,19 +440,37 @@
       });
     },
     questionBankOnLoad(page, params = {}) {
-      this.questionBankLoading = false;
-      params["examType"] = 2;
-      getList(
-        page.currentPage,
-        page.pageSize,
-        Object.assign(params, this.query)
-      ).then((res) => {
-        const data = res.data.data;
-        this.questionBankPage.total = data.total;
-        this.questionBankData = data.records;
-        this.questionBankLoading = false;
-        this.questionBankSelectionClear();
+      //判断角色,如果是保安公司管理员或保安,只能查看当前公司的考试成绩
+      var that = this;
+      //获取当前登录人员的角色信息
+      var roleIds = this.userInfo.role_id.split(",");
+      roleIds.forEach((roleId) => {
+        getRoleDetail(roleId).then((res) => {
+            var roleAlias = res.data.data.roleAlias;
+            if (
+              roleAlias == "保安公司管理员" ||
+              roleAlias == "保安" ||
+              roleAlias == "未持证保安"
+            ) {
+              //如果是保安公司管理员
+              params["deptId"] = that.userInfo.dept_id;
+            }
+            that.questionBankLoading = false;
+            params["examType"] = 1;
+            getList(
+              page.currentPage,
+              page.pageSize,
+              Object.assign(params, this.query)
+            ).then((res) => {
+              const data = res.data.data;
+              that.questionBankPage.total = data.total;
+              that.questionBankData = data.records;
+              that.questionBankLoading = false;
+              that.questionBankSelectionClear();
+            });
+        })
       });
+      
     },
     questionBankSelectionClear() {
       this.questionBankSelectionList = [];

--
Gitblit v1.9.3