From 14b6a200af1d09f9ed4f2a3d9b3ebc2e4f75692f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E8=82=A5=E7=BE=8A?= <1048382248@qq.com> Date: Wed, 24 Sep 2025 19:17:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E6=88=90=E7=BB=A9=E5=88=86=E6=9E=90=E7=9A=84=20=E5=88=86?= =?UTF-8?q?=E6=AE=B5=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/exam.ts | 27 ++- src/api/hTable.ts | 2 +- src/components/hTable/hTable.ts | 14 +- src/components/hTable/hTableEdit.vue | 2 +- src/components/hTable/index.vue | 33 +++- src/utils/http/index.ts | 2 +- src/views/exam/classExam.vue | 286 +++++++++++++++++++++++++-- src/views/exam/classExamRecord.vue | 28 +-- src/views/exam/examTags.vue | 188 ++++++++++++++++++ src/views/exam/index.vue | 22 ++- 10 files changed, 557 insertions(+), 47 deletions(-) create mode 100644 src/views/exam/examTags.vue diff --git a/src/api/exam.ts b/src/api/exam.ts index 0cbf281..9b8f0ec 100644 --- a/src/api/exam.ts +++ b/src/api/exam.ts @@ -1,4 +1,5 @@ import { http } from "@/utils/http"; +import { Res } from "@/utils/http/types"; // import type { Res } from "@/utils/http/types"; /** @@ -29,7 +30,31 @@ export function ImportExamInfo(id: number, file: File) { * @return {object} */ export function DeleteExamInfo(data: { classId: number; examId: number }) { - return http.request("post", `ExamClassInfo/DeleteExamInfo`, { + return http.request>("post", `ExamClassInfo/DeleteExamInfo`, { data }); } + +/** + * @description 重算考试排名 + * @return {object} + */ +export function RecalculateExamRankings(examId: Number) { + return http.request>( + "get", + `ExamClassInfo/RecalculateExamRankings`, + { + params: { examId } + } + ); +} + +/** + * @description 获取班级考试分段排名 + * @return {object} + */ +export function ClassRanking(examId: Number,classId: Number) { + return http.request>("get", `ExamClassInfo/ClassRanking`, { + params: { examId, classId } + }); +} \ No newline at end of file diff --git a/src/api/hTable.ts b/src/api/hTable.ts index e29d581..1ea2b59 100644 --- a/src/api/hTable.ts +++ b/src/api/hTable.ts @@ -22,7 +22,7 @@ export class hTableAPI { delete(data) { return http.request>("post", `${this.url}/Del`, { data }); } - querycombo(data) { + querycombo(data = {}) { return http.request>("post", `${this.url}/QueryCombo`, { data }); diff --git a/src/components/hTable/hTable.ts b/src/components/hTable/hTable.ts index 6f0adea..b7598f6 100644 --- a/src/components/hTable/hTable.ts +++ b/src/components/hTable/hTable.ts @@ -198,18 +198,18 @@ export class TableColumnSearch { /** 表格列配置 */ export class TableColumn { - constructor( - ) { - + constructor() { this.type = "string"; this.show = true; this.search = new TableColumnSearch(); this.edit = new TableColumnEdit(); + this.fixed = false; this.setting = {}; } /** 显示标签 */ label: string; + fixed?: 'left' | 'right'| boolean; /** 查询配置 */ search?: TableColumnSearch; /** 编辑配置 */ @@ -327,6 +327,8 @@ export interface TableConfig { searchCallback?: (s: SearchConditions) => void; /** 新增/修改回调函数 */ editCallback?: (from: any) => void; + /** 展开行的回调 */ + expandChange?: (row: any, expandedRows: any[]) => void; /** API地址 */ apiUrl: string; /** 是否显示选择列 */ @@ -335,6 +337,10 @@ export interface TableConfig { search: SearchConditions; /** 是否显示操作列 */ operationColumn: boolean; + /** 操作列是否固定列 */ + operationColumnFixed?: "left" | "right" | boolean; + /** 是否允许展开列 */ + expandColumn?: boolean; /** 操作按钮配置 */ operationColumnData: OperationButton[]; /** 列配置 */ @@ -357,6 +363,8 @@ export function intTableData(tValue: TableConfig): TableConfig { if (!tValue.data) tValue.data = []; if (!tValue.selectRows) tValue.selectRows = []; if (tValue.border == null) tValue.border = true; + if (tValue.operationColumnFixed == null) tValue.operationColumnFixed = false; + if (tValue.expandColumn == null) tValue.expandColumn = false; if (!tValue.pageData) tValue.pageData = { total: 0 }; if (tValue.operationTop === undefined) tValue.operationTop = true; diff --git a/src/components/hTable/hTableEdit.vue b/src/components/hTable/hTableEdit.vue index 4131bb6..0eeaf0a 100644 --- a/src/components/hTable/hTableEdit.vue +++ b/src/components/hTable/hTableEdit.vue @@ -117,8 +117,8 @@ function handleResetForm() { function fetchInitData() {} function fetchFormData() { editData.value.loading = false; + handleResetForm(); if (editData.value.isedit) { - handleResetForm(); Api.Info(props.id).then((res) => { if (res.code === 200) { editData.value.frorm = res.data; diff --git a/src/components/hTable/index.vue b/src/components/hTable/index.vue index 2cde35e..6844f92 100644 --- a/src/components/hTable/index.vue +++ b/src/components/hTable/index.vue @@ -207,16 +207,20 @@ function handleDelete(obj, row) { row.forEach((it) => { ids.push(it.id); }); - ElMessageBox.confirm("此操作将永久删除勾选记录, 是否继续?").then(() => { - Api.delete(ids).then((res) => { - if (res.code === 200) { - handleReloadPaged(); - ElMessage.success("删除成功"); - } else { - ElMessage.error(res.message); - } + ElMessageBox.confirm("此操作将永久删除勾选记录, 是否继续?") + .then(() => { + Api.delete(ids).then((res) => { + if (res.code === 200) { + handleReloadPaged(); + ElMessage.success("删除成功"); + } else { + ElMessage.error(res.message); + } + }); + }) + .catch(() => { + ElMessage.info("取消删除"); }); - }); } // 页面完成回调 function handleAddCallback() { @@ -454,6 +458,7 @@ function fetchPagedData() { :row-key="rowKeyFun" @selection-change="handleSelectionChange" @sort-change="sortChange" + @expand-change="table.expandChange" > !s.topBtn).length > 0 " + :fixed="table.operationColumnFixed" label="操作" :width="getOperationColumnWidth()" > @@ -483,12 +489,21 @@ function fetchPagedData() { + + + + + +