From d70e74cf8f4e5d788e37c5ad91d7b8923cb7a956 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期四, 17 十月 2024 19:59:41 +0800
Subject: [PATCH] meet websocket

---
 src/views/exam/exam/ExamManage.vue |   50 ++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/src/views/exam/exam/ExamManage.vue b/src/views/exam/exam/ExamManage.vue
index 53261b4..5853fb9 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>
@@ -97,7 +119,7 @@
       class="flex"
       style="justify-content:center;margin-top:20px;"
     >
-      <pagination v-show="total>0" :total="total" :page.sync="searchForm.pageIndex" :limit.sync="searchForm.pageSize"
+      <pagination v-show="total>0" :total="total" :page.sync="searchForm.currentPage" :limit.sync="searchForm.pageSize"
                   @pagination="page"/>
     </div>
     <el-dialog width="500px" :title="title" @close="closeHandler" :visible.sync="open" :destroy-on-close="true"
@@ -150,7 +172,7 @@
 
 <script>
 import Pagination from '@/components/Pagination'
-import { getExams, addExam, editExam, deleteExamById } from '@/api/exam'
+import { getExams, addExam, editExam, deleteExamById, cancel, recover } from '@/api/exam'
 import { myClasses } from '@/api/classes'
 import examPaperAPI from '@/api/examPaper'
 
@@ -199,7 +221,7 @@
       searchForm: {
         examName: '',
         subject: null,
-        pageIndex: 1,
+        currentPage: 1,
         pageSize: 10
       },
       tableData: []
@@ -211,6 +233,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 +265,8 @@
         return '鏈紑濮�'
       } else if (row.status === 'finished') {
         return '宸茬粨鏉�'
+      } else if (row.status === 'cancel') {
+        return '宸蹭綔搴�'
       }
     },
     MyExamPaperList () {

--
Gitblit v1.8.0