From e3f898bd1f4e964424b7c1a1b1aa2f7fa508ca4f Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 06 Sep 2021 17:59:40 +0800
Subject: [PATCH] 成绩查看权限配置,培训公司管理员查看当前培训公司的考试成绩,报名列表同

---
 src/views/trainExam/index.vue             |   30 ++++++++++++++
 src/views/trainExam/performance.vue       |    9 +++-
 src/views/trainExam/singleperformance.vue |   23 ++++++++---
 src/views/trainingRegistration/index.vue  |   49 ++++++++++++++++++------
 4 files changed, 88 insertions(+), 23 deletions(-)

diff --git a/src/views/trainExam/index.vue b/src/views/trainExam/index.vue
index cfd1e6a..412cc67 100644
--- a/src/views/trainExam/index.vue
+++ b/src/views/trainExam/index.vue
@@ -72,6 +72,7 @@
                 size="mini"
                 icon="el-icon-collection"
                 class="start-kaoshi"
+                v-if="permission.trainExam_trainPapers"
                 @click="startExam(row)"
                 >报名清册
               </el-button>
@@ -79,8 +80,17 @@
                 type="text"
                 size="mini"
                 icon="el-icon-folder-checked"
+                v-if="permission.trainExam_check"
                 @click="handleAudit(row)"
                 >审核
+              </el-button>
+              <el-button
+                type="text"
+                size="mini"
+                icon="el-icon-folder-checked"
+                v-if="permission.trainExam_index_examScoreViews"
+                @click="examScoreViews(row)"
+                >成绩查看
               </el-button>
             </template>
           </avue-crud>
@@ -115,6 +125,7 @@
   updateAudit,
 } from "@/api/examapi/examination";
 import { auditColumn } from "./data";
+import { mapGetters } from "vuex";
 export default {
   data() {
     var validatePass = (rule, value, callback) => {
@@ -441,7 +452,6 @@
       questionBankSelectionList: [],
     };
   },
-  created() {},
   mounted() {},
   computed: {
     ids() {
@@ -450,6 +460,15 @@
         ids.push(ele.id);
       });
       return ids.join(",");
+    },
+    ...mapGetters(["userInfo", "permission"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(null, false),
+        viewBtn: this.vaildData(null, false),
+        delBtn: this.vaildData(null, false),
+        editBtn: this.vaildData(null, false),
+      };
     },
   },
   watch: {},
@@ -527,6 +546,15 @@
         });
       }
     },
+    examScoreViews(row){
+      //模拟考试
+      if (row.examType == 2) {
+        this.$router.push({
+          path: `/trainExam/singleperformance`,
+          query: row,
+        });
+      }
+    },
     // 新增
     questionBankRowSave(row, done, loading) {
       row.startTime = row.startTime + ":00";
diff --git a/src/views/trainExam/performance.vue b/src/views/trainExam/performance.vue
index 737dcd7..dc7adac 100644
--- a/src/views/trainExam/performance.vue
+++ b/src/views/trainExam/performance.vue
@@ -520,12 +520,17 @@
             var roleAlias = res.data.data.roleAlias;
             if (
               roleAlias == "保安公司管理员" ||
-              roleAlias == "保安" ||
-              roleAlias == "未持证保安"
+              roleAlias == "保安"
             ) {
               //如果是保安公司管理员
               params["deptId"] = that.userInfo.dept_id;
             }
+            if (
+              roleAlias == "培训公司管理员"
+            ) {
+              //如果是培训公司管理员
+              params["trainUnitId"] = that.userInfo.dept_id;
+            }
             that.questionBankLoading = false;
             params["examType"] = 2;
             getList(
diff --git a/src/views/trainExam/singleperformance.vue b/src/views/trainExam/singleperformance.vue
index adb0a7d..ad770e3 100644
--- a/src/views/trainExam/singleperformance.vue
+++ b/src/views/trainExam/singleperformance.vue
@@ -38,7 +38,7 @@
               {{ row.learnGrade == -1 ? "" : row.allGrade }}
             </template>
             <template slot-scope="{ row }" slot="qualified">
-              {{ row.learnGrade == -1 ? "" : row.qualified == 0?"合格":row.qualified==1?"不合格":'' }}
+              {{ row.qualified == -1 ? "" : row.qualified==0?"合格":row.qualified==1?"不合格":row.qualified==3?"缺考,成绩无效":'' }}
             </template>
 
             <template slot-scope="{ row }" slot="menu">
@@ -139,7 +139,7 @@
             label: "考试名称",
             prop: "examName",
             search: true,
-            searchSpan: 4,
+            searchSpan: 5,
             slot: true,
             viewDisplay:false,
             // 表单新增时是否禁止
@@ -273,7 +273,7 @@
             type: "select",
             slot: true,
             search: true,
-            searchSpan: 4,
+            searchSpan: 3,
             dicData: [
               {
                 label: "发布成绩",
@@ -369,7 +369,7 @@
             type: "select",
             slot: true,
             search: true,
-            searchSpan: 4,
+            searchSpan: 3,
             dicData: [
               {
                 label: "合格",
@@ -418,7 +418,10 @@
       questionBankSelectionList: [],
     };
   },
-  created() {},
+  created() {
+    // console.log(this.$route.query,111);
+    this.questionBankSearch['examName'] = this.$route.query.examName;
+  },
   mounted() {},
   computed:{
     ...mapGetters(["userInfo", "permission"]),
@@ -447,17 +450,23 @@
       var that = this;
       //获取当前登录人员的角色信息
       var roleIds = this.userInfo.role_id.split(",");
+      params = this.questionBankSearch;
       roleIds.forEach((roleId) => {
         getRoleDetail(roleId).then((res) => {
             var roleAlias = res.data.data.roleAlias;
             if (
               roleAlias == "保安公司管理员" ||
-              roleAlias == "保安" ||
-              roleAlias == "未持证保安"
+              roleAlias == "保安"
             ) {
               //如果是保安公司管理员
               params["deptId"] = that.userInfo.dept_id;
             }
+            if (
+              roleAlias == "培训公司管理员"
+            ) {
+              //如果是培训公司管理员
+              params["trainUnitId"] = that.userInfo.dept_id;
+            }
             that.questionBankLoading = false;
             params["examType"] = 2;
             getList(
diff --git a/src/views/trainingRegistration/index.vue b/src/views/trainingRegistration/index.vue
index 9765753..6e0b2c5 100644
--- a/src/views/trainingRegistration/index.vue
+++ b/src/views/trainingRegistration/index.vue
@@ -129,6 +129,7 @@
   addExam,
 } from "@/api/trainingRegistration/trainingRegistration";
 import { mapGetters } from "vuex";
+import { getRoleDetail } from "@/api/system/role";
 export default {
   data() {
     return {
@@ -518,20 +519,42 @@
       this.onLoad(this.page, this.query);
     },
     onLoad(page, params = {}) {
-      params = this.search;
       this.loading = true;
-      getdata(
-        page.currentPage,
-        page.pageSize,
-        Object.assign(params, this.query)
-      ).then((res) => {
-        // console.log(res);
-        const data = res.data.data;
-        this.page.total = data.total;
-        this.data = data.records;
-        console.log(this.data);
-        this.loading = false;
-      });
+      //判断角色,如果是保安公司管理员或保安,只能查看当前公司的考试成绩
+      var that = this;
+      //获取当前登录人员的角色信息
+      var roleIds = this.userInfo.role_id.split(",");
+      params = this.search;
+      roleIds.forEach((roleId) => {
+        getRoleDetail(roleId).then((res) => {
+            var roleAlias = res.data.data.roleAlias;
+            if (
+              roleAlias == "保安公司管理员" ||
+              roleAlias == "保安"
+            ) {
+              //如果是保安公司管理员
+              params["deptId"] = that.userInfo.dept_id;
+            }
+            if (
+              roleAlias == "培训公司管理员"
+            ) {
+              //如果是培训公司管理员
+              params["trainingUnitId"] = that.userInfo.dept_id;
+            }
+            getdata(
+              page.currentPage,
+              page.pageSize,
+              Object.assign(params, this.query)
+            ).then((res) => {
+              // console.log(res);
+              const data = res.data.data;
+              this.page.total = data.total;
+              this.data = data.records;
+              console.log(this.data);
+              this.loading = false;
+            });
+        })
+      })
     },
     handleImport() {
       this.excelBox = true;

--
Gitblit v1.9.3