Learn.Archives.Web/src/views/exam/classExamRecord.vue

172 lines
4.1 KiB
Vue

<script setup lang="ts">
import ahTable from "@/components/hTable/index.vue";
import { ConditionalType, TableConfig } from "@/components/hTable/hTable";
import { onMounted, ref, defineOptions } from "vue";
import { fa } from "element-plus/es/locales.mjs";
import { hTableAPI } from "@/api/hTable";
import { getenum } from "@/api/enum";
import { ruleRequired, ruleRequiredNumber } from "@/utils/rules";
import { DeleteExamInfo, ImportExamInfo } from "@/api/exam";
import { entryExamInfo } from "./examFun";
import { ElMessage, ElMessageBox } from "element-plus";
import { average } from "@pureadmin/utils";
const ControllerName = "ClassExamRecord";
defineOptions({
name: ControllerName,
});
const props = defineProps<{
data: any;
}>();
function searchCallback(data) {}
const table = ref<{ initTable: (config: TableConfig) => void }>();
const tableData: TableConfig = {
apiUrl: `ExamClassInfo`,
selectColumn: false, // 列表选择
border: false, // 是否显示表格边框
searchCallback: searchCallback,
search: {
// 查询条件
show: true,
PageIndex: 0,
PageSize: 20,
OrderByType: 1, // 排序方式
OrderBy: "Id", // 排序
defaultConditions: [
{
FieldName: "ClassId",
FieldValue: props.data[0].classId + "",
ConditionalType: ConditionalType.Equal,
},
], // 默认查询条件
Conditions: [],
},
operationColumn: true, // 显示操作按钮
operationColumnData: [
{
topBtn: false, // 头部按钮
show: true,
label: "学生成绩详情",
btnType: "custom",
btnStyle: "primary",
custom: {
title: "考试学生班级详情", // 弹出框title
src: "exam/userDetails", // 组件路径
width: "1600px", // 弹框宽度
height: "880px", // 弹框高度
},
},
],
column: {
// 行数据
examName: {
label: "考试名称",
search: true,
width: "150px",
},
type: {
label: "考试类型",
search: true,
type: "dropdown",
setting: {},
width: "80px",
},
testPaperType: {
label: "试卷类型",
search: true,
type: "dropdown",
setting: {},
width: "80px",
},
grade: {
label: "年级",
search: true,
// type: "dropdown",
// setting: {},
width: "60px",
},
onLineCount: {
label: "重本人数",
search: false,
width: "80px",
},
onLineRate: {
label: "重本率",
search: false,
custom: (row) => `${Math.round(row.onLineRate * 100)}%`,
width: "80px",
},
onLineRanking: {
label: "重本率排名",
search: false,
width: "100px",
},
maxScore: {
label: "最高分[赋分]",
search: false,
width: "140px",
},
minScore: {
label: "最低分[赋分]",
search: false,
width: "140px",
},
average: {
label: "总平均分[赋分]",
search: false,
custom: (row) => `${Math.round(row.average)}`,
width: "140px",
},
average1: {
label: "资源校平均分[赋分]",
search: false,
width: "160px",
},
averageRank: {
label: "总平均分排名",
search: false,
width: "110px",
},
rank: {
label: "远端平均/资源校平均",
search: false,
width: "95px",
custom: (row) =>
`${
row.baseSchoolScore == 0
? "--"
: Math.round((row.average / row.baseSchoolScore) * 100)
}%`,
},
},
data: [],
pageData: {
total: 0,
},
selectRows: [],
};
const showTable = ref(false);
onMounted(async () => {
//初始化数据原
// tableData.column.grade.setting.datasource = (await getenum("GradeEnum")).data.map(
// (x) => {
// return { text: x.text, value: x.text };
// }
// );
tableData.column.testPaperType.setting.datasource = (
await getenum("TestPaperTypeEnum")
).data;
tableData.column.type.setting.datasource = (await getenum("ExamTypeEnum")).data;
showTable.value = true;
});
</script>
<template>
<div><ahTable v-if="showTable" ref="table" :tableConfig="tableData" /></div>
</template>