feat(exam): 添加按班级、年级、学生姓名筛选考试结果功能
- 在ExamWordsResultReqVO中新增classId、gradeId、studentName字段 - 修改ExamWordsJudgeService接口及实现,支持按筛选条件获取考试结果 - 在ExamWordsJudgeResultDOMapper中添加按学生ID列表分页查询方法 - 扩展StudentDOMapper,新增按班级、年级和姓名查询学生列表方法 - 修改ExamWordsController,支持从请求体接收筛选参数 - 修改前端exam.js,调用接口时传递筛选参数 - 在uploadpng.vue页面新增筛选表单,支持班级、年级、学生姓名输入 - 增加班级和年级选项数据的获取 - 实现筛选查询、重置功能及班级切换自动同步年级 - 在App.vue中配置Element Plus中文语言环境 - 调整配置文件,更新学习计划模板路径 - 修改接口权限配置,关闭plan/word/voice路径的鉴权
This commit is contained in:
@@ -1,11 +1,14 @@
|
||||
|
||||
|
||||
<template>
|
||||
<router-view></router-view>
|
||||
<el-config-provider :locale="locale">
|
||||
<router-view />
|
||||
</el-config-provider>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
|
||||
import zhCn from 'element-plus/es/locale/lang/zh-cn'
|
||||
const locale = zhCn
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
||||
@@ -5,10 +5,13 @@ export function uploadExamWordsPng(data) {
|
||||
return axios.post('/exam/words/submit', data)
|
||||
}
|
||||
|
||||
export function getExamWordsResult(page, size) {
|
||||
export function getExamWordsResult(page, size, classId, gradeId, studentName) {
|
||||
return axios.post('/exam/words/get', {
|
||||
page: page,
|
||||
size: size
|
||||
size: size,
|
||||
classId: classId,
|
||||
gradeId: gradeId,
|
||||
studentName: studentName
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,35 @@
|
||||
</div>
|
||||
<div class="bg-white dark:bg-gray-800 rounded-lg shadow p-6">
|
||||
<div class="text-lg font-semibold mb-4">结果集</div>
|
||||
<el-form :inline="true" class="mb-4">
|
||||
<el-form-item label="班级">
|
||||
<el-select v-model="classId" placeholder="选择班级" clearable filterable @change="onClassChange" style="min-width: 220px">
|
||||
<el-option
|
||||
v-for="item in classOptions"
|
||||
:key="item.id"
|
||||
:label="`${item.title}${item.gradeName ? '(' + item.gradeName + ')' : ''}`"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="年级">
|
||||
<el-select v-model="gradeId" placeholder="选择年级" clearable filterable style="min-width: 220px">
|
||||
<el-option
|
||||
v-for="g in gradeOptions"
|
||||
:key="g.id"
|
||||
:label="g.title"
|
||||
:value="g.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="学生姓名">
|
||||
<el-input v-model="studentName" placeholder="学生姓名" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" @click="handleSearch">查询</el-button>
|
||||
<el-button @click="handleReset">重置</el-button>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-table
|
||||
:data="list"
|
||||
border
|
||||
@@ -70,6 +99,8 @@ import Header from '@/layouts/components/Header.vue'
|
||||
import ExamWordsDetailCard from '@/layouts/components/ExamWordsDetailCard.vue'
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { uploadExamWordsPng, getExamWordsResult } from '@/api/exam'
|
||||
import { getClassList } from '@/api/class'
|
||||
import { getGradeList } from '@/api/grade'
|
||||
|
||||
const list = ref([])
|
||||
const pageNo = ref(1)
|
||||
@@ -78,11 +109,22 @@ const totalCount = ref(0)
|
||||
const loading = ref(false)
|
||||
const showDetail = ref(false)
|
||||
const selectedId = ref(null)
|
||||
const classId = ref(null)
|
||||
const gradeId = ref(null)
|
||||
const studentName = ref('')
|
||||
const classOptions = ref([])
|
||||
const gradeOptions = ref([])
|
||||
|
||||
async function fetchList() {
|
||||
loading.value = true
|
||||
try {
|
||||
const res = await getExamWordsResult(pageNo.value, pageSize.value)
|
||||
const res = await getExamWordsResult(
|
||||
pageNo.value,
|
||||
pageSize.value,
|
||||
classId.value,
|
||||
gradeId.value,
|
||||
studentName.value
|
||||
)
|
||||
const d = res.data
|
||||
list.value = Array.isArray(d.data) ? d.data : []
|
||||
totalCount.value = d.totalCount || 0
|
||||
@@ -93,6 +135,18 @@ async function fetchList() {
|
||||
}
|
||||
}
|
||||
|
||||
async function fetchClassOptions() {
|
||||
const res = await getClassList(1, 200)
|
||||
const d = res.data
|
||||
classOptions.value = Array.isArray(d.data) ? d.data : []
|
||||
}
|
||||
|
||||
async function fetchGradeOptions() {
|
||||
const res = await getGradeList(1, 200)
|
||||
const d = res.data
|
||||
gradeOptions.value = Array.isArray(d.data) ? d.data : []
|
||||
}
|
||||
|
||||
function handlePageChange(p) {
|
||||
pageNo.value = p
|
||||
fetchList()
|
||||
@@ -117,8 +171,28 @@ function handleRowClick(row) {
|
||||
showDetail.value = true
|
||||
}
|
||||
|
||||
function handleSearch() {
|
||||
pageNo.value = 1
|
||||
fetchList()
|
||||
}
|
||||
|
||||
function handleReset() {
|
||||
classId.value = null
|
||||
gradeId.value = null
|
||||
studentName.value = ''
|
||||
pageNo.value = 1
|
||||
fetchList()
|
||||
}
|
||||
|
||||
function onClassChange(val) {
|
||||
const item = classOptions.value.find(i => i.id === val)
|
||||
gradeId.value = item ? item.gradeId : null
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
fetchList()
|
||||
fetchClassOptions()
|
||||
fetchGradeOptions()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user