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

175 lines
4.3 KiB
Vue

<script setup lang="ts">
import ahTable from "@/components/hTable/index.vue";
import {
ConditionalType,
intTableData,
TableColumnSearch,
TableConfig,
} from "@/components/hTable/hTable";
import { onMounted, ref } 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 { getClassInfo, getSchoolInfo } from "@/api/userCenter";
const ControllerName = "ExamUserInfo";
defineOptions({
name: ControllerName,
});
const props = defineProps<{
data: any;
}>();
function searchCallback(data) {}
const table = ref<{ initTable: (config: TableConfig) => void }>();
const tableData: TableConfig = intTableData({
apiUrl: ControllerName,
selectColumn: false, // 列表选择
border: false, // 是否显示表格边框
searchCallback: searchCallback,
search: {
// 查询条件
show: true,
PageIndex: 0,
PageSize: 999,
OrderBy: "Id", // 排序
OrderByType: 1,
defaultConditions: [
{
FieldName: "UserId",
FieldValue: props.data[0].userId + "",
},
], // 默认查询条件
Conditions: [],
},
operationColumn: true, // 显示操作按钮
operationColumnData: [],
column: {
// 行数据
examName: {
label: "考试名称",
search: new TableColumnSearch(true, ConditionalType.Like),
width: "180px",
},
// 行数据
type: {
label: "考试类型",
width: "150px",
type: "dropdown",
search: new TableColumnSearch(true),
},
// 行数据
grade: {
label: "考试阶段",
width: "120px",
search: new TableColumnSearch(true, ConditionalType.Like),
}, // 行数据
testPaperType: {
label: "试卷类型",
width: "150px",
type: "dropdown",
search: new TableColumnSearch(true),
},
语文: {
label: "语文",
width: "80px",
custom: (row) => row.subjectDic.语文 ?? "--",
search: { sort: true },
},
数学: {
label: "数学",
width: "80px",
custom: (row) => row.subjectDic.数学 ?? "--",
search: { sort: true },
},
英语: {
label: "英语",
width: "80px",
custom: (row) => row.subjectDic.英语 ?? "--",
search: { sort: true },
},
物理: {
label: "物理",
width: "80px",
custom: (row) => row.subjectDic.物理 ?? "--",
search: { sort: true },
},
化学: {
label: "化学",
width: "80px",
custom: (row) => row.subjectDic.化学 ?? "--",
search: { sort: true },
},
生物: {
label: "生物",
width: "80px",
custom: (row) => row.subjectDic.生物 ?? "--",
search: { sort: true },
},
政治: {
label: "政治",
width: "80px",
custom: (row) => row.subjectDic.政治 ?? "--",
search: { sort: true },
},
历史: {
label: "历史",
width: "80px",
custom: (row) => row.subjectDic.历史 ?? "--",
search: { sort: true },
},
地理: {
label: "地理",
width: "80px",
custom: (row) => row.subjectDic.地理 ?? "--",
search: { sort: true },
},
assignScore: {
label: "赋分总分",
width: "80px",
search: { sort: true },
},
assignRanking: {
label: "赋分后的排名",
width: "120px",
search: { sort: true },
},
},
data: [],
pageData: {
total: 0,
},
selectRows: [],
});
const showTable = ref(false);
const exam = props.data[0];
onMounted(async () => {
//初始化数据原
getClassInfo(exam.classId).then((res) => {
exam.className = res.data.name;
});
getSchoolInfo(exam.schoolId).then((res) => {
exam.schoolName = res.data.name;
});
tableData.column.testPaperType.setting.datasource = (
await getenum("TestPaperTypeEnum")
).data;
tableData.column.type.setting.datasource = (await getenum("ExamTypeEnum")).data;
showTable.value = true;
});
</script>
<template>
<div>
<div class="p-[10px] text-[1.3rem]">
<strong>学生{{ exam.userName }}</strong
>&nbsp; &nbsp; {{ exam.schoolName }} {{ exam.grade }}
{{ exam.className }}
</div>
<ahTable v-if="showTable" ref="table" :tableConfig="tableData" />
</div>
</template>