课表调整申请

This commit is contained in:
2026-08-23 20:24:04 +08:00
parent 26fe8ea334
commit 8bf726a745
3 changed files with 67 additions and 11 deletions
@@ -244,6 +244,7 @@ import { listStudentTeamTask } from '@/api/teachBusiness/studentTeamTask'
import { listTeam } from '@/api/studentRecords/team'
import { listKb } from '@/api/teachOffice/kb'
import { listTeacher } from '@/api/teachOffice/teacher'
import { listAllSemester } from '@/api/teachBusiness/semester'
// 节次 -> 节次区间映射
const JC_SECTION = {
@@ -270,7 +271,6 @@ function getMonday(d) {
export default {
name: 'Timetable',
data() {
const currentYear = new Date().getFullYear()
return {
activeTab: 'today',
// 今日
@@ -292,12 +292,14 @@ export default {
// 班次
teamOptions: [],
shiftXydbh: '',
shiftNd: currentYear,
shiftNd: undefined,
shiftList: [],
shiftLoading: false,
shiftTotal: 0,
shiftQuery: { pageNum: 1, pageSize: 20 },
yearOptions: [currentYear - 1, currentYear, currentYear + 1],
// 年度下拉数据来自 /semester/all(真实后端数据)
yearOptions: [],
defaultNd: undefined,
// 名称映射(真实接口数据,用于班次 tab 课程/教员编号转名称)
kbMap: {},
teacherMap: {}
@@ -322,10 +324,11 @@ export default {
shiftTitle() {
const team = this.teamOptions.find(t => t.xydbh === this.shiftXydbh)
const name = (team && team.xydmc) || ''
return this.shiftNd + '年' + name + '课程表'
return (this.shiftNd ? this.shiftNd + '年' : '') + name + '课程表'
}
},
created() {
this.loadYearOptions()
this.getTodayList()
this.getWeekList()
this.getPracticeList()
@@ -334,6 +337,28 @@ export default {
this.loadTeacherMap()
},
methods: {
/* ---------- 年度下拉(数据来自 /semester/all) ---------- */
loadYearOptions() {
return listAllSemester().then(response => {
const list = response.data || []
// 去重并按年度倒序
const map = {}
list.forEach(item => {
if (item.nd !== null && item.nd !== undefined && item.nd !== '') map[item.nd] = item
})
const arr = Object.keys(map).sort((a, b) => String(b).localeCompare(String(a)))
this.yearOptions = arr
// 默认年度:优先当前学期(dqxq=true),否则取最新年度
const current = list.find(item => item.dqxq === true)
this.defaultNd = (current && current.nd) || arr[0]
if (!this.shiftNd) this.shiftNd = this.defaultNd
return arr
}).catch(() => {
this.yearOptions = []
this.defaultNd = undefined
return []
})
},
weekDayName(d) {
return WEEK_DAY_NAMES[d.getDay()]
},