From 8c6cf205affbbc8ada74f00a7ca25ebca867e9ed Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Mon, 27 Sep 2021 11:44:44 +0800
Subject: [PATCH] 图表颜色

---
 src/views/exam/performance.vue |   76 +++++++++++++++++++++++++++++++-------
 1 files changed, 62 insertions(+), 14 deletions(-)

diff --git a/src/views/exam/performance.vue b/src/views/exam/performance.vue
index 65c9428..fad79a9 100644
--- a/src/views/exam/performance.vue
+++ b/src/views/exam/performance.vue
@@ -14,6 +14,7 @@
             v-model="obj"
             class="company-box"
             :option="questionBankOption"
+            :permission="permissionList"
             :search.sync="questionBankSearch"
             :table-loading="questionBankLoading"
             :data="questionBankData"
@@ -27,8 +28,17 @@
             @size-change="questionBankSizeChange"
             @row-update="questionBankRowUpdate"
           >
+            <template slot-scope="{ row }" slot="theoryGrade">
+              {{ row.theoryGrade == -1 ? "" : row.theoryGrade }}
+            </template>
             <template slot-scope="{ row }" slot="learnGrade">
               {{ row.learnGrade == -1 ? "暂未录入" : row.learnGrade }}
+            </template>
+            <template slot-scope="{ row }" slot="allGrade">
+              {{ row.allGrade == -1 ? "" : row.allGrade }}
+            </template>
+            <template slot-scope="{ row }" slot="qualified">
+              {{ row.qualified == -1 ? "" : row.qualified==0?"合格":row.qualified==1?"不合格":'' }}
             </template>
 
             <!-- 自定义按钮 -->
@@ -50,6 +60,7 @@
                 size="small"
                 plain
                 icon="el-icon-upload2"
+                v-if="permission.performance_import"
                 @click="handleImport"
                 >实操成绩导入
               </el-button>
@@ -61,7 +72,8 @@
                 size="mini"
                 icon="el-icon-collection"
                 class="start-kaoshi"
-                :disabled="row.qualified == 1"
+                v-if="permission.performance_print"
+                :disabled="row.qualified==1"
                 @click="securityPrint(row)"
                 >保安证打印
               </el-button>
@@ -72,6 +84,7 @@
             title="实操成绩导入"
             append-to-body
             :visible.sync="excelBox"
+            
             width="555px"
           >
             <avue-form
@@ -94,6 +107,8 @@
 
 <script>
 import { getList, update } from "@/api/examapi/performance";
+import { mapGetters } from "vuex";
+import { getRoleDetail } from "@/api/system/role";
 
 export default {
   data() {
@@ -171,7 +186,8 @@
                 trigger: "blur",
               },
             ],
-            overHidden: true,
+            // overHidden: true,
+            width:230,
           },
           {
             label: "用户名",
@@ -198,6 +214,7 @@
                 trigger: "blur",
               },
             ],
+            width:160
           },
           {
             label: "所属公司",
@@ -229,6 +246,7 @@
                 trigger: "blur",
               },
             ],
+            width:250,
           },
           {
             label: "考试开始时间",
@@ -479,23 +497,53 @@
       },
     };
   },
+  computed:{
+    ...mapGetters(["userInfo", "permission"]),
+    permissionList() {
+      return {
+        addBtn: this.vaildData(null, false),
+        viewBtn: this.vaildData(null, false),
+        delBtn: this.vaildData(null, false),
+        editBtn: this.vaildData(this.permission.performance__edit, false),
+        excelBtn: this.vaildData(this.permission.performance_export, false),
+      };
+    },
+  },
   created() {},
   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 = [];

--
Gitblit v1.9.3