diff --git a/frontend/src/views/teachOffice/shiftSemester/ClassCalendarDialog.vue b/frontend/src/views/teachOffice/shiftSemester/ClassCalendarDialog.vue index 2a663980..766c93ef 100644 --- a/frontend/src/views/teachOffice/shiftSemester/ClassCalendarDialog.vue +++ b/frontend/src/views/teachOffice/shiftSemester/ClassCalendarDialog.vue @@ -121,7 +121,7 @@ :remote-method="searchKbOptions" :loading="kbLoading" @change="handleKbhChange" - @focus="!kbOptions.length && searchKbOptions('')" + @focus="searchKbOptions('')" > - + + + - + + + @@ -412,6 +448,8 @@ import { pasteTasks } from '@/api/studentRecords/classCalendar' import { listKb } from '@/api/teachOffice/kb' +import { listTeacher } from '@/api/teachOffice/teacher' +import { listClassroom } from '@/api/teachBusiness/classroom' const TASK_CLIPBOARD_KEY = 'education.classTaskClipboard' @@ -446,6 +484,10 @@ export default { }, kbOptions: [], kbLoading: false, + teacherOptions: [], + teacherLoading: false, + roomOptions: [], + roomLoading: false, // ==================== 复制到其它班次 ==================== teamSelectVisible: false, @@ -672,6 +714,8 @@ export default { form.xydxqbh = s.bh || row.xydxqbh this.editForm = form this.ensureKbOption(form.kbh, row) + this.ensureTeacherOption(form.jybh, row) + this.ensureRoomOption(form.jsbh, row) this.editVisible = true this.$nextTick(() => { if (this.$refs.editFormRef) this.$refs.editFormRef.clearValidate() @@ -709,11 +753,75 @@ export default { }) }) this.kbOptions = merged + this.ensureKbOption(this.editForm && this.editForm.kbh) this.kbLoading = false }).catch(() => { this.kbLoading = false }) }, + /* ---------- 教员下拉(责任教员远程检索) ---------- */ + teacherOptionLabel(item) { + const name = item.jyxm || '' + return name ? `${name}(${item.jybh})` : item.jybh + }, + ensureTeacherOption(jybh, row) { + if (!jybh) return + if (this.teacherOptions.some(item => item.jybh === jybh)) return + this.teacherOptions = [{ jybh, jyxm: (row && row.jyxm) || '' }].concat(this.teacherOptions) + }, + searchTeacherOptions(keyword) { + this.teacherLoading = true + const kw = (keyword || '').trim() + const params = { pageNum: 1, pageSize: 30 } + if (kw) params.jyxm = kw + listTeacher(params).then(res => { + const data = (res && res.data) || {} + this.teacherOptions = data.records || (Array.isArray(data) ? data : []) + this.ensureTeacherOption(this.editForm && this.editForm.jybh) + this.teacherLoading = false + }).catch(() => { + this.teacherLoading = false + }) + }, + + /* ---------- 教室下拉(教学场地远程检索) ---------- */ + roomOptionLabel(item) { + const name = item.jsmc || '' + return name ? `${name}(${item.jsbh})` : item.jsbh + }, + ensureRoomOption(jsbh, row) { + if (!jsbh) return + if (this.roomOptions.some(item => item.jsbh === jsbh)) return + this.roomOptions = [{ jsbh, jsmc: (row && row.jsmc) || '' }].concat(this.roomOptions) + }, + searchRoomOptions(keyword) { + this.roomLoading = true + const kw = (keyword || '').trim() + const unwrap = res => { + const data = (res && res.data) || {} + return data.records || (Array.isArray(data) ? data : []) + } + const requests = kw + ? [listClassroom({ pageNum: 1, pageSize: 30, jsmc: kw }), listClassroom({ pageNum: 1, pageSize: 30, jsbh: kw })] + : [listClassroom({ pageNum: 1, pageSize: 30 })] + Promise.all(requests).then(results => { + const merged = [] + const seen = {} + results.forEach(res => { + unwrap(res).forEach(item => { + if (!item.jsbh || seen[item.jsbh]) return + seen[item.jsbh] = true + merged.push(item) + }) + }) + this.roomOptions = merged + this.ensureRoomOption(this.editForm && this.editForm.jsbh) + this.roomLoading = false + }).catch(() => { + this.roomLoading = false + }) + }, + /** 选中课程后带出课程档案信息(仅覆盖课程有值的字段) */ handleKbhChange(kbh) { const course = this.kbOptions.find(item => item.kbh === kbh)