forked from liweijie/education
学员队新增的时候,教室改为下拉,默认在校
This commit is contained in:
@@ -172,7 +172,25 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="专业教室编号">
|
||||
<el-input v-model="form.zyjsbh" placeholder="请输入专业教室编号" />
|
||||
<el-select
|
||||
v-model="form.zyjsbh"
|
||||
filterable
|
||||
remote
|
||||
clearable
|
||||
reserve-keyword
|
||||
:remote-method="searchRooms"
|
||||
:loading="roomLoading"
|
||||
placeholder="请输入教室名称或编号检索"
|
||||
class="w-full"
|
||||
@focus="searchRooms('')"
|
||||
>
|
||||
<el-option
|
||||
v-for="room in roomOptions"
|
||||
:key="room.jsbh || room.id"
|
||||
:label="roomLabel(room)"
|
||||
:value="room.jsbh"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@@ -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(() => {})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user