From c4e67a8942e514b65ab41bb19781d50576c15725 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Fri, 24 Sep 2021 19:56:52 +0800
Subject: [PATCH] 用户

---
 src/views/exam/singleperformance.vue |   62 ++++++++++++++++++++++++------
 1 files changed, 49 insertions(+), 13 deletions(-)

diff --git a/src/views/exam/singleperformance.vue b/src/views/exam/singleperformance.vue
index 6528b4e..8f4ed78 100644
--- a/src/views/exam/singleperformance.vue
+++ b/src/views/exam/singleperformance.vue
@@ -47,6 +47,7 @@
                 icon="el-icon-collection"
                 class="start-kaoshi"
                 :disabled="row.qualified==1"
+                v-if="permission.singleperformance_print"
                 @click="securityPrint(row)"
                 >保安证打印
               </el-button>
@@ -82,6 +83,8 @@
 
 <script>
 import { getList, update } from "@/api/examapi/performance";
+import { mapGetters } from "vuex";
+import { getRoleDetail } from "@/api/system/role";
 
 export default {
   data() {
@@ -158,7 +161,8 @@
                 trigger: "blur",
               },
             ],
-            overHidden:true,
+            // overHidden:true,
+            width:230,
           },
           {
             label: "用户名",
@@ -185,6 +189,7 @@
                 trigger: "blur",
               },
             ],
+            width:160,
           },
           {
             label: "所属公司",
@@ -216,6 +221,7 @@
                 trigger: "blur",
               },
             ],
+            width:250,
           },
           {
             label: "考试开始时间",
@@ -412,6 +418,18 @@
       questionBankSelectionList: [],
     };
   },
+  computed:{
+    ...mapGetters(["userInfo", "permission"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(this.permission.user_add, false),
+        viewBtn: this.vaildData(null, false),
+        delBtn: this.vaildData(null, false),
+        editBtn: this.vaildData(this.permission.user_edit, false),
+        excelBtn: this.vaildData(this.permission.singleperformance_export, false),
+      };
+    },
+  },
   created() {},
   mounted() {},
   methods: {
@@ -425,19 +443,37 @@
       });
     },
     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 = [];

--
Gitblit v1.9.3