diff --git a/frontend/src/views/student/shiftTeam/index.vue b/frontend/src/views/student/shiftTeam/index.vue index 5e44e36e..0b7c0cbb 100644 --- a/frontend/src/views/student/shiftTeam/index.vue +++ b/frontend/src/views/student/shiftTeam/index.vue @@ -172,7 +172,25 @@ - + + + @@ -361,6 +379,7 @@ import { } from '@/api/studentRecords/team' import { getDicts } from '@/api/system/dict/data' import { listMajor } from '@/api/subjectMajor/major' +import { listSemesterRooms } from '@/api/studentRecords/semester' const TEAM_TYPE_DICT_CODE = 'stu_type' const SESSION_CATEGORY_DICT_CODE = 'session_category' @@ -406,6 +425,8 @@ export default { dialogTitle: '新增学员队', isAdd: true, formSaving: false, + roomOptions: [], + roomLoading: false, form: this.createEmptyForm(), formRules: { xydbh: [{ required: false }], @@ -490,7 +511,7 @@ export default { zydh: '', zyjsbh: '', bz: '', - zxzt: undefined, + zxzt: 1, rwlb: '', xslx: 1, rxrq: '', @@ -515,6 +536,29 @@ export default { return val === null || val === undefined || val === '' ? '-' : val }, + roomLabel(room) { + if (!room) return '' + const name = room.jsmc || '' + const code = room.jsbh || room.id || '' + return name && code ? `${name}(${code})` : (name || code) + }, + ensureRoomOption(jsbh, jsmc) { + if (!jsbh) return + if (this.roomOptions.some(item => item.jsbh === jsbh)) return + this.roomOptions = [{ jsbh: jsbh, jsmc: jsmc || '' }].concat(this.roomOptions) + }, + searchRooms(keyword) { + this.roomLoading = true + listSemesterRooms({ py: keyword || undefined }).then(res => { + const list = (res && res.data) || [] + this.roomOptions = list + this.ensureRoomOption(this.form.zyjsbh) + this.roomLoading = false + }).catch(() => { + this.roomLoading = false + }) + }, + normalizeSchoolStatus(value) { if (value === 1 || value === '1' || value === '在校') { return 1 @@ -627,6 +671,7 @@ export default { ssdw: d.ssdw || '', ztpxrw: d.ztpxrw !== null && d.ztpxrw !== undefined ? Number(d.ztpxrw) : 1 } + this.ensureRoomOption(this.form.zyjsbh) this.loadTrainingTaskOptions(this.form.ztpxrw) }).catch(() => {}) },