158 lines
4.0 KiB
Vue
158 lines
4.0 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, 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";
|
|
const ControllerName = "ExamClassInfo";
|
|
|
|
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: 20,
|
|
OrderBy: "Id", // 排序
|
|
defaultConditions: [
|
|
{
|
|
FieldName: "ExamId",
|
|
FieldValue: props.data[0].id + "",
|
|
ConditionalType: ConditionalType.Equal,
|
|
},
|
|
], // 默认查询条件
|
|
Conditions: [],
|
|
},
|
|
operationColumn: true, // 显示操作按钮
|
|
operationColumnData: [
|
|
{
|
|
topBtn: false, // 头部按钮
|
|
show: true,
|
|
label: "删除",
|
|
click: deleteInfo,
|
|
btnStyle: "warning", // topBtn: true才生效 success danger
|
|
},
|
|
{
|
|
topBtn: false, // 头部按钮
|
|
show: true,
|
|
label: "重新录入",
|
|
click: reloadImportInfo,
|
|
btnStyle: "primary", // topBtn: true才生效 success danger
|
|
},
|
|
{
|
|
topBtn: false, // 头部按钮
|
|
show: true,
|
|
label: "学生成绩详情",
|
|
btnType: "custom",
|
|
btnStyle: "primary",
|
|
custom: {
|
|
title: "考试学生班级详情", // 弹出框title
|
|
src: "exam/userDetails", // 组件路径
|
|
width: "1600px", // 弹框宽度
|
|
height: "880px", // 弹框高度
|
|
},
|
|
},
|
|
],
|
|
column: {
|
|
// 行数据
|
|
schoolName: {
|
|
label: "学校",
|
|
width: "180px",
|
|
search: new TableColumnSearch(true, ConditionalType.Like),
|
|
},
|
|
grade: {
|
|
label: "年级",
|
|
width: "100px",
|
|
custom: (row) => row.gradeLevel + row.gradeYear + "届",
|
|
search: new TableColumnSearch(true),
|
|
},
|
|
className: {
|
|
label: "班级",
|
|
width: "150px",
|
|
search: new TableColumnSearch(true, ConditionalType.Like),
|
|
},
|
|
peopleCount: {
|
|
label: "参考人数",
|
|
width: "100px",
|
|
},
|
|
// entryPerson: {
|
|
// label: "录入人",
|
|
// width: "200px",
|
|
// search: false,
|
|
// add: false, // 字段允许添加
|
|
// edit: false, // 字段允许修改
|
|
// },
|
|
createTime: {
|
|
label: "录入时间",
|
|
width: "200px",
|
|
},
|
|
},
|
|
data: [],
|
|
pageData: {
|
|
total: 0,
|
|
},
|
|
selectRows: [],
|
|
});
|
|
|
|
async function deleteInfo(o, row, baseRefresh) {
|
|
try {
|
|
await ElMessageBox.confirm("是否删除考试信息?", "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning",
|
|
});
|
|
await DeleteExamInfo({ examId: row[0].examId, classId: row[0].classId });
|
|
baseRefresh();
|
|
} catch (error) {
|
|
ElMessage.info("取消删除");
|
|
}
|
|
}
|
|
async function reloadImportInfo(o, row, baseRefresh) {
|
|
try {
|
|
await ElMessageBox.confirm("是否重新录入考试信息?", "提示", {
|
|
confirmButtonText: "确定",
|
|
cancelButtonText: "取消",
|
|
type: "warning",
|
|
});
|
|
await DeleteExamInfo({ examId: row[0].examId, classId: row[0].classId });
|
|
entryExamInfo(row[0].examId);
|
|
baseRefresh();
|
|
} catch (error) {
|
|
ElMessage.info("取消重新录入");
|
|
}
|
|
}
|
|
const showTable = ref(false);
|
|
onMounted(async () => {
|
|
//初始化数据原
|
|
|
|
showTable.value = true;
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<div><ahTable v-if="showTable" ref="table" :tableConfig="tableData" /></div>
|
|
</template>
|