From 78d031bd51869762e881c524fc7b855f8fa8ad0d Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期四, 04 七月 2024 17:08:24 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 src/views/exam/exam/monitor.vue |   66 ++++++++++++++++++++++++++-------
 1 files changed, 52 insertions(+), 14 deletions(-)

diff --git a/src/views/exam/exam/monitor.vue b/src/views/exam/exam/monitor.vue
index b43c8f5..eade8d1 100644
--- a/src/views/exam/exam/monitor.vue
+++ b/src/views/exam/exam/monitor.vue
@@ -17,9 +17,30 @@
       <el-table-column align="center" prop="status" label="鐘舵��" :formatter="statusFormatter" />
       <el-table-column label="鎿嶄綔" align="center">
         <template slot-scope="{row}">
+          <el-popover
+            placement="right"
+            width="400"
+            trigger="click">
+            <el-form :model="addTimeForm" ref="addTimeForm" :rules="addTimeRule">
+              <el-form-item label="瀛﹀憳">
+                <span>{{row.userName}}</span>
+              </el-form-item>
+              <el-form-item label="鍔犲灏戝垎閽�">
+                <el-input v-model="addTimeForm.addTimeM" type="number" size="small"/>
+              </el-form-item>
+              <el-form-item>
+                <el-button size="mini" type="success" @click="handlerAddTime(row)">鍔犳椂</el-button>
+              </el-form-item>
+            </el-form>
+            <el-button size="mini" slot="reference">鍔犳椂</el-button>
+          </el-popover>
           <el-button size="mini" type="danger" @click="handleNullify(row)">浣滃簾</el-button>
-          <el-button size="mini" type="primary" @click="edit(row)">鏀跺嵎</el-button>
-          <el-button size="mini" type="success" @click="handlerAddTime(row)">鍔犳椂</el-button>
+          <el-popconfirm
+            title="纭畾瑕佸己鍒舵彁浜よ瀛﹀憳鐨勮瘯鍗峰悧锛�"
+            @confirm="handlerForceSubmit(row.userId)"
+          >
+            <el-button size="mini" type="primary" slot="reference">鏀跺嵎</el-button>
+          </el-popconfirm>
         </template>
       </el-table-column>
     </el-table>
@@ -48,15 +69,13 @@
 <script>
 import { mapGetters, mapState } from 'vuex'
 import Pagination from '@/components/Pagination'
-import { monitorList } from '@/api/exam'
+import { monitorList, addTime, forceSubmit } from '@/api/exam'
 import cheatApi from '@/api/cheat'
 
 export default {
   components: { Pagination },
   data() {
     return {
-      addTimeShow: false,
-      forceSubmitShow: false,
       listLoading: true,
       queryParam: {
         examId: '',
@@ -75,12 +94,11 @@
         examId: null,
         userId: null,
         userName: '',
-        addTimeSecond: 0
+        addTimeM: 0  // 娣诲姞澶氬皯鍒嗛挓
       },
       forceSubmitForm: {
         examId: null,
-        userId: null,
-        userName: '',
+        userId: null
       },
       visible: false,
       rules: {
@@ -91,6 +109,14 @@
           { required: true, message: '璇疯緭鍏ユ帓搴�', trigger: 'blur', type: 'number' }
         ]
       },
+      addTimeRule: {
+        userId: [
+          { required: true, message: '璇烽�夋嫨涓鸿皝鍔犳椂', trigger: 'blur' }
+        ],
+        addTimeSecond: [
+          { required: true, message: '璇疯緭鍏ュ姞鏃舵椂闂�', trigger: 'blur' }
+        ]
+      },
     };
   },
   created() {
@@ -99,12 +125,24 @@
   },
   methods: {
     // 澶勭悊鍔犳椂
-    // handlerAddTime(row) {
-    //   this.addTimeShow = true
-    // },
-    // handlerForceSubmit(row) {
-    //
-    // },
+    handlerAddTime() {
+      this.$refs['addTimeForm'].validate((valid) => {
+        if (valid) {
+          this.addTimeForm.examId = this.queryParam.examId
+          addTime(this.addTimeForm).then(res => {
+            this.$message.success('鍔犳椂鎴愬姛')
+          })
+        }
+      })
+    },
+    // 寮哄埗浜ゅ嵎
+    handlerForceSubmit(userId) {
+      this.forceSubmitForm.examId = this.queryParam.examId
+      this.forceSubmitForm.userId = userId
+      forceSubmit(this.forceSubmitForm).then(res => {
+        this.$message.success('寮哄埗浜ゅ嵎鎴愬姛')
+      })
+    },
     handleNullify(row) {
       let cheatObj = { examId: row.examId, cheatUser: row.userId };
       cheatApi.edit(cheatObj).then(res => {

--
Gitblit v1.8.0