教学大纲字典统一 新增专业 课程等字典调整
This commit is contained in:
@@ -100,13 +100,41 @@
|
||||
<el-form ref="syllabusForm" :model="dialog.form" :rules="rules" label-width="130px">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="12">
|
||||
<el-form-item label="专业代号" prop="zydh">
|
||||
<el-input v-model="dialog.form.zydh" placeholder="请输入专业代号" />
|
||||
<el-form-item label="专业" prop="zydh">
|
||||
<el-select
|
||||
v-model="dialog.form.zydh"
|
||||
filterable
|
||||
clearable
|
||||
placeholder="请选择专业"
|
||||
class="w-full"
|
||||
:loading="referenceDataLoading"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in majorOptions"
|
||||
:key="item.zydh"
|
||||
:label="item.zymc"
|
||||
:value="item.zydh"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="课编号" prop="kbh">
|
||||
<el-input v-model="dialog.form.kbh" placeholder="请输入课编号" />
|
||||
<el-form-item label="课程" prop="kbh">
|
||||
<el-select
|
||||
v-model="dialog.form.kbh"
|
||||
filterable
|
||||
clearable
|
||||
placeholder="请选择课程"
|
||||
class="w-full"
|
||||
:loading="referenceDataLoading"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in subjectOptions"
|
||||
:key="item.kbh"
|
||||
:label="item.kmc"
|
||||
:value="item.kbh"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@@ -116,7 +144,21 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="课类型" prop="klx">
|
||||
<el-input v-model="dialog.form.klx" placeholder="请输入课类型" />
|
||||
<el-select
|
||||
v-model="dialog.form.klx"
|
||||
filterable
|
||||
clearable
|
||||
placeholder="请选择课类型"
|
||||
class="w-full"
|
||||
:loading="referenceDataLoading"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in courseTypeOptions"
|
||||
:key="item.dictValue"
|
||||
:label="item.dictLabel"
|
||||
:value="item.dictValue"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@@ -158,8 +200,22 @@
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="教研室代号">
|
||||
<el-input v-model="dialog.form.jysdh" placeholder="请输入教研室代号" />
|
||||
<el-form-item label="教研室">
|
||||
<el-select
|
||||
v-model="dialog.form.jysdh"
|
||||
filterable
|
||||
clearable
|
||||
placeholder="请选择教研室"
|
||||
class="w-full"
|
||||
:loading="referenceDataLoading"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in officeOptions"
|
||||
:key="item.jysdh"
|
||||
:label="item.jysmc"
|
||||
:value="item.jysdh"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@@ -225,6 +281,13 @@ import {
|
||||
listSyllabus,
|
||||
listSyllabusByZydhAndTy
|
||||
} from '@/api/teachBusiness/syllabus'
|
||||
import { listMajor } from '@/api/subjectMajor/major'
|
||||
import { listKb } from '@/api/teachOffice/kb'
|
||||
import { listOffice } from '@/api/teachOffice/office'
|
||||
import { getDicts } from '@/api/system/dict/data'
|
||||
|
||||
const REFERENCE_DATA_PAGE_SIZE = 10000
|
||||
const COURSE_TYPE_DICT_CODE = 'course_type'
|
||||
|
||||
export default {
|
||||
name: 'SyllabusIndex',
|
||||
@@ -240,6 +303,11 @@ export default {
|
||||
pageNum: 1,
|
||||
pageSize: 20,
|
||||
selection: [],
|
||||
referenceDataLoading: false,
|
||||
majorOptions: [],
|
||||
subjectOptions: [],
|
||||
courseTypeOptions: [],
|
||||
officeOptions: [],
|
||||
dialog: {
|
||||
visible: false,
|
||||
title: '',
|
||||
@@ -247,10 +315,10 @@ export default {
|
||||
form: this.createEmptyForm()
|
||||
},
|
||||
rules: {
|
||||
zydh: [{ required: true, message: '请输入专业代号', trigger: 'blur' }],
|
||||
kbh: [{ required: true, message: '请输入课编号', trigger: 'blur' }],
|
||||
zydh: [{ required: true, message: '请选择专业', trigger: 'change' }],
|
||||
kbh: [{ required: true, message: '请选择课程', trigger: 'change' }],
|
||||
xqdc: [{ required: true, message: '请输入学期第次', trigger: 'blur' }],
|
||||
klx: [{ required: true, message: '请输入课类型', trigger: 'blur' }],
|
||||
klx: [{ required: true, message: '请选择课类型', trigger: 'change' }],
|
||||
xs: [{ required: true, message: '请输入学时', trigger: 'blur' }],
|
||||
ty: [{ required: true, message: '请选择停用标识', trigger: 'change' }]
|
||||
}
|
||||
@@ -264,8 +332,51 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.fetchList()
|
||||
this.loadReferenceData()
|
||||
},
|
||||
methods: {
|
||||
loadReferenceData() {
|
||||
this.referenceDataLoading = true
|
||||
const query = { pageNum: 1, pageSize: REFERENCE_DATA_PAGE_SIZE }
|
||||
const requests = [
|
||||
listMajor(query),
|
||||
listKb(query),
|
||||
listOffice(query),
|
||||
getDicts(COURSE_TYPE_DICT_CODE)
|
||||
].map(request => {
|
||||
return request
|
||||
.then(response => this.getResponseRecords(response))
|
||||
.catch(() => [])
|
||||
})
|
||||
|
||||
Promise.all(requests).then(([majors, subjects, offices, courseTypes]) => {
|
||||
this.majorOptions = this.getUniqueOptions(majors, 'zydh', 'zymc')
|
||||
this.subjectOptions = this.getUniqueOptions(subjects, 'kbh', 'kmc')
|
||||
this.officeOptions = this.getUniqueOptions(offices, 'jysdh', 'jysmc')
|
||||
this.courseTypeOptions = this.getUniqueOptions(courseTypes, 'dictValue', 'dictLabel')
|
||||
}).finally(() => {
|
||||
this.referenceDataLoading = false
|
||||
})
|
||||
},
|
||||
getResponseRecords(response) {
|
||||
const data = response.data || {}
|
||||
|
||||
return Array.isArray(data) ? data : data.records || []
|
||||
},
|
||||
getUniqueOptions(items, valueKey, labelKey) {
|
||||
const values = new Set()
|
||||
|
||||
return items.filter(item => {
|
||||
const value = item[valueKey]
|
||||
const label = item[labelKey]
|
||||
if (!value || !label || values.has(value)) {
|
||||
return false
|
||||
}
|
||||
values.add(value)
|
||||
|
||||
return true
|
||||
})
|
||||
},
|
||||
/* ---------- 列表加载 ---------- */
|
||||
fetchList() {
|
||||
this.loading = true
|
||||
|
||||
Reference in New Issue
Block a user