教学业务-班次学期信息管理-操作列点击教学任务-新增课程任务,课编号要求下拉选择,并能带出所选课程的对应信息
This commit is contained in:
@@ -109,8 +109,27 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="课编号">
|
||||
<el-input v-model="editForm.kbh" placeholder="课程编号" clearable />
|
||||
<el-form-item label="课编号" prop="kbh">
|
||||
<el-select
|
||||
v-model="editForm.kbh"
|
||||
filterable
|
||||
remote
|
||||
clearable
|
||||
reserve-keyword
|
||||
placeholder="按课程名称 / 简称搜索"
|
||||
style="width: 100%"
|
||||
:remote-method="searchKbOptions"
|
||||
:loading="kbLoading"
|
||||
@change="handleKbhChange"
|
||||
@focus="!kbOptions.length && searchKbOptions('')"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in kbOptions"
|
||||
:key="item.kbh"
|
||||
:label="kbOptionLabel(item)"
|
||||
:value="item.kbh"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -419,11 +438,14 @@ export default {
|
||||
editForm: this.createEmptyEditForm(),
|
||||
editRules: {
|
||||
jc: [{ required: true, message: '请输入课程简称', trigger: 'blur' }],
|
||||
kbh: [{ required: true, message: '请选择课程', trigger: 'change' }],
|
||||
// 以下三列在库中「非空且无默认值」,留空会写入无意义值,这里前置拦截
|
||||
xs: [{ required: true, message: '请输入学时', trigger: 'blur' }],
|
||||
klx: [{ required: true, message: '请输入课类型', trigger: 'blur' }],
|
||||
jysdh: [{ required: true, message: '请输入教研室代号', trigger: 'blur' }]
|
||||
},
|
||||
kbOptions: [],
|
||||
kbLoading: false,
|
||||
|
||||
// ==================== 复制到其它班次 ====================
|
||||
teamSelectVisible: false,
|
||||
@@ -649,12 +671,70 @@ export default {
|
||||
})
|
||||
form.xydxqbh = s.bh || row.xydxqbh
|
||||
this.editForm = form
|
||||
this.ensureKbOption(form.kbh, row)
|
||||
this.editVisible = true
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.editFormRef) this.$refs.editFormRef.clearValidate()
|
||||
})
|
||||
},
|
||||
|
||||
/* ---------- 课程下拉(课编号带出课程信息) ---------- */
|
||||
kbOptionLabel(item) {
|
||||
const name = item.kmc || item.jc || ''
|
||||
return name ? `${name}(${item.kbh})` : item.kbh
|
||||
},
|
||||
ensureKbOption(kbh, row) {
|
||||
if (!kbh) return
|
||||
if (this.kbOptions.some(item => item.kbh === kbh)) return
|
||||
this.kbOptions = [{ kbh, kmc: (row && (row.kmc || row.jc)) || '', jc: row && row.jc }].concat(this.kbOptions)
|
||||
},
|
||||
searchKbOptions(keyword) {
|
||||
this.kbLoading = true
|
||||
const kw = (keyword || '').trim()
|
||||
const unwrap = res => {
|
||||
const data = (res && res.data) || {}
|
||||
return data.records || (Array.isArray(data) ? data : [])
|
||||
}
|
||||
const requests = kw
|
||||
? [listKb({ pageNum: 1, pageSize: 30, kmc: kw }), listKb({ pageNum: 1, pageSize: 30, jc: kw })]
|
||||
: [listKb({ pageNum: 1, pageSize: 30 })]
|
||||
Promise.all(requests).then(results => {
|
||||
const merged = []
|
||||
const seen = {}
|
||||
results.forEach(res => {
|
||||
unwrap(res).forEach(item => {
|
||||
if (!item.kbh || seen[item.kbh]) return
|
||||
seen[item.kbh] = true
|
||||
merged.push(item)
|
||||
})
|
||||
})
|
||||
this.kbOptions = merged
|
||||
this.kbLoading = false
|
||||
}).catch(() => {
|
||||
this.kbLoading = false
|
||||
})
|
||||
},
|
||||
/** 选中课程后带出课程档案信息(仅覆盖课程有值的字段) */
|
||||
handleKbhChange(kbh) {
|
||||
const course = this.kbOptions.find(item => item.kbh === kbh)
|
||||
if (!course) return
|
||||
const fill = (key, val) => {
|
||||
if (val !== undefined && val !== null && val !== '') this.editForm[key] = val
|
||||
}
|
||||
fill('jc', course.jc)
|
||||
fill('klx', course.klx)
|
||||
fill('xs', course.xs)
|
||||
fill('llxs', course.llxs)
|
||||
fill('sjxs', course.sjxs)
|
||||
fill('xf', course.xf)
|
||||
fill('ksks', course.ksks)
|
||||
fill('cjfz', course.cjfz)
|
||||
fill('bjrxypjf', course.bjrxypjf)
|
||||
fill('ksksbxs', course.ksksbxs)
|
||||
fill('jysdh', course.jysdh)
|
||||
fill('zks', course.zks)
|
||||
},
|
||||
|
||||
handleEditSubmit() {
|
||||
this.$refs.editFormRef.validate(valid => {
|
||||
if (!valid) return
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<div class="list-actions">
|
||||
<el-button type="primary" icon="el-icon-plus" @click="handleBatchAdd">批量创建班次学期</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-document-add" @click="handleAdd">新增</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-edit" :disabled="!currentRow" @click="handleEdit">编辑</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-edit" :disabled="!currentRow" @click="handleEdit()">编辑</el-button>
|
||||
<el-button type="danger" plain icon="el-icon-delete" :disabled="!selection.length" @click="handleDelete">删除所选</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-date" :disabled="!selection.length" @click="handleQuickSetDates">快速设定学期日期</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-download" :disabled="!currentRow" @click="handleAbsorbDates">吸取预设日期</el-button>
|
||||
@@ -61,9 +61,9 @@
|
||||
<el-button type="warning" plain :disabled="selection.length < 2" @click="handleWaveMerge">预设合班</el-button>
|
||||
<el-button type="warning" plain :disabled="!selection.length" @click="handleWaveSplit">预设拆班</el-button>
|
||||
<el-button type="primary" plain :disabled="!selection.length" @click="handleBatchGenerateTasks">批量生成必修课程</el-button>
|
||||
<el-button type="success" plain icon="el-icon-date" :disabled="!currentRow" @click="handleEditEventCalendar">编辑班历</el-button>
|
||||
<el-button type="success" plain icon="el-icon-calendar" :disabled="!currentRow" @click="handleEditCalendar">编辑班次教学任务</el-button>
|
||||
<el-button type="success" plain icon="el-icon-data-line" :disabled="!currentRow" @click="handleAllocation">教学配当</el-button>
|
||||
<el-button type="success" plain icon="el-icon-date" :disabled="!currentRow" @click="handleEditEventCalendar()">编辑班历</el-button>
|
||||
<el-button type="success" plain icon="el-icon-calendar" :disabled="!currentRow" @click="handleEditCalendar()">编辑班次教学任务</el-button>
|
||||
<el-button type="success" plain icon="el-icon-data-line" :disabled="!currentRow" @click="handleAllocation()">教学配当</el-button>
|
||||
<el-button type="success" plain icon="el-icon-download" :disabled="!selection.length" @click="handleExportAllocation">导出配当</el-button>
|
||||
<el-button type="primary" plain icon="el-icon-upload2" :disabled="!selection.length" @click="handlePublishRunning">发布运行课表</el-button>
|
||||
<el-button type="danger" plain icon="el-icon-delete-solid" :disabled="!selection.length" @click="handleWithdrawRunning">删除运行课表</el-button>
|
||||
|
||||
Reference in New Issue
Block a user