From b404ad06a9fe74036141c996aa89daa75a0d8407 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Tue, 03 Aug 2021 10:35:41 +0800
Subject: [PATCH] 考试报名删除修改为取消报名,报名状态修改,已取消报名的人无法打印准考证

---
 src/views/applyexam/index.vue     |   79 +++++++++++++++++--
 src/api/examapi/applyexam.js      |   66 +++++++++-------
 src/views/trainApply/index.vue    |   38 ++++++++-
 src/views/applydetailed/index.vue |   39 ++++++++-
 4 files changed, 171 insertions(+), 51 deletions(-)

diff --git a/src/api/examapi/applyexam.js b/src/api/examapi/applyexam.js
index 08c81f2..c2f48aa 100644
--- a/src/api/examapi/applyexam.js
+++ b/src/api/examapi/applyexam.js
@@ -2,46 +2,54 @@
 
 
 export const getApplyList = (current, size, params) => {
-  return request({
-    url: '/api/apply/page',
-    method: 'get',
-    params: {
-      ...params,
-      current,
-      size
-    }
-  })
+    return request({
+        url: '/api/apply/page',
+        method: 'get',
+        params: {
+            ...params,
+            current,
+            size
+        }
+    })
 }
 
 export const addApply = (row) => {
-  return request({
-    url: '/api/apply/submit',
-    method: 'post',
-    data: row
-  })
+    return request({
+        url: '/api/apply/submit',
+        method: 'post',
+        data: row
+    })
+}
+
+export const updateApply = (row) => {
+    return request({
+        url: '/api/apply/submit',
+        method: 'post',
+        data: row
+    })
 }
 
 
 
 export const remove = (ids) => {
-  return request({
-    url: '/api/apply/remove',
-    method: 'post',
-    params: {
-      ids,
-    }
-  })
+    return request({
+        url: '/api/apply/remove',
+        method: 'post',
+        params: {
+            ids,
+        }
+    })
 }
 
 
 
 
 export const getMenu = (id) => {
-  return request({
-    url: '/api/apply/detail',
-    method: 'get',
-    params: {
-      id,
-    }
-  })
-}
+    return request({
+        url: '/api/apply/detail',
+        method: 'get',
+        params: {
+            id,
+        }
+    })
+}
\ No newline at end of file
diff --git a/src/views/applydetailed/index.vue b/src/views/applydetailed/index.vue
index 79c126b..82ec0d1 100644
--- a/src/views/applydetailed/index.vue
+++ b/src/views/applydetailed/index.vue
@@ -53,6 +53,7 @@
                             :type="type"
                             size="small"
                             icon="el-icon-receiving"
+                            :disabled="row.applyStatus==4"
                             @click="handlePrint(row)"
                             >准考证打印
                             </el-button>
@@ -96,7 +97,15 @@
 import { mapState } from 'vuex'
 
 
-
+var DIC = {
+    applyStatus: [{
+        label: '已报名',
+        value: 2
+    }, {
+        label: '已取消',
+        value: 4
+    }]
+}
 
 export default {
     data () {
@@ -263,7 +272,8 @@
                             required: true,
                             message: "请选择准考证号",
                             trigger: "blur"
-                        }]
+                        }],
+                        width:100
                     },
                     {
                         label: "身份证号",
@@ -358,7 +368,7 @@
                                             ? "0" + new Date().getSeconds()
                                             : new Date().getSeconds())),
 
-                        width: 180
+                        width: 160
                     },
                     {
                         label: "考试时间",
@@ -379,8 +389,27 @@
                         editDisplay: true,
                         // 表单编辑时是否为查看模式
                         editDetail: false,
-                        width: 180
-                    }
+                        width: 160
+                    },{
+                        label: "报名状态",
+                        prop: "applyStatus", 
+                        slot: true,
+                        // 表单新增时是否禁止
+                        addDisabled: false,
+                        // 表单新增时是否可见
+                        addDisplay: false,
+                        // 表单新增时是否为查看模式
+                        addDetail: false,
+                        // 表单编辑时是否禁止
+                        editDisabled: false,
+                        // 表单编辑时是否可见
+                        editDisplay: true,
+                        // 表单编辑时是否为查看模式
+                        editDetail: false,
+                        dicData:DIC.applyStatus,
+                        search:true,
+                        type:"select"
+                    },
                 ]
             },
             questionBankSearch: {},
diff --git a/src/views/applyexam/index.vue b/src/views/applyexam/index.vue
index e771cf6..469d25a 100644
--- a/src/views/applyexam/index.vue
+++ b/src/views/applyexam/index.vue
@@ -62,7 +62,16 @@
                             <el-button
                             :type="type"
                             size="small"
+                            icon="el-icon-refresh-left"
+                            :disabled="row.applyStatus==4"
+                            @click="handleCancel(row)"
+                            >取消报名
+                            </el-button>
+                            <el-button
+                            :type="type"
+                            size="small"
                             icon="el-icon-receiving"
+                            :disabled="row.applyStatus==4"
                             @click="handlePrint(row)"
                             >准考证打印
                             </el-button>
@@ -82,10 +91,21 @@
 import {
     getApplyList,
     addApply,
+    updateApply,
     remove
 } from "@/api/examapi/applyexam";
 import { mapState } from 'vuex'
 
+
+var DIC = {
+    applyStatus: [{
+        label: '已报名',
+        value: 2
+    }, {
+        label: '已取消',
+        value: 4
+    }]
+}
 
 
 
@@ -93,12 +113,9 @@
     data () {
 
         return {
-            obj: {
-                name: '张三',
-            },
             questionBankOption: {
                 // 操作栏多余按钮去除
-                delBtn: true,
+                delBtn: false,
                 editBtn: false,
                 addBtn: true,
                 selection: true,
@@ -255,7 +272,8 @@
                             required: true,
                             message: "请选择准考证号",
                             trigger: "blur"
-                        }]
+                        }],
+                        width: 100
                     },
                     {
                         label: "身份证号",
@@ -329,7 +347,7 @@
                         // 表单新增时是否禁止
                         addDisabled: true,
                         // 表单新增时是否可见
-                        addDisplay: true,
+                        addDisplay: false,
                         // 表单新增时是否为查看模式
                         addDetail: false,
                         // 表单编辑时是否禁止
@@ -350,7 +368,7 @@
                                             ? "0" + new Date().getSeconds()
                                             : new Date().getSeconds())),
 
-                        width: 180
+                        width: 160
                     },
                     {
                         label: "考试时间",
@@ -371,8 +389,27 @@
                         editDisplay: true,
                         // 表单编辑时是否为查看模式
                         editDetail: false,
-                        width: 180
-                    }
+                        width: 160
+                    },{
+                        label: "报名状态",
+                        prop: "applyStatus", 
+                        slot: true,
+                        // 表单新增时是否禁止
+                        addDisabled: false,
+                        // 表单新增时是否可见
+                        addDisplay: false,
+                        // 表单新增时是否为查看模式
+                        addDetail: false,
+                        // 表单编辑时是否禁止
+                        editDisabled: false,
+                        // 表单编辑时是否可见
+                        editDisplay: true,
+                        // 表单编辑时是否为查看模式
+                        editDetail: false,
+                        dicData:DIC.applyStatus,
+                        search:true,
+                        type:"select"
+                    },
                 ]
             },
             questionBankSearch: {},
@@ -490,8 +527,8 @@
 
         // 新增
         questionBankRowSave (row, done, loading) {
-
-            addApply({ userId: row.name, examId: row.examName, applyTime: row.applyTime }).then(() => {
+            // debugger;
+            addApply({ userId: row.userId, examId: row.examName, applyTime: row.applyTime }).then(() => {
                 this.questionBankOnLoad(this.questionBankPage);
                 this.$message({
                     type: "success",
@@ -522,6 +559,26 @@
                 });
         },
 
+        //取消报名
+        handleCancel(row){
+            this.$confirm("确定取消报名?", {
+                confirmButtonText: "确定",
+                cancelButtonText: "取消",
+                type: "warning"
+            })
+                .then(() => {
+                    row.applyStatus = 4;
+                    return updateApply(row);
+                })
+                .then(() => {
+                    this.questionBankOnLoad(this.questionBankPage);
+                    this.$message({
+                        type: "success",
+                        message: "操作成功!"
+                    });
+                });
+        },
+
         questionBankHandleDelete () {
             if (this.questionBankSelectionList.length === 0) {
                 this.$message.warning("请选择至少一条数据");
diff --git a/src/views/trainApply/index.vue b/src/views/trainApply/index.vue
index a0d9d02..429e3e8 100644
--- a/src/views/trainApply/index.vue
+++ b/src/views/trainApply/index.vue
@@ -45,6 +45,7 @@
                             :type="type"
                             size="small"
                             icon="el-icon-receiving"
+                            :disabled="row.cancel==2"
                             @click="handlePrint(row)"
                             >准考证打印
                             </el-button>
@@ -65,6 +66,15 @@
 
 import { mapState } from 'vuex'
 
+var DIC = {
+    cancel: [{
+        label: '已报名',
+        value: 1
+    }, {
+        label: '已取消',
+        value: 2
+    }]
+}
 
 
 
@@ -72,9 +82,6 @@
     data () {
 
         return {
-            obj: {
-                name: '张三',
-            },
             questionBankOption: {
                 // 操作栏多余按钮去除
                 delBtn: false,
@@ -327,7 +334,7 @@
                                             ? "0" + new Date().getSeconds()
                                             : new Date().getSeconds())),
 
-                        width: 180
+                        width: 160
                     },
                     {
                         label: "考试时间",
@@ -348,8 +355,27 @@
                         editDisplay: true,
                         // 表单编辑时是否为查看模式
                         editDetail: false,
-                        width: 180
-                    }
+                        width: 160
+                    },{
+                        label: "报名状态",
+                        prop: "cancel", 
+                        slot: true,
+                        // 表单新增时是否禁止
+                        addDisabled: false,
+                        // 表单新增时是否可见
+                        addDisplay: false,
+                        // 表单新增时是否为查看模式
+                        addDetail: false,
+                        // 表单编辑时是否禁止
+                        editDisabled: false,
+                        // 表单编辑时是否可见
+                        editDisplay: true,
+                        // 表单编辑时是否为查看模式
+                        editDetail: false,
+                        dicData:DIC.cancel,
+                        search:true,
+                        type:"select"
+                    },
                 ]
             },
             questionBankSearch: {},

--
Gitblit v1.9.3