forked from liweijie/education
人才培养方案新增表单调整
This commit is contained in:
@@ -146,24 +146,27 @@
|
|||||||
:close-on-click-modal="false">
|
:close-on-click-modal="false">
|
||||||
<el-form ref="trainingForm" :model="dialog.form" :rules="rules" label-width="130px">
|
<el-form ref="trainingForm" :model="dialog.form" :rules="rules" label-width="130px">
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="专业代号" prop="zydh">
|
|
||||||
<el-input v-model="dialog.form.zydh" placeholder="请输入专业代号" :disabled="dialog.isEdit" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="专业名称" prop="zymc">
|
<el-form-item label="专业名称" prop="zymc">
|
||||||
<el-input v-model="dialog.form.zymc" placeholder="请输入专业名称" />
|
<el-input v-model="dialog.form.zymc" placeholder="请输入专业名称" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
|
||||||
<el-form-item label="专业代码" prop="zydm">
|
|
||||||
<el-input v-model="dialog.form.zydm" placeholder="请输入专业代码" />
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="专业方向">
|
<el-form-item label="专业方向">
|
||||||
<el-input v-model="dialog.form.zyfx" placeholder="请输入专业方向" />
|
<el-select
|
||||||
|
v-model="dialog.form.zyfx"
|
||||||
|
placeholder="请选择专业方向"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
class="training-dict-select"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in majorDirectionOptions"
|
||||||
|
:key="item.dictCode || item.dictValue"
|
||||||
|
:label="item.dictLabel"
|
||||||
|
:value="item.dictLabel"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@@ -207,7 +210,20 @@
|
|||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="学员类别">
|
<el-form-item label="学员类别">
|
||||||
<el-input v-model="dialog.form.xylb" placeholder="请输入学员类别" />
|
<el-select
|
||||||
|
v-model="dialog.form.xylb"
|
||||||
|
placeholder="请选择学员类别"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
class="training-dict-select"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in studentCategoryOptions"
|
||||||
|
:key="item.dictCode || item.dictValue"
|
||||||
|
:label="item.dictLabel"
|
||||||
|
:value="item.dictLabel"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@@ -231,8 +247,21 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
<el-form-item label="教学管理机构编号">
|
<el-form-item label="教学管理机构">
|
||||||
<el-input v-model="dialog.form.jxgljgbh" placeholder="请输入教学管理机构编号" />
|
<el-select
|
||||||
|
v-model="dialog.form.jxgljgbh"
|
||||||
|
placeholder="请选择教学管理机构"
|
||||||
|
clearable
|
||||||
|
filterable
|
||||||
|
class="training-dict-select"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in teachingOrganizationOptions"
|
||||||
|
:key="item.dictCode || item.dictValue"
|
||||||
|
:label="item.dictLabel"
|
||||||
|
:value="item.dictValue"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :span="12">
|
<el-col :span="12">
|
||||||
@@ -294,7 +323,7 @@
|
|||||||
<el-descriptions-item label="专业版本">{{ fmtVal(detail.data.zybb) }}</el-descriptions-item>
|
<el-descriptions-item label="专业版本">{{ fmtVal(detail.data.zybb) }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="主干专业">{{ fmtYesNo(detail.data.zgzy) }}</el-descriptions-item>
|
<el-descriptions-item label="主干专业">{{ fmtYesNo(detail.data.zgzy) }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="自定义分类">{{ fmtVal(detail.data.zdyfl) }}</el-descriptions-item>
|
<el-descriptions-item label="自定义分类">{{ fmtVal(detail.data.zdyfl) }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="教学管理机构编号">{{ fmtVal(detail.data.jxgljgbh) }}</el-descriptions-item>
|
<el-descriptions-item label="教学管理机构">{{ fmtVal(detail.data.jxgljgbh) }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="规范名称">{{ fmtVal(detail.data.gfmc) }}</el-descriptions-item>
|
<el-descriptions-item label="规范名称">{{ fmtVal(detail.data.gfmc) }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="专业规范">{{ fmtVal(detail.data.zygf) }}</el-descriptions-item>
|
<el-descriptions-item label="专业规范">{{ fmtVal(detail.data.zygf) }}</el-descriptions-item>
|
||||||
<el-descriptions-item label="简称">{{ fmtVal(detail.data.jc) }}</el-descriptions-item>
|
<el-descriptions-item label="简称">{{ fmtVal(detail.data.jc) }}</el-descriptions-item>
|
||||||
@@ -326,6 +355,7 @@ import {
|
|||||||
listTraining
|
listTraining
|
||||||
} from '@/api/teachBusiness/training'
|
} from '@/api/teachBusiness/training'
|
||||||
import { getDicts } from '@/api/system/dict/data'
|
import { getDicts } from '@/api/system/dict/data'
|
||||||
|
import { optionselect } from '@/api/system/dict/type'
|
||||||
|
|
||||||
const TRAINING_TYPE_DICT_CODE = 'train_type'
|
const TRAINING_TYPE_DICT_CODE = 'train_type'
|
||||||
const TRAINING_LEVEL_DICT_CODE = 'train_level'
|
const TRAINING_LEVEL_DICT_CODE = 'train_level'
|
||||||
@@ -344,6 +374,9 @@ export default {
|
|||||||
},
|
},
|
||||||
trainingTypeOptions: [],
|
trainingTypeOptions: [],
|
||||||
trainingLevelOptions: [],
|
trainingLevelOptions: [],
|
||||||
|
majorDirectionOptions: [],
|
||||||
|
studentCategoryOptions: [],
|
||||||
|
teachingOrganizationOptions: [],
|
||||||
// 列表
|
// 列表
|
||||||
tableData: [],
|
tableData: [],
|
||||||
total: 0,
|
total: 0,
|
||||||
@@ -367,9 +400,7 @@ export default {
|
|||||||
data: {}
|
data: {}
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
zydh: [{ required: true, message: '请输入专业代号', trigger: 'blur' }],
|
|
||||||
zymc: [{ required: true, message: '请输入专业名称', trigger: 'blur' }],
|
zymc: [{ required: true, message: '请输入专业名称', trigger: 'blur' }],
|
||||||
zydm: [{ required: true, message: '请输入专业代码', trigger: 'blur' }],
|
|
||||||
pxcc: [{ required: true, message: '请选择培训层次', trigger: 'change' }],
|
pxcc: [{ required: true, message: '请选择培训层次', trigger: 'change' }],
|
||||||
pxlx: [{ required: true, message: '请选择培训类型', trigger: 'change' }]
|
pxlx: [{ required: true, message: '请选择培训类型', trigger: 'change' }]
|
||||||
}
|
}
|
||||||
@@ -381,19 +412,66 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
/**
|
/**
|
||||||
* 从系统字典加载培训类型和培训层次,提交标签以匹配现有业务数据。
|
* 从系统字典加载表单下拉选项;文本业务字段提交标签,机构字段提交编号。
|
||||||
*/
|
*/
|
||||||
loadTrainingDictionaries() {
|
async loadTrainingDictionaries() {
|
||||||
return Promise.all([
|
const emptyResponse = { data: [] }
|
||||||
getDicts(TRAINING_TYPE_DICT_CODE),
|
const [typeResponse, levelResponse, dictTypeResponse] = await Promise.all([
|
||||||
getDicts(TRAINING_LEVEL_DICT_CODE)
|
getDicts(TRAINING_TYPE_DICT_CODE).catch(() => emptyResponse),
|
||||||
]).then(([typeResponse, levelResponse]) => {
|
getDicts(TRAINING_LEVEL_DICT_CODE).catch(() => emptyResponse),
|
||||||
this.trainingTypeOptions = typeResponse.data || []
|
optionselect().catch(() => emptyResponse)
|
||||||
this.trainingLevelOptions = levelResponse.data || []
|
])
|
||||||
}).catch(() => {
|
this.trainingTypeOptions = typeResponse.data || []
|
||||||
this.trainingTypeOptions = []
|
this.trainingLevelOptions = levelResponse.data || []
|
||||||
this.trainingLevelOptions = []
|
|
||||||
|
const dictTypes = dictTypeResponse.data || []
|
||||||
|
const [directionOptions, categoryOptions, organizationOptions] = await Promise.all([
|
||||||
|
this.loadNamedDictionary(dictTypes, '专业方向'),
|
||||||
|
this.loadNamedDictionary(dictTypes, '学员类别'),
|
||||||
|
this.loadNamedDictionary(dictTypes, '教学管理机构')
|
||||||
|
])
|
||||||
|
this.majorDirectionOptions = directionOptions
|
||||||
|
this.studentCategoryOptions = categoryOptions
|
||||||
|
this.teachingOrganizationOptions = organizationOptions
|
||||||
|
this.mergeExistingSelectOptions()
|
||||||
|
},
|
||||||
|
async loadNamedDictionary(dictTypes, dictName) {
|
||||||
|
const dictType = dictTypes.find(item => item.dictName === dictName) ||
|
||||||
|
dictTypes.find(item => String(item.dictName || '').includes(dictName))
|
||||||
|
if (!dictType || !dictType.dictType) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const response = await getDicts(dictType.dictType)
|
||||||
|
return response.data || []
|
||||||
|
} catch (error) {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
},
|
||||||
|
mergeExistingSelectOptions() {
|
||||||
|
this.majorDirectionOptions = this.mergeTextOptions(this.majorDirectionOptions, 'zyfx', true)
|
||||||
|
this.studentCategoryOptions = this.mergeTextOptions(this.studentCategoryOptions, 'xylb', true)
|
||||||
|
this.teachingOrganizationOptions = this.mergeTextOptions(
|
||||||
|
this.teachingOrganizationOptions,
|
||||||
|
'jxgljgbh',
|
||||||
|
false
|
||||||
|
)
|
||||||
|
},
|
||||||
|
mergeTextOptions(dictionaryOptions, fieldName, usesLabel) {
|
||||||
|
const options = dictionaryOptions.slice()
|
||||||
|
const existingValues = new Set(options.map(item => String(usesLabel ? item.dictLabel : item.dictValue)))
|
||||||
|
this.tableData.forEach(row => {
|
||||||
|
const value = row[fieldName]
|
||||||
|
if (value === '' || value === null || value === undefined || existingValues.has(String(value))) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
options.push({
|
||||||
|
dictLabel: String(value),
|
||||||
|
dictValue: String(value)
|
||||||
|
})
|
||||||
|
existingValues.add(String(value))
|
||||||
})
|
})
|
||||||
|
return options
|
||||||
},
|
},
|
||||||
|
|
||||||
/* ---------- 列表加载 ---------- */
|
/* ---------- 列表加载 ---------- */
|
||||||
@@ -413,6 +491,7 @@ export default {
|
|||||||
const data = response.data || {}
|
const data = response.data || {}
|
||||||
this.tableData = data.records || []
|
this.tableData = data.records || []
|
||||||
this.total = data.total || 0
|
this.total = data.total || 0
|
||||||
|
this.mergeExistingSelectOptions()
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.tableData = []
|
this.tableData = []
|
||||||
this.total = 0
|
this.total = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user