班次学期管理,年度检索下拉框数据缺失问题修复
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
style="width: 140px"
|
||||
@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-form-item>
|
||||
<el-form-item label="学期第次">
|
||||
@@ -368,6 +368,8 @@ export default {
|
||||
// ==================== 下拉数据 ====================
|
||||
/** 年度下拉(来自 /semester/all) */
|
||||
yearOptions: [],
|
||||
/** 检索年度下拉:校历学期 ∪ 班次学期实际年度(如 2033 这类非校历年度也要能筛) */
|
||||
searchYearOptions: [],
|
||||
/** 教学任务下拉({ bh, rwmc }) */
|
||||
taskOptions: [],
|
||||
/** 全部班次学期(用于班历复制目标选择) */
|
||||
@@ -495,12 +497,17 @@ export default {
|
||||
|
||||
/* ==================== 下拉数据加载 ==================== */
|
||||
loadYearOptions() {
|
||||
listAllSemester().then(res => {
|
||||
const list = (res && res.data) || []
|
||||
const years = list.map(x => this.yearFromNd(x.nd)).filter(v => v)
|
||||
this.yearOptions = [...new Set(years)].sort((a, b) => Number(a) - Number(b))
|
||||
}).catch(() => {
|
||||
this.yearOptions = []
|
||||
Promise.all([
|
||||
listAllSemester().catch(() => null),
|
||||
allSemester().catch(() => null)
|
||||
]).then(([schoolRes, classRes]) => {
|
||||
const schoolList = (schoolRes && schoolRes.data) || []
|
||||
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() {
|
||||
|
||||
Reference in New Issue
Block a user