完善 考试信息流程

This commit is contained in:
小肥羊 2025-08-18 18:00:45 +08:00
parent e05671447d
commit 44e387310f
9 changed files with 223 additions and 132 deletions

View File

@ -9,4 +9,4 @@ VITE_ROUTER_HISTORY = "hash"
# 接口地址 # 接口地址
VITE_API_BASEURL = "http://localhost:5199/api" VITE_API_BASEURL = "http://localhost:5199/api"
#数据中心后台地址 #数据中心后台地址
VITE_API_USERCENTER_URL = "https://dca.w.23544.com:8843/api/" VITE_API_USERCENTER_URL = "https://dca.w.23544.com:8843/api"

24
src/api/exam.ts Normal file
View File

@ -0,0 +1,24 @@
import { http } from "@/utils/http";
import type { Res } from "@/utils/http/types";
/**
* @description
* @return {object}
*/
export function ImportExamInfo(id: number, file: File) {
let formData = new FormData();
formData.append("eId", id.toString());
formData.append("file", file);
return http.request<any>(
"post",
`ExamClassInfo/Import`,
{
data: formData
},
{
headers: {
"Content-Type": "application/x-www-form-urlencoded"
}
}
);
}

View File

@ -1,3 +1,4 @@
import { ComboModel } from "@/components/hTable/hTable";
import { http } from "@/utils/http"; import { http } from "@/utils/http";
import type { Res, ResPage } from "@/utils/http/types"; import type { Res, ResPage } from "@/utils/http/types";
/** /**
@ -28,7 +29,10 @@ export function EditSchool(data: any) {
* @return {void} * @return {void}
*/ */
export function getSchoolData() { export function getSchoolData() {
return http.request<Res<any>>("get", `userCenter/public/getschooldata`); return http.request<Res<ComboModel>>(
"get",
`userCenter/public/getschooldata`
);
} }
/** /**
* @description * @description

View File

@ -1,66 +1,73 @@
export interface Dialog { export interface Dialog {
/* 对话框是否可见 */ /** 对话框是否可见 */
visible: boolean; visible: boolean;
/* 是否显示关闭按钮 */ /** 是否显示关闭按钮 */
close: boolean; close: boolean;
/* 对话框标题 */ /** 对话框标题 */
title: string; title: string;
/* 对话框宽度 */ /** 对话框宽度 */
width: string; width: string;
/**自定义弹窗数据 */ /**自定义弹窗数据 */
custom: { custom: {
/* 自定义对话框高度 */ /** 自定义对话框高度 */
height: string; height: string;
/* 自定义对话框数据 */ /** 自定义对话框数据 */
data: any[]; data: any[];
/* 自定义组件路径 */ /** 自定义组件路径 */
src?: string; src?: string;
/* 自定义配置项 */ /** 自定义配置项 */
custom: Record<string, any>; custom: Record<string, any>;
/* 自定义对话框是否可见 */ /** 自定义对话框是否可见 */
visible: boolean; visible: boolean;
/* 异步加载组件 */ /** 异步加载组件 */
component: any; component: any;
}; };
edit: { edit: {
/* 编辑项ID */ /** 编辑项ID */
id: number; id: number;
/* 编辑对话框标题 */ /** 编辑对话框标题 */
title: string; title: string;
/* 编辑对话框是否可见 */ /** 编辑对话框是否可见 */
visible: boolean; visible: boolean;
row?: any; row?: any;
tagData?: any; tagData?: any;
}; };
} }
/* 按钮自定义配置 */ /** 按钮自定义配置 */
export interface ButtonCustomConfig { export interface ButtonCustomConfig {
/* 弹出框标题 */ /** 弹出框标题 */
title: string; title: string;
/* 组件路径 */ /** 组件路径 */
src: string; src: string;
/* 弹框宽度 */ /** 弹框宽度 */
width: string; width: string;
/* 弹框高度 */ /** 弹框高度 */
height: string; height: string;
} }
/* 操作按钮配置 */ /** 操作按钮配置 */
export interface OperationButton { export interface OperationButton {
/* 是否为头部按钮 */ /** 是否为头部按钮 */
topBtn: boolean; topBtn: boolean;
/** 按钮权限码 */ /** 按钮权限码 */
perms?: string; perms?: string;
/* 是否显示 */ /** 是否显示 */
show?: boolean; show?: boolean;
/* 按钮文本 */ /** 按钮文本 */
label: string; label: string;
/* 按钮类型 */ /**
btnType: "add" | "edit" | "del" | "custom"; * @tips btnType
/* 按钮样式 */ * @param obj
* @param row
* @param handleReloadPaged
*/
click?: (obj, row, handleReloadPaged: (reload: boolean) => void) => void;
/** 按钮类型 */
btnType?: "add" | "edit" | "del" | "custom";
/** 按钮样式 */
btnStyle?: "success" | "info" | "primary" | "danger" | "warning"; btnStyle?: "success" | "info" | "primary" | "danger" | "warning";
/* 自定义按钮配置 */ /** 自定义按钮配置 */
custom?: ButtonCustomConfig; custom?: ButtonCustomConfig;
} }
@ -85,7 +92,7 @@ export enum ConditionalType {
Range Range
} }
/* 字段设置项 */ /** 字段设置项 */
export interface FieldSetting { export interface FieldSetting {
/**map 时Value的取值的属性 */ /**map 时Value的取值的属性 */
mapValue?: string; mapValue?: string;
@ -100,30 +107,30 @@ export interface FieldSetting {
* @returns url * @returns url
*/ */
imgUrl?: (value: any, row: any) => string; imgUrl?: (value: any, row: any) => string;
/* 数据源 */ /** 数据源 */
datasource?: ComboModel[]; datasource?: ComboModel[];
} }
///* 表格列配置 */ ///** 表格列配置 */
//export interface TableEditColumn {} //export interface TableEditColumn {}
export interface ComboModel { export interface ComboModel {
value: any; value: any;
text: string; text: string;
} }
/* 表格列配置 */ /** 表格列配置 */
export interface TableColumn { export interface TableColumn {
/* 显示标签 */ /** 显示标签 */
label: string; label: string;
/* 是否可搜索 */ /** 是否可搜索 */
search: boolean; search: boolean;
/* 搜索类型 */ /** 搜索类型 */
searchType?: ConditionalType; searchType?: ConditionalType;
/* 是否允许添加 */ /** 是否允许添加 [false]*/
add: boolean; add?: boolean;
/* 是否允许修改 */ /** 是否允许修改 [false]*/
edit?: boolean; edit?: boolean;
/* 列宽度 */ /** 列宽度 [auto]*/
width?: string; width?: string;
/* 字段类型 */ /** 字段类型 */
type?: "string" | "dropdown" | "switch" | "img" | "datetime" | "textarea"; type?: "string" | "dropdown" | "switch" | "img" | "datetime" | "textarea";
/** 是否多选 */ /** 是否多选 */
multiple?: boolean; multiple?: boolean;
@ -133,11 +140,11 @@ export interface TableColumn {
rules?: any | Array<any>; rules?: any | Array<any>;
/** 显示列 */ /** 显示列 */
show?: boolean; show?: boolean;
/* 字段设置 */ /** 字段设置 */
setting?: FieldSetting; setting?: FieldSetting;
/* 修改时的编辑值 */ /** 修改时的编辑值 */
valueE?: Array<string> | string | number | boolean | Date; valueE?: Array<string> | string | number | boolean | Date;
/* 查询值 */ /** 查询值 */
value?: Array<string> | string | number | boolean | Date; value?: Array<string> | string | number | boolean | Date;
/** textarea编辑时的行数 */ /** textarea编辑时的行数 */
editRows?: number; editRows?: number;
@ -147,13 +154,13 @@ export interface TableColumn {
custom?: (row: any) => string; custom?: (row: any) => string;
} }
/* 分页数据 */ /** 分页数据 */
export interface PageData { export interface PageData {
/* 总条数 */ /** 总条数 */
total: number; total: number;
} }
/* 分页数据 */ /** 分页数据 */
export interface ConditionalModel { export interface ConditionalModel {
/** 字段名称 */ /** 字段名称 */
FieldName: string; FieldName: string;
@ -165,49 +172,49 @@ export interface ConditionalModel {
CSharpTypeName?: string; CSharpTypeName?: string;
} }
/* 搜索条件 */ /** 搜索条件 */
export interface SearchConditions { export interface SearchConditions {
/* 是否显示搜索 */ /** 是否显示搜索 */
show: boolean; show: boolean;
/* 当前页码 */ /** 当前页码 */
PageIndex: number; PageIndex: number;
/* 每页大小 */ /** 每页大小 */
PageSize: number; PageSize: number;
/* 排序字段 */ /** 排序字段 */
OrderBy: string; OrderBy: string;
/* 默认查询条件 */ /** 默认查询条件 */
defaultConditions: ConditionalModel[]; defaultConditions: ConditionalModel[];
/* 查询条件 */ /** 查询条件 */
Conditions: any[]; Conditions: any[];
} }
/* 表格配置 */ /** 表格配置 */
export interface TableConfig { export interface TableConfig {
/* 搜索回调函数 */ /** 搜索回调函数 */
searchCallback?: (s: SearchConditions) => void; searchCallback?: (s: SearchConditions) => void;
/* 新增/修改回调函数 */ /** 新增/修改回调函数 */
editCallback?: (from: any) => void; editCallback?: (from: any) => void;
/* API地址 */ /** API地址 */
apiUrl: string; apiUrl: string;
/* 是否显示选择列 */ /** 是否显示选择列 */
selectColumn: boolean; selectColumn: boolean;
/* 搜索配置 */ /** 搜索配置 */
search: SearchConditions; search: SearchConditions;
/* 是否显示操作列 */ /** 是否显示操作列 */
operationColumn: boolean; operationColumn: boolean;
/* 操作按钮配置 */ /** 操作按钮配置 */
operationColumnData: OperationButton[]; operationColumnData: OperationButton[];
/* 列配置 */ /** 列配置 */
column: Record<string, TableColumn>; column: Record<string, TableColumn>;
/* 表格数据 */ /** 表格数据 */
data: any[]; data: any[];
/**显示头部操作按钮 */ /**显示头部操作按钮 */
operationTop?: boolean; operationTop?: boolean;
/* 分页数据 */ /** 分页数据 */
pageData: PageData; pageData: PageData;
/* 选中行 */ /** 选中行 */
selectRows: any[]; selectRows: any[];
/* 是否显示边框 */ /** 是否显示边框 */
border: boolean; border: boolean;
/**是否显示 */ /**是否显示 */
show?: boolean; show?: boolean;

View File

@ -108,7 +108,8 @@ function intdata() {
// column // column
for (const key in table.value.column) { for (const key in table.value.column) {
const element = table.value.column[key]; const element = table.value.column[key];
if (element.add === undefined) element.add = false;
if (element.edit === undefined) element.edit = false;
// Vue 3 $set // Vue 3 $set
if (element.valueE === undefined) if (element.valueE === undefined)
element.valueE = element.multiple ? [] : ""; element.valueE = element.multiple ? [] : "";

View File

@ -66,7 +66,13 @@ const tableData: TableConfig = {
show: true, show: true,
label: "学生成绩详情", label: "学生成绩详情",
btnType: "custom", btnType: "custom",
btnStyle: "primary" // topBtn: true success danger btnStyle: "primary",
custom: {
title: "考试班级详情", // title
src: "exam/userDetails", //
width: "1600px", //
height: "800px" //
}
} }
], ],
column: { column: {
@ -102,7 +108,7 @@ const tableData: TableConfig = {
add: false, // add: false, //
edit: false // edit: false //
}, },
etryPerson: { entryPerson: {
label: "录入人", label: "录入人",
width: "200px", width: "200px",
search: true, search: true,

View File

@ -6,6 +6,8 @@ import { fa } from "element-plus/es/locales.mjs";
import { hTableAPI } from "@/api/hTable"; import { hTableAPI } from "@/api/hTable";
import { getenum } from "@/api/enum"; import { getenum } from "@/api/enum";
import { ruleRequired, ruleRequiredNumber } from "@/utils/rules"; import { ruleRequired, ruleRequiredNumber } from "@/utils/rules";
import { ImportExamInfo } from "@/api/exam";
import { ElMessage } from "element-plus";
const ControllerName = "Exam"; const ControllerName = "Exam";
defineOptions({ defineOptions({
@ -60,15 +62,15 @@ const tableData: TableConfig = {
custom: { custom: {
title: "考试班级详情", // title title: "考试班级详情", // title
src: "exam/classDetails", // src: "exam/classDetails", //
width: "1600px", // width: "1300px", //
height: "520px" // height: "800px" //
} }
}, },
{ {
topBtn: false, // topBtn: false, //
show: true, show: true,
label: "录入成绩", label: "录入成绩",
btnType: "custom", // add edit del click: entryExam,
btnStyle: "primary" // topBtn: true success danger btnStyle: "primary" // topBtn: true success danger
} }
], ],
@ -154,7 +156,39 @@ const tableData: TableConfig = {
}, },
selectRows: [] selectRows: []
}; };
function entryExam(obj, row, callBack) {
let fileE = document.createElement("input");
fileE.type = "file";
var formData = new window.FormData();
fileE.onchange = async function () {
formData.append("File", fileE.files[0]);
let res = await ImportExamInfo(row[0].id, fileE.files[0]);
if (res.code != undefined) {
if (res.code !== 200) return ElMessage.error(res.message);
else return ElMessage.success("所有数据录入成功");
} else if (res.type === "application/json") {
let json = await res.text();
if (json !== undefined && json.Code !== 200) {
return ElMessage.error(json.Message);
} else {
return ElMessage.success("操所有数据录入成功作成功");
}
} else if (res === undefined || res.size === 0)
return ElMessage.success("所有数据录入成功");
const url = res && window.URL.createObjectURL(res);
const link = document.createElement("a");
link.href = url;
link.setAttribute("download", "未成功导入的考试信息数据" + ".xlsx");
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
ElMessage.success("操作成功,已导出重复数据");
};
try {
fileE.click();
} catch (error) {}
}
const showTable = ref(false); const showTable = ref(false);
onMounted(async () => { onMounted(async () => {
// //

View File

@ -38,78 +38,93 @@ const tableData: TableConfig = {
{ {
// //
topBtn: true, // topBtn: true, //
label: "添加", label: "成绩升序",
btnStyle: "success", btnStyle: "primary"
btnType: "custom" },
{
//
topBtn: true, //
label: "成绩降序",
btnStyle: "primary"
}, },
{ {
topBtn: false, // topBtn: false, //
show: true, label: "个人详情",
label: "删除",
btnType: "del", // add edit del
btnStyle: "danger" // topBtn: true success danger
},
{
topBtn: false, //
show: true,
label: "重新录入",
btnType: "custom", // add edit del
btnStyle: "primary" // topBtn: true success danger
},
{
topBtn: false, //
show: true,
label: "学生成绩详情",
btnType: "custom", btnType: "custom",
btnStyle: "primary" // topBtn: true success danger btnStyle: "primary" // topBtn: true success danger
} }
], ],
column: { column: {
// //
schoolName: { userName: {
label: "学校", label: "姓名",
search: true, search: true,
searchType: ConditionalType.Like, // searchType: ConditionalType.Like, //
add: false, //
edit: false, //
width: "180px" width: "180px"
}, },
grade: { 语文: {
label: "年级", label: "语文",
width: "100px",
custom: s => `${s.gradeYear}${s.gradeLevel}`,
search: true,
add: false, //
edit: false //
},
className: {
label: "班级",
width: "150px",
search: true,
searchType: ConditionalType.Like, //
add: false, //
edit: false //
},
peopleCount: {
label: "参考人数",
width: "100px",
search: false, search: false,
add: false, // width: "100px",
edit: false // custom: row => row.subjectDic.语文
}, },
etryPerson: { 数学: {
label: "录入人", label: "数学",
width: "200px", search: false,
search: true, width: "100px",
add: false, // custom: row => row.subjectDic.数学
edit: false //
}, },
createTime: { 英语: {
label: "录入时间", label: "英语",
width: "200px", search: false,
search: true, width: "100px",
add: false, // custom: row => row.subjectDic.英语
edit: false // },
物理: {
label: "物理",
search: false,
width: "100px",
custom: row => row.subjectDic.物理
},
化学: {
label: "化学",
search: false,
width: "100px",
custom: row => row.subjectDic.化学
},
生物: {
label: "生物",
search: false,
width: "100px",
custom: row => row.subjectDic.生物
},
政治: {
label: "政治",
search: false,
width: "100px",
custom: row => row.subjectDic.政治
},
历史: {
label: "历史",
search: false,
width: "100px",
custom: row => row.subjectDic.历史
},
地理: {
label: "地理",
search: false,
width: "100px",
custom: row => row.subjectDic.地理 ?? "--"
},
assignScore: {
label: "赋分总分",
search: false,
width: "180px"
},
assignRanking: {
label: "赋分后的排名",
search: false,
width: "200px"
} }
}, },
data: [], data: [],

View File

@ -364,10 +364,10 @@ const props = defineProps({
} }
}); });
const baseUrl = import.meta.env.VITE_APP_BASE_API; const baseUrl = import.meta.env.VITE_API_USERCENTER_URL;
const excelImportUsersUrl = `${baseUrl}api/back/users/downloadimportusersexceltemplate`; const excelImportUsersUrl = `${baseUrl}/back/users/downloadimportusersexceltemplate`;
const excelImportMeetingUrl = `${baseUrl}api/back/users/downloadimportmeetingexceltemplate`; const excelImportMeetingUrl = `${baseUrl}/back/users/downloadimportmeetingexceltemplate`;
const excelImportOrdersUrl = `${baseUrl}api/back/users/downloadimportordersexceltemplate`; const excelImportOrdersUrl = `${baseUrl}/back/users/downloadimportordersexceltemplate`;
const editId = ref(0); const editId = ref(0);
const showAllPosition = ref<UserDetail[]>([]); const showAllPosition = ref<UserDetail[]>([]);