提交 39a11865 authored 作者: 王鹏飞's avatar 王鹏飞

chore: 新增查看学生答题状态

上级 814621fe
......@@ -4,6 +4,7 @@ import type { ClassItem } from '../types'
import { getClassStudentList } from '../api'
interface Props {
experimentId: string
data: ClassItem
}
......@@ -13,9 +14,32 @@ const props = defineProps<Props>()
const listOptions = {
remote: {
httpRequest: getClassStudentList,
params: { class_id: props.data?.id }
},
columns: [
params: { class_id: props.data?.id, experiment_id: props.experimentId },
callback(res: any) {
questions.value = res.questions
return res
}
}
}
const questions = ref<{ id: string }[]>([])
const questionColumns = computed(() => {
return questions.value.map((item, index) => {
return {
prop: item.id,
label: `第${index + 1}题`,
computed({ row }: any) {
const value = row[item.id]
if (value === '进行中') return '<span style="color:#b20f3c">进行中</span>'
if (value === '已完成') return '<span style="color:#b8b5b5">已完成</span>'
return value
}
}
})
})
const columns = computed(() => {
return [
{ label: '序号', type: 'index', width: 60 },
{ label: '学号', prop: 'id_number' },
{ label: '姓名', prop: 'name' },
......@@ -23,12 +47,12 @@ const listOptions = {
{ label: '所属部门/学校', prop: 'organ_id_name' },
{ label: '专业', prop: 'specialty_id_name' },
{ label: '班级', prop: 'class_id_name' }
]
}
].concat(questionColumns.value)
})
</script>
<template>
<el-dialog title="查看班级学生">
<AppList v-bind="listOptions"></AppList>
<AppList v-bind="listOptions" :columns="columns"></AppList>
<el-row justify="center">
<el-button round auto-insert-space @click="$emit('update:modelValue', false)">关闭</el-button>
</el-row>
......
......@@ -42,6 +42,8 @@ const listOptions = {
{ label: '专业名称', prop: 'specialty_id_name' },
{ label: '班级名称', prop: 'name' },
{ label: '学生人数', prop: 'student_nums' },
{ label: '已完成人数', prop: 'complete_nums' },
{ label: '未完成人数', prop: 'not_complete_nums' },
{ label: '更新时间', prop: 'updated_time' },
{ label: '操作', slots: 'table-x', width: 300 }
]
......@@ -149,6 +151,7 @@ const dmlURL = computed(() => {
<StudentListDialog
v-model="studentListVisible"
:data="rowData"
:experimentId="id"
v-if="studentListVisible && rowData"></StudentListDialog>
<ViewGradeRules v-model="gradeRulesVisible" :data="detail" v-if="gradeRulesVisible && detail"></ViewGradeRules>
<ViewReportRules v-model="reportRulesVisible" :experiment_id="id" v-if="reportRulesVisible"></ViewReportRules>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论