diff --git a/src/api/userCenter.ts b/src/api/userCenter.ts index bfc6b15..51772a6 100644 --- a/src/api/userCenter.ts +++ b/src/api/userCenter.ts @@ -1,6 +1,7 @@ import { ComboModel } from "@/components/hTable/hTable"; import { http } from "@/utils/http"; import type { Res, ResPage } from "@/utils/http/types"; +import { Ref } from "vue"; /** * @description 获取枚举下拉 * @param {string} type 枚举类型 type=StatusEnum @@ -151,12 +152,14 @@ export interface Position { graduationYear: number; grade: string; classId: number; + gradeLevel: string; className: string; subjectId: number; subjectName: string; positionType: number; positionLevel: number; status: boolean; + classList?: ComboModel[]; } /** diff --git a/src/components/hTable/hTable.ts b/src/components/hTable/hTable.ts index 8902d36..6f0adea 100644 --- a/src/components/hTable/hTable.ts +++ b/src/components/hTable/hTable.ts @@ -400,4 +400,34 @@ export function intTableData(tValue: TableConfig): TableConfig { if (element.show === undefined) element.show = true; } return tValue; +} + +/** + * 生成 毕业届下拉 + */ +export function gradeComboModel(): ComboModel[] { + const now = new Date(); + const currentYear = now.getFullYear(); + const currentMonth = now.getMonth() + 1; + + const isAfterAugust = currentMonth >= 9; + const baseYear = isAfterAugust ? currentYear : currentYear - 1; + + const gradeOffsets = [ + { baseGradeName: "初", yearOffset: 0, grade: "初一" }, // 初一 + { baseGradeName: "初", yearOffset: 1, grade: "初二" }, // 初二 + { baseGradeName: "初", yearOffset: 2, grade: "初三" }, // 初三 + { baseGradeName: "高", yearOffset: 0, grade: "高一" }, // 高一 + { baseGradeName: "高", yearOffset: 1, grade: "高二" }, // 高二 + { baseGradeName: "高", yearOffset: 2, grade: "高三" }, // 高三 + ]; + + return gradeOffsets.map( + (item): ComboModel => { + const entranceYear = baseYear - item.yearOffset; + const graduationYear = entranceYear + 3; + let v = `${item.baseGradeName}${graduationYear}届`; + return { text: v + ` [${item.grade}]`, value: v }; + } + ); } \ No newline at end of file diff --git a/src/views/class/index.vue b/src/views/class/index.vue index 5099f9b..67b1fef 100644 --- a/src/views/class/index.vue +++ b/src/views/class/index.vue @@ -1,7 +1,9 @@