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) { export function getSemester(nd) {
return request({ return request({
@@ -244,6 +244,7 @@ import { listStudentTeamTask } from '@/api/teachBusiness/studentTeamTask'
import { listTeam } from '@/api/studentRecords/team' import { listTeam } from '@/api/studentRecords/team'
import { listKb } from '@/api/teachOffice/kb' import { listKb } from '@/api/teachOffice/kb'
import { listTeacher } from '@/api/teachOffice/teacher' import { listTeacher } from '@/api/teachOffice/teacher'
import { listAllSemester } from '@/api/teachBusiness/semester'
// 节次 -> 节次区间映射 // 节次 -> 节次区间映射
const JC_SECTION = { const JC_SECTION = {
@@ -270,7 +271,6 @@ function getMonday(d) {
export default { export default {
name: 'Timetable', name: 'Timetable',
data() { data() {
const currentYear = new Date().getFullYear()
return { return {
activeTab: 'today', activeTab: 'today',
// 今日 // 今日
@@ -292,12 +292,14 @@ export default {
// 班次 // 班次
teamOptions: [], teamOptions: [],
shiftXydbh: '', shiftXydbh: '',
shiftNd: currentYear, shiftNd: undefined,
shiftList: [], shiftList: [],
shiftLoading: false, shiftLoading: false,
shiftTotal: 0, shiftTotal: 0,
shiftQuery: { pageNum: 1, pageSize: 20 }, shiftQuery: { pageNum: 1, pageSize: 20 },
yearOptions: [currentYear - 1, currentYear, currentYear + 1], // 年度下拉数据来自 /semester/all(真实后端数据)
yearOptions: [],
defaultNd: undefined,
// 名称映射(真实接口数据,用于班次 tab 课程/教员编号转名称) // 名称映射(真实接口数据,用于班次 tab 课程/教员编号转名称)
kbMap: {}, kbMap: {},
teacherMap: {} teacherMap: {}
@@ -322,10 +324,11 @@ export default {
shiftTitle() { shiftTitle() {
const team = this.teamOptions.find(t => t.xydbh === this.shiftXydbh) const team = this.teamOptions.find(t => t.xydbh === this.shiftXydbh)
const name = (team && team.xydmc) || '' const name = (team && team.xydmc) || ''
return this.shiftNd + '年' + name + '课程表' return (this.shiftNd ? this.shiftNd + '年' : '') + name + '课程表'
} }
}, },
created() { created() {
this.loadYearOptions()
this.getTodayList() this.getTodayList()
this.getWeekList() this.getWeekList()
this.getPracticeList() this.getPracticeList()
@@ -334,6 +337,28 @@ export default {
this.loadTeacherMap() this.loadTeacherMap()
}, },
methods: { 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) { weekDayName(d) {
return WEEK_DAY_NAMES[d.getDay()] return WEEK_DAY_NAMES[d.getDay()]
}, },
@@ -336,6 +336,7 @@ import {
receiveByAuthority, receiveByAuthority,
cancelScheduleAdjust cancelScheduleAdjust
} from '@/api/teachBusiness/courseRunning' } from '@/api/teachBusiness/courseRunning'
import { listAllSemester } from '@/api/teachBusiness/semester'
// 节次 -> 节次区间映射 // 节次 -> 节次区间映射
const JC_SECTION = { const JC_SECTION = {
@@ -359,22 +360,22 @@ const RECEIVE_STATUS = {
export default { export default {
name: 'TimetableAdjust', name: 'TimetableAdjust',
data() { data() {
const currentYear = new Date().getFullYear()
const curUserName = (this.$store.state.user && this.$store.state.user.name) || '' const curUserName = (this.$store.state.user && this.$store.state.user.name) || ''
return { return {
currentYear: currentYear,
curUserName: curUserName, curUserName: curUserName,
loading: false, loading: false,
tableData: [], tableData: [],
total: 0, total: 0,
queryParams: { queryParams: {
nd: currentYear, nd: undefined,
sqjybh: undefined, sqjybh: undefined,
jyspzzt: undefined, jyspzzt: undefined,
pageNum: 1, pageNum: 1,
pageSize: 20 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], jcOptions: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
auditStatusOptions: [ auditStatusOptions: [
{ label: '未审批', value: 0 }, { label: '未审批', value: 0 },
@@ -416,9 +417,31 @@ export default {
} }
}, },
created() { created() {
this.loadList() this.loadYearOptions().then(() => this.loadList())
}, },
methods: { 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) { fmtDateTime(v) {
if (!v) return '-' if (!v) return '-'
@@ -470,7 +493,7 @@ export default {
}, },
resetQuery() { resetQuery() {
this.queryParams = { this.queryParams = {
nd: this.currentYear, nd: this.defaultNd,
sqjybh: undefined, sqjybh: undefined,
jyspzzt: undefined, jyspzzt: undefined,
pageNum: 1, pageNum: 1,
@@ -495,7 +518,7 @@ export default {
/* ---------- 新增申请 ---------- */ /* ---------- 新增申请 ---------- */
openAdd() { openAdd() {
this.addForm = { this.addForm = {
nd: this.currentYear, nd: this.defaultNd || this.yearOptions[0],
sskcbbh: '', sskcbbh: '',
sy: '', sy: '',
rq: '', rq: '',