Main #1

Merged
zhaichao merged 47 commits from zhaichao/education:main into main 2026-08-24 03:07:45 +00:00
3 changed files with 67 additions and 11 deletions
Showing only changes of commit 8bf726a745 - Show all commits
@@ -9,6 +9,14 @@ export function listSemester(query) {
})
}
// 查询所有学期列表(年度下拉数据源,返回全部学期含 nd/dqxq,按年度倒序)
export function listAllSemester() {
return request({
url: '/semester/all',
method: 'get'
})
}
// 根据主键查询学期
export function getSemester(nd) {
return request({
@@ -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()]
},
@@ -336,6 +336,7 @@ import {
receiveByAuthority,
cancelScheduleAdjust
} from '@/api/teachBusiness/courseRunning'
import { listAllSemester } from '@/api/teachBusiness/semester'
// 节次 -> 节次区间映射
const JC_SECTION = {
@@ -359,22 +360,22 @@ const RECEIVE_STATUS = {
export default {
name: 'TimetableAdjust',
data() {
const currentYear = new Date().getFullYear()
const curUserName = (this.$store.state.user && this.$store.state.user.name) || ''
return {
currentYear: currentYear,
curUserName: curUserName,
loading: false,
tableData: [],
total: 0,
queryParams: {
nd: currentYear,
nd: undefined,
sqjybh: undefined,
jyspzzt: undefined,
pageNum: 1,
pageSize: 20
},
yearOptions: [currentYear - 1, currentYear, currentYear + 1],
// 年度下拉数据来自 /semester/all(真实后端数据)
yearOptions: [],
defaultNd: undefined,
jcOptions: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
auditStatusOptions: [
{ label: '未审批', value: 0 },
@@ -416,9 +417,31 @@ export default {
}
},
created() {
this.loadList()
this.loadYearOptions().then(() => this.loadList())
},
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.queryParams.nd) this.queryParams.nd = this.defaultNd
return arr
}).catch(() => {
this.yearOptions = []
this.defaultNd = undefined
return []
})
},
/* ---------- 通用格式化 ---------- */
fmtDateTime(v) {
if (!v) return '-'
@@ -470,7 +493,7 @@ export default {
},
resetQuery() {
this.queryParams = {
nd: this.currentYear,
nd: this.defaultNd,
sqjybh: undefined,
jyspzzt: undefined,
pageNum: 1,
@@ -495,7 +518,7 @@ export default {
/* ---------- 新增申请 ---------- */
openAdd() {
this.addForm = {
nd: this.currentYear,
nd: this.defaultNd || this.yearOptions[0],
sskcbbh: '',
sy: '',
rq: '',