forked from liweijie/education
新增专业信息的时候设置下拉选项
This commit is contained in:
@@ -296,7 +296,21 @@
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-form-item label="人培编号">
|
||||
<el-input v-model="form.rpbh" placeholder="请输入人培编号" />
|
||||
<el-select
|
||||
v-model="form.rpbh"
|
||||
:loading="trainingOptionsLoading"
|
||||
placeholder="请选择人培编号"
|
||||
clearable
|
||||
filterable
|
||||
class="w-full"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in trainingOptions"
|
||||
:key="item.rpbh"
|
||||
:label="item.zymc ? `${item.zymc}(${item.rpbh})` : item.rpbh"
|
||||
:value="item.rpbh"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
@@ -450,6 +464,7 @@ import {
|
||||
importMajor
|
||||
} from "@/api/subjectMajor/major"
|
||||
import { listDiscipline } from '@/api/subjectMajor/discipline'
|
||||
import { listTraining } from '@/api/teachBusiness/training'
|
||||
import { getDicts } from '@/api/system/dict/data'
|
||||
import { optionselect } from '@/api/system/dict/type'
|
||||
|
||||
@@ -496,6 +511,8 @@ export default {
|
||||
systemModeOptions: [],
|
||||
disciplineOptions: [],
|
||||
disciplineOptionsLoading: false,
|
||||
trainingOptions: [],
|
||||
trainingOptionsLoading: false,
|
||||
formRules: {
|
||||
zydh: [{ required: true, message: "专业代号不能为空", trigger: "blur" }],
|
||||
zymc: [{ required: true, message: "专业名称不能为空", trigger: "blur" }],
|
||||
@@ -537,6 +554,7 @@ export default {
|
||||
created() {
|
||||
this.loadMajorDictionaries()
|
||||
this.loadDisciplineOptions()
|
||||
this.loadTrainingOptions()
|
||||
this.fetchList()
|
||||
},
|
||||
methods: {
|
||||
@@ -592,9 +610,23 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
/** 加载人才培养方案列表,作为人培编号下拉选项(过滤停用)。 */
|
||||
async loadTrainingOptions() {
|
||||
this.trainingOptionsLoading = true
|
||||
try {
|
||||
const response = await listTraining({ pageNum: 1, pageSize: 500 })
|
||||
const records = (response.data && response.data.records) || []
|
||||
this.trainingOptions = records.filter(item => !item.ty)
|
||||
} catch (error) {
|
||||
this.trainingOptions = []
|
||||
} finally {
|
||||
this.trainingOptionsLoading = false
|
||||
}
|
||||
},
|
||||
|
||||
formatDisciplineLabel(item) {
|
||||
const name = item.zymc || item.gfmc || item.zydm || item.bsh
|
||||
const identifiers = [item.zydm, item.bsh].filter(Boolean).join(' / ')
|
||||
const identifiers = [item.zydm].filter(Boolean).join(' / ')
|
||||
|
||||
return identifiers && identifiers !== name ? `${name}(${identifiers})` : name
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user