教学任务管理界面完善,教员、教学场地改为下拉
This commit is contained in:
@@ -121,7 +121,7 @@
|
||||
:remote-method="searchKbOptions"
|
||||
:loading="kbLoading"
|
||||
@change="handleKbhChange"
|
||||
@focus="!kbOptions.length && searchKbOptions('')"
|
||||
@focus="searchKbOptions('')"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in kbOptions"
|
||||
@@ -160,12 +160,48 @@
|
||||
<el-row :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="教员编号">
|
||||
<el-input v-model="editForm.jybh" placeholder="教员编号" clearable />
|
||||
<el-select
|
||||
v-model="editForm.jybh"
|
||||
filterable
|
||||
remote
|
||||
clearable
|
||||
reserve-keyword
|
||||
placeholder="按教员姓名 / 编号搜索"
|
||||
style="width: 100%"
|
||||
:remote-method="searchTeacherOptions"
|
||||
:loading="teacherLoading"
|
||||
@focus="searchTeacherOptions('')"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in teacherOptions"
|
||||
:key="item.jybh"
|
||||
:label="teacherOptionLabel(item)"
|
||||
:value="item.jybh"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="教室编号">
|
||||
<el-input v-model="editForm.jsbh" placeholder="教室编号" clearable />
|
||||
<el-select
|
||||
v-model="editForm.jsbh"
|
||||
filterable
|
||||
remote
|
||||
clearable
|
||||
reserve-keyword
|
||||
placeholder="按教室名称 / 编号搜索"
|
||||
style="width: 100%"
|
||||
:remote-method="searchRoomOptions"
|
||||
:loading="roomLoading"
|
||||
@focus="searchRoomOptions('')"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in roomOptions"
|
||||
:key="item.jsbh"
|
||||
:label="roomOptionLabel(item)"
|
||||
:value="item.jsbh"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user