From 36bcd67363842d58ade5f460f4ecf2804d7a46ba Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 06 Sep 2021 16:52:20 +0800
Subject: [PATCH] 培训考试列表修改,新增审核状态,考试申请修改,考试成绩修改,新增缺考标记

---
 src/views/trainingRegistration/data.js               |   39 ++++++
 src/views/trainExam/performance.vue                  |   42 ++++++
 src/api/trainingRegistration/trainingRegistration.js |   29 +++-
 src/views/trainApply/index.vue                       |  131 +++++++++++++++++++++
 src/api/examapi/performance.js                       |   37 +++--
 src/views/trainingRegistration/index.vue             |   44 +++---
 6 files changed, 265 insertions(+), 57 deletions(-)

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/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/performance.vue b/src/views/trainExam/performance.vue
index 95027d0..737dcd7 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,
@@ -529,6 +543,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/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..9765753 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>
@@ -133,6 +135,7 @@
       loading: true,
       excelBox: false,
       dialogExamFormVisible: false,
+      search:{},
       optionExamApply: {
         height: "auto",
         filterBtn: true,
@@ -343,6 +346,11 @@
         editBtn: this.vaildData(this.permission.notice_edit, false),
       };
     },
+   
+  },
+  created(){
+    this.search['cancel'] = 1;
+    this.search['auditStatus'] = 4;
   },
   methods: {
     //准考证查看
@@ -355,15 +363,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 +410,6 @@
       this.onLoad(this.page);
     },
     rowUpdate(row, index, done, loading) {
-      // console.log(row);
-
       update(row).then(
         () => {
           this.onLoad(this.page);
@@ -515,7 +518,7 @@
       this.onLoad(this.page, this.query);
     },
     onLoad(page, params = {}) {
-      // params['cancel'] = 111;
+      params = this.search;
       this.loading = true;
       getdata(
         page.currentPage,
@@ -554,8 +557,8 @@
     //生成考试
     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",
@@ -565,8 +568,8 @@
          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 +579,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 +600,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