From 80561b2bc83bb35582ba62e0c21a63c3ee5a0e82 Mon Sep 17 00:00:00 2001
From: lohir <3399054449@qq.com>
Date: 星期三, 16 十月 2024 17:15:00 +0800
Subject: [PATCH] bug

---
 src/views/exam/exam/ExamManage.vue |   47 ++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 42 insertions(+), 5 deletions(-)

diff --git a/src/views/exam/exam/ExamManage.vue b/src/views/exam/exam/ExamManage.vue
index 53261b4..97a4c6c 100644
--- a/src/views/exam/exam/ExamManage.vue
+++ b/src/views/exam/exam/ExamManage.vue
@@ -75,21 +75,43 @@
             size="small"
             @click="handlerEdit(scope.row)"
             v-if="scope.row.status === 'not_start'"
+            v-show="scope.row.status !== 'cancel'"
           >淇敼
           </el-button>
           <el-popconfirm
             v-if="scope.row.status === 'not_start'"
+            v-show="scope.row.status !== 'cancel'"
             style="margin: 0 5px"
             title="纭畾瑕佸垹闄よ鑰冭瘯鍚楋紵"
             @confirm="deleteExam(scope.row.id)"
           >
-            <el-button slot="reference" type="danger" size="small">鍒犻櫎</el-button>
+            <el-button slot="reference" type="danger" size="small" v-show="scope.row.status !== 'cancel'">鍒犻櫎</el-button>
           </el-popconfirm>
 
-          <el-button v-if="scope.row.status === 'finished'" type="success" size="small" @click="markPaper(scope.row)">
+          <el-button v-if="scope.row.status === 'finished'" type="success" size="small" @click="markPaper(scope.row)" v-show="scope.row.status !== 'cancel'">
             闃呭嵎
           </el-button>
-          <el-button v-if="scope.row.status === 'ing'" type="warning" size="small" @click="monitor(scope.row)">鐩戞帶</el-button>
+          <el-button v-if="scope.row.status === 'ing'" type="warning" size="small" @click="monitor(scope.row)" v-show="scope.row.status !== 'cancel'">鐩戞帶</el-button>
+          <el-popconfirm
+            class="confirm"
+            style="margin: 0 5px"
+            title="纭畾瑕佷綔搴熻鑰冭瘯璁板綍鍚楋紵"
+            @confirm="cancel(scope.row.id)"
+          >
+            <el-button slot="reference" v-show="scope.row.status !== 'cancel'" type="danger"
+                       size="small"
+                       v-if="scope.row.status !== 'ing'">浣滃簾
+            </el-button>
+          </el-popconfirm>
+          <el-popconfirm
+            class="confirm"
+            title="纭畾瑕佹仮澶嶈鑰冭瘯璁板綍鍚楋紵"
+            @confirm="recover(scope.row.id)"
+          >
+            <el-button slot="reference" v-show="scope.row.status === 'cancel'" type="success"
+                       size="small">鎭㈠姝e父
+            </el-button>
+          </el-popconfirm>
         </template>
       </el-table-column>
     </el-table>
@@ -150,8 +172,7 @@
 
 <script>
 import Pagination from '@/components/Pagination'
-import { getExams, addExam, editExam, deleteExamById } from '@/api/exam'
-import { myClasses } from '@/api/classes'
+import { getExams, addExam, editExam, deleteExamById, cancel, recover } from '@/api/exam'
 import examPaperAPI from '@/api/examPaper'
 
 export default {
@@ -211,6 +232,20 @@
     this.MyExamPaperList()
   },
   methods: {
+    // 浣滃簾鑰冭瘯
+    cancel (id) {
+      cancel(id).then(res => {
+        this.$message.success(res.data.message)
+        this.page()
+      })
+    },
+    // 鎭㈠鑰冭瘯
+    recover (id) {
+      recover(id).then(res => {
+        this.$message.success(res.data.message)
+        this.page()
+      })
+    },
     // 鑰冭瘯鐩戞帶鍒楄〃
     monitor (row) {
       this.$router.push({ path: '/exam/monitor', query: { examId: row.id } })
@@ -229,6 +264,8 @@
         return '鏈紑濮�'
       } else if (row.status === 'finished') {
         return '宸茬粨鏉�'
+      } else if (row.status === 'cancel') {
+        return '宸蹭綔搴�'
       }
     },
     MyExamPaperList () {

--
Gitblit v1.8.0