From 6db53ef580927d11e9d9c0059ce8cada692142d5 Mon Sep 17 00:00:00 2001
From: liuyg <376836862@qq.com>
Date: Tue, 07 Sep 2021 17:13:05 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.105:10010/r/zhba_enterprises

---
 src/views/trainExam/index.vue                        |   30 ++
 src/views/applyexam/index.vue                        |  177 ++++++++++++++--
 src/views/trainingRegistration/data.js               |   39 +++
 src/api/examapi/applyexam.js                         |   10 
 src/views/trainExam/performance.vue                  |   51 ++++
 src/api/trainingRegistration/trainingRegistration.js |   29 +
 src/views/trainApply/index.vue                       |  131 +++++++++++
 src/views/trainExam/singleperformance.vue            |   23 +
 src/api/examapi/performance.js                       |   37 ++-
 src/views/trainingRegistration/index.vue             |   93 +++++---
 src/views/applydetailed/index.vue                    |    1 
 11 files changed, 511 insertions(+), 110 deletions(-)

diff --git a/src/api/examapi/applyexam.js b/src/api/examapi/applyexam.js
index 5200c39..5530ebd 100644
--- a/src/api/examapi/applyexam.js
+++ b/src/api/examapi/applyexam.js
@@ -60,17 +60,11 @@
     })
 }
 
-export const addExam = (ids, examTime, startTime, number, endTime) => {
+export const addExam = (params) => {
     return request({
         url: '/api/apply/batchExam',
         method: 'post',
-        params: {
-            ids,
-            examTime,
-            startTime,
-            number,
-            endTime
-        }
+        data: params
     })
 }
 
diff --git a/src/api/examapi/performance.js b/src/api/examapi/performance.js
index ba130f1..36582a6 100644
--- a/src/api/examapi/performance.js
+++ b/src/api/examapi/performance.js
@@ -1,21 +1,30 @@
 import request from '@/router/axios';
 
 export const getList = (current, size, params) => {
-  return request({
-    url: '/api/examScore/page',
-    method: 'get',
-    params: {
-      ...params,
-      current,
-      size
-    }
-  })
+    return request({
+        url: '/api/examScore/page',
+        method: 'get',
+        params: {
+            ...params,
+            current,
+            size
+        }
+    })
 }
 
 export const update = (row) => {
-  return request({
-    url: '/api/examScore/updateExamScore',
-    method: 'post',
-    data: row
-  })
+    return request({
+        url: '/api/examScore/updateExamScore',
+        method: 'post',
+        data: row
+    })
 }
+
+
+export const updateAbsent = (row) => {
+    return request({
+        url: '/api/examScore/updateAbsent',
+        method: 'post',
+        data: row
+    })
+}
\ No newline at end of file
diff --git a/src/api/trainingRegistration/trainingRegistration.js b/src/api/trainingRegistration/trainingRegistration.js
index 9550dfd..5bb75da 100644
--- a/src/api/trainingRegistration/trainingRegistration.js
+++ b/src/api/trainingRegistration/trainingRegistration.js
@@ -38,6 +38,23 @@
     })
 }
 
+
+export const cancelTrainAudit = (row) => {
+    return request({
+        url: '/api/trainingRegistration/cancelTrainAudit',
+        method: 'post',
+        data: row
+    })
+}
+
+export const auditSucess = (row) => {
+    return request({
+        url: '/api/trainingRegistration/auditSucess',
+        method: 'post',
+        data: row
+    })
+}
+
 export const update = (row) => {
     return request({
         url: '/api/trainingRegistration/update',
@@ -57,18 +74,10 @@
 }
 
 
-export const addExam = (ids, examTime, startTime, number, endTime, serialStart, serialEnd) => {
+export const addExam = (params) => {
     return request({
         url: '/api/trainingRegistration/batchExam',
         method: 'post',
-        params: {
-            ids,
-            examTime,
-            startTime,
-            number,
-            endTime,
-            serialStart,
-            serialEnd
-        }
+        data: params
     })
 }
\ No newline at end of file
diff --git a/src/views/applydetailed/index.vue b/src/views/applydetailed/index.vue
index cd1dffb..e813954 100644
--- a/src/views/applydetailed/index.vue
+++ b/src/views/applydetailed/index.vue
@@ -538,6 +538,7 @@
     questionBankOnLoad(page, params = {}) {
       // debugger;
       params["examId"] = this.$route.query.id;
+      // params["applyStatus"] = 2;
       this.questionBankLoading = false;
       getApplyList(
         page.currentPage,
diff --git a/src/views/applyexam/index.vue b/src/views/applyexam/index.vue
index e0be230..bf9a8f8 100644
--- a/src/views/applyexam/index.vue
+++ b/src/views/applyexam/index.vue
@@ -180,6 +180,7 @@
 } from "@/api/examapi/applyexam";
 import { mapState } from "vuex";
 import { mapGetters } from "vuex";
+import { getRoleDetail } from "@/api/system/role";
 var DIC = {
   applyStatus: [
     {
@@ -302,7 +303,7 @@
             label: "考试人数",
             prop: "number",
             type: 'number',
-            span: 6,
+            span: 12,
             precision:0,
             step:50,
             mock:{
@@ -321,7 +322,50 @@
             minRows: 0,
             maxRows: 1000,
             value:50,
-            row:true,
+          },
+          {
+            label: "序号开始",
+            prop: "serialStart",
+            span: 6,
+            value:1,
+            mock:{
+              type:'number',
+              max:1000,
+              min:1,
+              precision:0
+            },
+            minRows: 1,
+            maxRows: 1000,
+            type:"number",
+            rules: [
+              {
+                required: true,
+                message: "请输入序号",
+                trigger: "blur",
+              },
+            ],
+          },
+          {
+            label: "序号结束",
+            prop: "serialEnd",
+            span: 6,
+            value:50,
+            mock:{
+              type:'number',
+              max:1000,
+              min:1,
+              precision:0
+            },
+            minRows: 1,
+            maxRows: 1000,
+            type:"number",
+            rules: [
+              {
+                required: true,
+                message: "请输入序号",
+                trigger: "blur",
+              },
+            ],
           },
           {
             label: "考试时间",
@@ -329,8 +373,6 @@
             type: "datetime",
             format: "yyyy-MM-dd HH:mm",
             valueFormat: "yyyy-MM-dd HH:mm",
-            startPlaceholder: "考试开始时间",
-            endPlaceholder: "考试结束时间",
             // 表单新增时是否禁止
             addDisabled: false,
             // 表单新增时是否可见
@@ -350,7 +392,34 @@
                 trigger: "blur",
               },
             ],
-            span: 24,
+            span: 12,
+          },
+          {
+            label: "截止时间",
+            prop: "endTime",
+            type: "datetime",
+            format: "yyyy-MM-dd HH:mm",
+            valueFormat: "yyyy-MM-dd HH:mm",
+            // 表单新增时是否禁止
+            addDisabled: false,
+            // 表单新增时是否可见
+            addDisplay: true,
+            // 表单新增时是否为查看模式
+            addDetail: false,
+            // 表单编辑时是否禁止
+            editDisabled: false,
+            // 表单编辑时是否可见
+            editDisplay: true,
+            // 表单编辑时是否为查看模式
+            editDetail: false,
+            rules: [
+              {
+                required: true,
+                message: "请选择考试时间",
+                trigger: "blur",
+              },
+            ],
+            span: 12,
           },
         ],
       },
@@ -731,6 +800,34 @@
           //   overHidden: true,
           //   width: 150,
           // },
+          //   {
+          //     label: "报名状态",
+          //     search: true,
+          //     type: "select",
+          //     searchSpan: 4,
+          //     prop: "applyStatus",
+          //     searchValue: 2,
+          //     dicData: [{
+          //             label: '全部',
+          //             value: 0,
+          //         },
+          //         {
+          //             label: '已报名',
+          //             value: 2,
+          //         },
+          //         {
+          //             label: '已取消',
+          //             value: 4,
+          //         }
+          //     ],
+          //     props: {
+          //         label: "label",
+          //         value: "value"
+          //     },
+          //     editDisplay: false,
+          //     addDisplay: false,
+          //     width: 100,
+          // },
         ],
       },
       questionBankSearch: {},
@@ -776,6 +873,8 @@
     if (this.userInfo.role_name.indexOf("ksxtadmin") != -1) {
       this.examPersission = true;
     }
+
+    this.questionBankSearch['applyStatus'] = 2;
   },
   mounted() {},
   computed: {
@@ -810,19 +909,36 @@
       });
     },
     questionBankOnLoad(page, params = {}) {
+      params = this.questionBankSearch;
       this.questionBankLoading = false;
-      params["applyStatus"] = 1;
-      getApplyList(
-        page.currentPage,
-        page.pageSize,
-        Object.assign(params, this.questionBankQuery)
-      ).then((res) => {
-        const data = res.data.data;
-        this.questionBankPage.total = data.total;
-        this.questionBankData = data.records;
-        this.questionBankLoading = false;
-        this.questionBankSelectionClear();
-      });
+      this.loading = true;
+      //判断角色,如果是保安公司管理员或保安,只能查看当前公司的报名信息
+      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 == "保安"
+            ) {
+              //如果是保安公司管理员
+              params["deptId"] = that.userInfo.dept_id;
+            }
+            getApplyList(
+              page.currentPage,
+              page.pageSize,
+              Object.assign(params, this.questionBankQuery)
+            ).then((res) => {
+              const data = res.data.data;
+              this.questionBankPage.total = data.total;
+              this.questionBankData = data.records;
+              this.questionBankLoading = false;
+              this.questionBankSelectionClear();
+            });
+          })
+      })
     },
     questionBankSelectionClear() {
       this.questionBankSelectionList = [];
@@ -893,11 +1009,28 @@
     //生成考试
     submitExamApply(row, done, loading) {
       var that = this;
-      var startTime = row.startTime + ":00";
-      // var endTime = row.examTime[1];
-      // var examTime = JSON.stringify(row.examTime);
-      // console.log(this.ids,111);
-      addExam(this.ids, null, startTime,row.number, null).then(
+      row.startTime = row.startTime + ":00";
+      row.endTime = row.endTime + ":00";
+      if(row.number!=((row.serialEnd-row.serialStart)+1)){
+          this.$message({
+            type: "error",
+            message: "考试人数与序号不匹配!",
+          });
+         done();
+         return;
+      }
+
+      var s = new Date(row.startTime);
+      var e = new Date(row.endTime);
+      if(s>e){
+        this.$message({
+            type: "error",
+            message: "截止时间不能早于考试考试开始时间!",
+          });
+         done();
+         return;
+      }
+      addExam(Object.assign(row, this.questionBankSearch)).then(
         () => {
           this.questionBankOnLoad(this.questionBankPage);
           this.$message({
diff --git a/src/views/trainApply/index.vue b/src/views/trainApply/index.vue
index 44b500b..a201ecf 100644
--- a/src/views/trainApply/index.vue
+++ b/src/views/trainApply/index.vue
@@ -62,9 +62,25 @@
                             :type="type"
                             size="small"
                             icon="el-icon-receiving"
-                            :disabled="row.candidateNo==''"
+                            :disabled="row.candidateNo=='' || row.cancel==2"
                             @click="handlePrint(row)"
                             >准考证打印
+                            </el-button>
+                            <el-button
+                            :type="type"
+                            size="small"
+                            icon="el-icon-refresh-left"
+                            :disabled="row.cancel==2"
+                            @click="revoke(row)"
+                            >取消报名
+                            </el-button>
+                            <el-button
+                            :type="type"
+                            size="small"
+                            icon="el-icon-circle-check"
+                            :disabled="row.auditStatus==1"
+                            @click="auditSucess(row)"
+                            >审核通过
                             </el-button>
                         </template>
 
@@ -98,7 +114,7 @@
 
 <script>
 
-import {getdata,adddata,remove} from "@/api/trainingRegistration/trainingRegistration";
+import {getdata,adddata,  cancelTrainAudit,auditSucess,remove} from "@/api/trainingRegistration/trainingRegistration";
 
 import { mapState } from 'vuex'
 
@@ -258,6 +274,24 @@
                         width: 220
                     },
                     {
+                        label: "报名状态",
+                        prop: "cancel",
+                        type:"select",
+                        search:true,
+                        hide:true,
+                        searchSpan:4,
+                        searchValue:1,
+                        dicData:[
+                            {
+                                label: '已报名',
+                                value: 1
+                            }, {
+                                label: '已取消',
+                                value: 2
+                            }
+                        ]
+                    },
+                    {
                         label: "准考证号",
                         prop: "candidateNo",
                         slot: true,
@@ -373,7 +407,7 @@
                                             ? "0" + new Date().getSeconds()
                                             : new Date().getSeconds())),
 
-                        width: 160
+                        width: 150
                     },
                     {
                         label: "考试时间",
@@ -394,7 +428,44 @@
                         editDisplay: true,
                         // 表单编辑时是否为查看模式
                         editDetail: false,
-                        width: 160
+                        width: 150
+                    },
+                    {
+                        label: "审核状态",
+                        search: true,
+                        searchLabelWidth: 110,
+                        type: "select",
+                        searchSpan: 4,
+                        prop: "auditStatus",
+                        searchValue: 4,
+                        dicData: [{
+                                label: '全部',
+                                value: 0,
+                            },
+                            {
+                                label: '审核通过',
+                                value: 1,
+                            },
+                            {
+                                label: '审核不通过',
+                                value: 2,
+                            },
+                            {
+                                label: '已提交审核',
+                                value: 3,
+                            },
+                            {
+                                label: '未提交审核',
+                                value: 4,
+                            }
+                        ],
+                        props: {
+                            label: "label",
+                            value: "value"
+                        },
+                        editDisplay: false,
+                        addDisplay: false,
+                        width: 100,
                     },
                     // {
                     //     label: "报名状态",
@@ -494,6 +565,8 @@
         this.questionBankOption.column[0].dicUrl = "/api/blade-system/dept/lazy-tree-user?parentId=" + this.userInfo.dept_id
 
       }
+      this.questionBankSearch['cancel'] = 1;
+      this.questionBankSearch['auditStatus'] = 0;
     },
     mounted() {
         var flag = false,
@@ -535,7 +608,7 @@
             });
         },
         questionBankOnLoad (page, params = {}) {
-            // debugger;
+            params = this.questionBankSearch;
             params['examId'] = this.$route.query.id;
             this.questionBankLoading = false;
             getdata(page.currentPage, page.pageSize, Object.assign(params, this.questionBankQuery)).then(res => {
@@ -569,6 +642,54 @@
         questionBankSizeChange (pageSize) {
             this.questionBankPage.pageSize = pageSize;
         },
+        //取消报名
+        revoke(row, done, loading) {
+            this.$confirm("确定取消报名?", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning",
+            }).then(() => {
+                row.cancel = 2;
+                cancelTrainAudit(row).then(
+                () => {
+                    this.onLoad(this.page);
+                    this.$message({
+                    type: "success",
+                    message: "取消报名成功!",
+                    });
+                    done();
+                },
+                (error) => {
+                    window.console.log(error);
+                    loading();
+                }
+                );
+            });
+        },
+        //审核通过
+        auditSucess(row, done, loading) {
+            this.$confirm("确定审核通过?", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning",
+            }).then(() => {
+                row.cancel = 1;
+                auditSucess(row).then(
+                () => {
+                    this.onLoad(this.page);
+                    this.$message({
+                    type: "success",
+                    message: "操作成功!",
+                    });
+                    done();
+                },
+                (error) => {
+                    window.console.log(error);
+                    loading();
+                }
+                );
+            });
+        },
 
         // 新增
         questionBankRowSave (row, done, loading) {
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 95027d0..dc7adac 100644
--- a/src/views/trainExam/performance.vue
+++ b/src/views/trainExam/performance.vue
@@ -38,7 +38,7 @@
               {{ row.allGrade == -1 ? "" : row.allGrade }}
             </template>
             <template slot-scope="{ row }" slot="qualified">
-              {{ row.qualified == -1 ? "" : row.qualified==0?"合格":row.qualified==1?"不合格":'' }}
+              {{ row.qualified == -1 ? "" : row.qualified==0?"合格":row.qualified==1?"不合格":row.qualified==3?"缺考,成绩无效":'' }}
             </template>
 
             <!-- 自定义按钮 -->
@@ -64,6 +64,16 @@
                 @click="handleImport"
                 >实操成绩导入
               </el-button>
+            </template>
+
+            <template slot-scope="{ type, size, row }" slot="menu">
+                <el-button
+                  icon="el-icon-s-flag"
+                  @click="absent(row)"
+                  :size="size"
+                  :type="type"
+                  >缺考标记</el-button
+                >
             </template>
           </avue-crud>
 
@@ -92,7 +102,7 @@
 </template>
 
 <script>
-import { getList, update } from "@/api/examapi/performance";
+import { getList, update,updateAbsent } from "@/api/examapi/performance";
 import { mapGetters } from "vuex";
 import { getRoleDetail } from "@/api/system/role";
 export default {
@@ -394,6 +404,10 @@
                 label: "暂未录实操成绩",
                 value: 2,
               },
+              {
+                label: "缺考,成绩无效",
+                value: 3,
+              },
             ],
             // 表单新增时是否禁止
             addDisabled: false,
@@ -506,11 +520,16 @@
             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;
@@ -529,6 +548,30 @@
       });
       
     },
+    //缺考标记
+    absent(row, done, loading) {
+      this.$confirm("确定缺考标记?", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        row.qualified = 3;
+        updateAbsent(row).then(
+          () => {
+            this.onLoad(this.page);
+            this.$message({
+              type: "success",
+              message: "操作成功!",
+            });
+            done();
+          },
+          (error) => {
+            window.console.log(error);
+            loading();
+          }
+        );
+      });
+    },
     questionBankSelectionClear() {
       this.questionBankSelectionList = [];
       this.$refs.questionBankCrud.toggleSelection();
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/data.js b/src/views/trainingRegistration/data.js
index 5e3c3ba..c05d907 100644
--- a/src/views/trainingRegistration/data.js
+++ b/src/views/trainingRegistration/data.js
@@ -35,6 +35,7 @@
         }],
         searchSpan: 4,
         searchLabelWidth: 110,
+        width: 200,
     }, {
         label: "姓名",
         prop: "userId",
@@ -140,11 +141,16 @@
     {
         label: "审核状态",
         search: true,
+        searchLabelWidth: 110,
         type: "select",
         searchSpan: 4,
         prop: "auditStatus",
-        // search: true,
+        searchValue: 4,
         dicData: [{
+                label: '全部',
+                value: 0,
+            },
+            {
                 label: '审核通过',
                 value: 1,
             },
@@ -153,11 +159,11 @@
                 value: 2,
             },
             {
-                label: '审核中',
+                label: '已提交审核',
                 value: 3,
             },
             {
-                label: '待审核',
+                label: '未提交审核',
                 value: 4,
             }
         ],
@@ -167,7 +173,34 @@
         },
         editDisplay: false,
         addDisplay: false,
+        width: 100,
+    },
+    {
+        label: "报名状态",
+        search: true,
+        type: "select",
         searchSpan: 4,
+        prop: "cancel",
+        searchValue: 1,
+        dicData: [{
+                label: '全部',
+                value: 0,
+            },
+            {
+                label: '已报名',
+                value: 1,
+            },
+            {
+                label: '已取消',
+                value: 2,
+            }
+        ],
+        props: {
+            label: "label",
+            value: "value"
+        },
+        editDisplay: false,
+        addDisplay: false,
         width: 100,
     },
     //  {
diff --git a/src/views/trainingRegistration/index.vue b/src/views/trainingRegistration/index.vue
index c02e989..372c962 100644
--- a/src/views/trainingRegistration/index.vue
+++ b/src/views/trainingRegistration/index.vue
@@ -5,6 +5,7 @@
       :table-loading="loading"
       :data="data"
       :page.sync="page"
+      :search.sync="search"
       ref="crud"
       @row-del="rowDel"
       v-model="form"
@@ -57,6 +58,7 @@
           :size="size"
           :type="type"
           v-if="permission.trainingRegistration_cancel"
+          :disabled="row.cancel==2"
           >取消报名</el-button
         >
         <el-button
@@ -64,7 +66,7 @@
           size="small"
           icon="el-icon-receiving"
           v-if="permission.trainingRegistration_print"
-          :disabled="row.candidateNo == ''"
+          :disabled="row.candidateNo == '' || row.cancel==2"
           @click="handlePrint(row)"
           >准考证打印
         </el-button>
@@ -127,12 +129,14 @@
   addExam,
 } from "@/api/trainingRegistration/trainingRegistration";
 import { mapGetters } from "vuex";
+import { getRoleDetail } from "@/api/system/role";
 export default {
   data() {
     return {
       loading: true,
       excelBox: false,
       dialogExamFormVisible: false,
+      search:{},
       optionExamApply: {
         height: "auto",
         filterBtn: true,
@@ -343,6 +347,11 @@
         editBtn: this.vaildData(this.permission.notice_edit, false),
       };
     },
+   
+  },
+  created(){
+    this.search['cancel'] = 1;
+    this.search['auditStatus'] = 4;
   },
   methods: {
     //准考证查看
@@ -355,15 +364,12 @@
       });
     },
     sizeChange(val) {
-      this.page1.currentPage = 1;
-      this.page1.pageSize = val;
+      this.page.pageSize = val;
       this.getData();
-      //   this.$message.success("行数" + val);
     },
     currentChange(val) {
-      this.page1.currentPage = val;
+      this.page.currentPage = val;
       this.getData();
-      //   this.$message.success("页码" + val);
     },
     rowSave(form, done, loading) {
       var that = this;
@@ -405,8 +411,6 @@
       this.onLoad(this.page);
     },
     rowUpdate(row, index, done, loading) {
-      // console.log(row);
-
       update(row).then(
         () => {
           this.onLoad(this.page);
@@ -515,20 +519,42 @@
       this.onLoad(this.page, this.query);
     },
     onLoad(page, params = {}) {
-      // params['cancel'] = 111;
       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;
@@ -554,19 +580,19 @@
     //生成考试
     submitExamApply(row, done, loading) {
       var that = this;
-      var startTime = row.startTime + ":00";
-      var endTime = row.endTime + ":00";
+      row.startTime = row.startTime + ":00";
+      row.endTime = row.endTime + ":00";
       if(row.number!=((row.serialEnd-row.serialStart)+1)){
           this.$message({
             type: "error",
-            message: "考试人数也序号不匹配!",
+            message: "考试人数与序号不匹配!",
           });
          done();
          return;
       }
 
-      var s = new Date(startTime);
-      var e = new Date(endTime);
+      var s = new Date(row.startTime);
+      var e = new Date(row.endTime);
       if(s>e){
         this.$message({
             type: "error",
@@ -576,12 +602,15 @@
          return;
       }
       
-      addExam(this.ids, null, startTime,row.number, endTime,row.serialStart,row.serialEnd).then(
+      addExam(Object.assign(row, this.search)).then(
         () => {
           this.onLoad(this.page);
-          
           that.$refs.formExamApply.resetFields();
           that.dialogExamFormVisible = false;
+          this.$message({
+            type: "success",
+            message: "操作成功",
+          });
           done();
         },
         (error) => {
@@ -594,14 +623,6 @@
     closeDialog() {
       this.$refs.formExamApply.resetFields();
     },
-  },
-  mounted() {
-    // this.Ourdata = data;
-    // this.getData();
-    // this.onLoad(this.page);
-    // var dept_id = JSON.parse(
-    //   window.localStorage.getItem("saber-userInfo")
-    // ).content.dept_id;
   },
 };
 </script>

--
Gitblit v1.9.3