班次学期管理,年度检索下拉框数据缺失问题修复

This commit is contained in:
2026-09-24 11:32:26 +08:00
parent 094245231c
commit 836995a794
@@ -24,7 +24,7 @@
style="width: 140px" style="width: 140px"
@change="handleQuery" @change="handleQuery"
> >
<el-option v-for="y in yearOptions" :key="y" :label="`${y}年`" :value="y" /> <el-option v-for="y in searchYearOptions" :key="y" :label="`${y}年`" :value="y" />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="学期第次"> <el-form-item label="学期第次">
@@ -368,6 +368,8 @@ export default {
// ==================== 下拉数据 ==================== // ==================== 下拉数据 ====================
/** 年度下拉(来自 /semester/all */ /** 年度下拉(来自 /semester/all */
yearOptions: [], yearOptions: [],
/** 检索年度下拉:校历学期 ∪ 班次学期实际年度(如 2033 这类非校历年度也要能筛) */
searchYearOptions: [],
/** 教学任务下拉({ bh, rwmc } */ /** 教学任务下拉({ bh, rwmc } */
taskOptions: [], taskOptions: [],
/** 全部班次学期(用于班历复制目标选择) */ /** 全部班次学期(用于班历复制目标选择) */
@@ -495,12 +497,17 @@ export default {
/* ==================== 下拉数据加载 ==================== */ /* ==================== 下拉数据加载 ==================== */
loadYearOptions() { loadYearOptions() {
listAllSemester().then(res => { Promise.all([
const list = (res && res.data) || [] listAllSemester().catch(() => null),
const years = list.map(x => this.yearFromNd(x.nd)).filter(v => v) allSemester().catch(() => null)
this.yearOptions = [...new Set(years)].sort((a, b) => Number(a) - Number(b)) ]).then(([schoolRes, classRes]) => {
}).catch(() => { const schoolList = (schoolRes && schoolRes.data) || []
this.yearOptions = [] const classList = (classRes && (classRes.data || classRes.rows)) || []
const schoolYears = schoolList.map(x => this.yearFromNd(x.nd)).filter(v => v)
const classYears = classList.map(x => this.yearFromNd(x.nd)).filter(v => v)
this.yearOptions = [...new Set(schoolYears)].sort((a, b) => Number(a) - Number(b))
this.searchYearOptions = [...new Set([...schoolYears, ...classYears])]
.sort((a, b) => Number(a) - Number(b))
}) })
}, },
loadTaskOptions() { loadTaskOptions() {