From 4f6cdee3d3a9967b6955aacc354bf557430c0643 Mon Sep 17 00:00:00 2001
From: zhouwx <1175765986@qq.com>
Date: 星期一, 05 八月 2024 17:05:16 +0800
Subject: [PATCH] 批改

---
 src/views/onlineEducation/groupExams/components/student.vue |  154 ++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 132 insertions(+), 22 deletions(-)

diff --git a/src/views/onlineEducation/groupExams/components/student.vue b/src/views/onlineEducation/groupExams/components/student.vue
index 63b6e46..93b9743 100644
--- a/src/views/onlineEducation/groupExams/components/student.vue
+++ b/src/views/onlineEducation/groupExams/components/student.vue
@@ -1,18 +1,55 @@
 <template>
   <div class="app-container">
-    <div style="margin-bottom: 10px;display: flex;align-items: center;justify-content: space-between">
-      <el-button
-          type="primary"
-          plain
-          icon="Plus"
-          @click="openDialog()"
-      >选择学员</el-button>
-      <el-button
-          type="danger"
-          plain
-          icon="Delete"
-          @click="handleDeleteBatch"
-      >批量删除</el-button>
+    <div style="display: flex;justify-content: space-between">
+      <el-form :inline="true" style="display: flex;align-items: center;flex-wrap: wrap;" >
+        <el-form-item>
+          <el-button
+              type="primary"
+              plain
+              icon="Plus"
+              @click="openDialog()"
+          >选择学员</el-button>
+        </el-form-item>
+        <el-form-item label="学生姓名:" >
+          <el-input v-model="data.queryParams.studentName" placeholder="请输入学生姓名"></el-input>
+        </el-form-item>
+        <el-form-item label="试卷状态:" >
+          <el-select
+              v-model="data.queryParams.state"
+              class="w100"
+              style="max-width: 180px"
+              clearable
+              size="default"
+          >
+            <el-option v-for="item in data.completeList" :key="item.id" :label="item.name" :value="item.id"></el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item >
+          <el-button
+              type="primary"
+              @click="getList"
+          >查询</el-button>
+          <el-button
+              type="primary"
+              plain
+              @click="reset"
+          >重置</el-button>
+        </el-form-item>
+      </el-form>
+      <div>
+        <el-button
+            type="danger"
+            plain
+            icon="Delete"
+            @click="handleDeleteBatch"
+        >批量删除</el-button>
+        <el-button
+            type="primary"
+            plain
+            @click="back"
+        >返回</el-button>
+      </div>
+
     </div>
     <!-- 表格数据 -->
     <el-table ref="tableRef" v-loading="loading" :data="dataList" :border="true" :row-key="getRowKey"  @selection-change="handleSelectionChange">
@@ -33,14 +70,29 @@
           <span>{{scope.row.student.phone}}</span>
         </template>
       </el-table-column>
-      <el-table-column label="成绩" prop="score" align="center"  />
+      <el-table-column label="试卷状态" prop="state" align="center" >
+        <template #default="scope">
+          <span>{{scope.row.state ===0 ? '待考试' : scope.row.state ===1 ? '待批阅':'批阅完成'}}</span>
+        </template>
+      </el-table-column>
+<!--      <el-table-column label="考试是否完成" prop="completed" align="center" >-->
+<!--        <template #default="scope">-->
+<!--          <span>{{scope.row.completed ===0 ? '未完成' : '已完成'}}</span>-->
+<!--        </template>-->
+<!--      </el-table-column>-->
+      <el-table-column label="成绩" prop="score" align="center" >
+        <template #default="scope">
+          <span>{{scope.row.state ===0 ? '--' : scope.row.score}}</span>
+        </template>
+      </el-table-column>
       <el-table-column label="是否合格" prop="passed" align="center"  >
         <template #default="scope">
-          <span>{{scope.row.passed === 0 ? '不合格' : '合格'}}</span>
+          <span>{{scope.row.state ===0 ? '--' : scope.row.passed === 0 ? '不合格' : '合格'}}</span>
         </template>
       </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width"  width="180">
         <template #default="scope">
+          <el-button link type="primary" @click="correct(scope.row)" v-if="scope.row.state != 0">批阅</el-button>
           <el-button link type="danger" @click="handleDelete(scope.row)">删除</el-button>
         </template>
       </el-table-column>
@@ -64,11 +116,11 @@
 import Cookies from "js-cookie";
 import {delQuestionBank, getQuestionBank} from "@/api/onlineEducation/questionBank";
 import {batchDelStudent, delBatchStu, getBatchStudent} from "@/api/onlineEducation/batch";
-import {useRoute} from 'vue-router'
+import {useRoute, useRouter} from 'vue-router'
 import {delExamStu, examDelStudent, getExamStudent} from "@/api/onlineEducation/exam";
 import ExamChooseStudent from "@/views/onlineEducation/groupExams/components/examChooseStudent.vue";
 const route = useRoute()
-
+const router = useRouter();
 
 const { proxy } = getCurrentInstance();
 const loading = ref(false);
@@ -77,19 +129,49 @@
 const data = reactive({
   queryParams: {
     paperId: null,
+    studentName: '',
+    state: null,
     pageNum: 1,
     pageSize: 10,
   },
   total: 0,
   dataList: [],
   isAdmin: false,
-  chooseStu: []
+  chooseStu: [],
+  completeList: [
+    {
+      id: 0,
+      name: '待考试'
+    },
+    {
+      id: 1,
+      name: '待批阅'
+    },
+    {
+      id: 2,
+      name: '批阅完成'
+    },
+  ]
 
 });
 
 const { queryParams, total, dataList } = toRefs(data);
 
+const backValue = ref()
 onMounted(async ()=>{
+
+  if(route.query.val){
+    const val = JSON.parse(route.query.val)
+    if(val.type == 'index'){
+      data.queryParams.pageNum = val.pageNum;
+      data.queryParams.pageSize = val.pageSize;
+      data.queryParams.paperId = val.id
+    }else {
+      data.queryParams.paperId = val.paperId
+      data.queryParams.pageNum = val.pageNum;
+      data.queryParams.pageSize = val.pageSize;
+    }
+  }
   const userInfo = JSON.parse(Cookies.get('userInfo'))
   console.log("userInfo",userInfo)
   if(userInfo.userType === 0){
@@ -97,9 +179,6 @@
   }else {
     data.isAdmin = false;
   }
-  const val = JSON.parse(route.query.val)
-  // data.queryParams.pageId = val.id
-  data.queryParams.paperId = val.id
   await getList()
 })
 onUnmounted(()=>{
@@ -108,6 +187,18 @@
 
 const getRowKey = (row) => {
   return row.id
+}
+
+const back = () => {
+  // router.push("/group");
+
+  const obj = {
+
+    pageNum: data.queryParams.pageNum,
+    pageSize: data.queryParams.pageSize,
+  }
+  const v = JSON.stringify(obj)
+  router.push({ path: "/group", query: { val: v } });
 }
 const getList = async () => {
   loading.value = true
@@ -127,13 +218,32 @@
 
 /** 重置新增的表单以及其他数据  */
 function reset() {
-  proxy.resetForm("roleRef");
+  data.queryParams = {
+    paperId: data.queryParams.paperId,
+    studentName: '',
+    state: null,
+    pageNum: 1,
+    pageSize: 10,
+  }
+  getList()
 }
 const handleSelectionChange = (val) => {
 
   console.log("选中的行", val)
   data.chooseStu = val.map(item => item.id)
 }
+
+const correct = (val) => {
+  const obj = {
+    id: val.id,
+    paperId: data.queryParams.paperId,
+    pageNum: data.queryParams.pageNum,
+    pageSize: data.queryParams.pageSize,
+    state: val.state
+  }
+  const v = JSON.stringify(obj)
+  router.push({ path: "/correctExam", query: { val: v } });
+}
 const handleDelete = (val) => {
   ElMessageBox.confirm(
       '确定删除此条数据?',

--
Gitblit v1.9.2