学员成绩管理条件查询

This commit is contained in:
2026-08-26 16:12:39 +08:00
parent ebbbd5fb01
commit 2c4cc2aaaf
2 changed files with 77 additions and 33 deletions
+69 -25
View File
@@ -3,12 +3,22 @@
<!-- ==================== 1. 查询条件区域 ==================== -->
<el-card shadow="never" class="search-card">
<el-form :model="queryForm" label-width="90px" inline class="search-form">
<el-form-item label="学员编号">
<el-input v-model="queryForm.xybh" placeholder="请输入学员编号" clearable style="width: 200px" />
<el-form-item label="学号">
<el-input v-model="queryForm.xh" placeholder="请输入学号" clearable style="width: 180px" />
</el-form-item>
<el-form-item label="年度">
<el-input v-model="queryForm.nd" placeholder="如 2026" clearable style="width: 140px" />
</el-form-item>
<el-form-item label="课程名称">
<el-select v-model="queryForm.kcbh" placeholder="请选择课程名称" clearable filterable style="width: 200px">
<el-option v-for="item in kbOptions" :key="item.kbh" :label="item.kmc" :value="item.kbh" />
</el-select>
</el-form-item>
<el-form-item label="班次">
<el-select v-model="queryForm.xydbh" placeholder="请选择班次" clearable filterable style="width: 200px">
<el-option v-for="item in teamOptions" :key="item.xydbh" :label="item.xydmc" :value="item.xydbh" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="handleSearch">查询</el-button>
</el-form-item>
@@ -27,7 +37,6 @@
<el-tab-pane label="课程成绩" name="grades">
<el-table v-loading="loading" :data="gradesData" stripe border style="width: 100%">
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="xybh" label="学员编号" min-width="110" show-overflow-tooltip />
<el-table-column prop="kmbh" label="科目编号" min-width="110" show-overflow-tooltip />
<el-table-column prop="klx" label="课类型" min-width="90" align="center" />
<el-table-column prop="kscj" label="考试成绩" min-width="90" align="center" />
@@ -37,7 +46,7 @@
<el-table-column prop="bkcs" label="补考次数" min-width="90" align="center" />
<el-table-column prop="ksqk" label="考试情况" min-width="90" align="center" />
<el-table-column prop="qwxf" label="期望学分" min-width="90" align="center" />
<el-table-column prop="ytg" label="已通过" min-width="80" align="center" />
<el-table-column prop="ytg" label="考试结果" min-width="90" align="center" :formatter="formatExamResult" />
<el-table-column prop="nd" label="年度" min-width="80" align="center" />
</el-table>
<el-empty v-if="!loading && gradesData.length === 0" description="暂无课程成绩数据" :image-size="60" />
@@ -47,7 +56,6 @@
<el-tab-pane label="课程过程成绩" name="process">
<el-table v-loading="loading" :data="processGradesData" stripe border style="width: 100%">
<el-table-column type="index" label="序号" width="55" align="center" />
<el-table-column prop="xybh" label="学员编号" min-width="110" show-overflow-tooltip />
<el-table-column prop="kmbh" label="科目编号" min-width="110" show-overflow-tooltip />
<el-table-column prop="klx" label="课类型" min-width="90" align="center" />
<el-table-column prop="yscj" label="原始成绩" min-width="90" align="center" />
@@ -78,6 +86,8 @@ import {
exportStudentGrades,
exportStudentProcessGrades
} from "@/api/studentRecords/studentRecords"
import { listKb } from "@/api/teachOffice/kb"
import { listTeam } from "@/api/studentRecords/team"
export default {
name: 'ScoreIndex',
@@ -85,10 +95,16 @@ export default {
return {
// ==================== 查询条件 ====================
queryForm: {
xybh: '',
nd: ''
xh: '',
nd: '',
kcbh: '',
xydbh: ''
},
// ==================== 下拉选项 ====================
kbOptions: [],
teamOptions: [],
// ==================== 数据表格 ====================
// 数据来源:grades 课程成绩 / process 课程过程成绩
activeTab: 'grades',
@@ -107,15 +123,48 @@ export default {
}
},
mounted() {
this.loadKbOptions()
this.loadTeamOptions()
this.loadData()
},
methods: {
/** 格式化考试结果:1 已通过,0 不通过 */
formatExamResult(row, column, cellValue) {
if (cellValue === 1 || cellValue === '1') return '已通过'
if (cellValue === 0 || cellValue === '0') return '不通过'
return ''
},
/** 加载课程名称下拉选项 */
loadKbOptions() {
listKb({ pageNum: 1, pageSize: 1000 }).then(res => {
const data = res.data || {}
this.kbOptions = data.records || []
}).catch(() => {
this.kbOptions = []
})
},
/** 加载班次下拉选项 */
loadTeamOptions() {
listTeam({ pageNum: 1, pageSize: 1000 }).then(res => {
const data = res.data || {}
this.teamOptions = data.records || []
}).catch(() => {
this.teamOptions = []
})
},
/** 组装查询参数,仅传非空值 */
buildQueryParams(params) {
const xybh = this.queryForm.xybh && this.queryForm.xybh.trim()
const xh = this.queryForm.xh && this.queryForm.xh.trim()
const nd = this.queryForm.nd && this.queryForm.nd.trim()
if (xybh) params.xybh = xybh
const kcbh = this.queryForm.kcbh && this.queryForm.kcbh.trim()
const xydbh = this.queryForm.xydbh && this.queryForm.xydbh.trim()
if (xh) params.xh = xh
if (nd) params.nd = nd
if (kcbh) params.kcbh = kcbh
if (xydbh) params.xydbh = xydbh
},
loadData() {
@@ -170,23 +219,19 @@ export default {
URL.revokeObjectURL(link.href)
},
/** 校验导出所需学员编号 */
requireXybh(exportName) {
const xybh = this.queryForm.xybh && this.queryForm.xybh.trim()
if (!xybh) {
this.$message.warning('导出' + exportName + '前请先输入学员编号')
return null
}
return xybh
/** 构建导出查询参数 */
buildExportQuery() {
const query = {}
this.buildQueryParams(query)
return query
},
/** 导出课程成绩 Excel */
handleExportGrades() {
const xybh = this.requireXybh('课程成绩')
if (!xybh) return
const query = this.buildExportQuery()
this.exportLoading = true
exportStudentGrades(xybh).then(res => {
this.downloadBlob(res, `课程成绩_${xybh}.xls`)
exportStudentGrades(query).then(res => {
this.downloadBlob(res, `课程成绩_${Date.now()}.xls`)
this.$message.success('课程成绩导出成功')
}).catch(() => { }).finally(() => {
this.exportLoading = false
@@ -195,11 +240,10 @@ export default {
/** 导出课程过程成绩 Excel */
handleExportProcessGrades() {
const xybh = this.requireXybh('课程过程成绩')
if (!xybh) return
const query = this.buildExportQuery()
this.exportLoading = true
exportStudentProcessGrades(xybh).then(res => {
this.downloadBlob(res, `课程过程成绩_${xybh}.xls`)
exportStudentProcessGrades(query).then(res => {
this.downloadBlob(res, `课程过程成绩_${Date.now()}.xls`)
this.$message.success('课程过程成绩导出成功')
}).catch(() => { }).finally(() => {
this.exportLoading = false