This commit is contained in:
guochunsi
2026-01-16 15:04:30 +08:00
parent 358b08bb79
commit 2169bfee92
5 changed files with 374 additions and 316 deletions

View File

@@ -4,8 +4,6 @@
:close-on-click-modal="false"
v-model="visible"
width="600px"
destroy-on-close
>
<el-form :model="dataForm" :rules="dataRule" ref="dataFormRef" @keyup.enter="dataFormSubmit"
label-width="120px">
@@ -118,7 +116,7 @@ import { addObj, getObj, putObj } from '/@/api/recruit/recruitstudentplan'
import { getDeptList } from '/@/api/basic/basicclass'
import { getList } from '/@/api/recruit/recruitstudentplangroup'
import { getMajorNameList } from '/@/api/basic/major'
import { getDicts } from '/@/api/admin/dict'
import { getDictsByTypes } from '/@/api/admin/dict'
import { useDict } from '/@/hooks/dict'
// Emits
@@ -215,19 +213,14 @@ const initData = () => {
})
getList().then((data: any) => {
planList.value = data.data
if (!dataForm.id) {
dataForm.groupId = planList.value[0]?.id || null
}
})
getMajorNameList().then((data: any) => {
offcialZydmList.value = data.data
})
// 获取数据字典
getDicts('basic_major_years').then((res: any) => {
majorYears.value = res.data || []
})
getDicts('basic_major_level').then((res: any) => {
ccList.value = res.data || []
// 获取数据字典(一次获取多个)
getDictsByTypes(['basic_major_years', 'basic_major_level']).then((res: any) => {
majorYears.value = res.data?.basic_major_years || []
ccList.value = res.data?.basic_major_level || []
})
}
@@ -273,22 +266,39 @@ const dataFormSubmit = () => {
// 初始化方法
const init = (id: string | null) => {
dataForm.id = id || null
visible.value = true
canSubmit.value = true
initData()
dataForm.id = ""
// 重置表单数据
nextTick(() => {
dataFormRef.value?.resetFields()
if (dataForm.id) {
getObj(dataForm.id).then((response: any) => {
})
initData()
// 获取详情数据
if (id) {
dataForm.id = id
getObj(id).then((response: any) => {
if (response && response.data) {
Object.assign(dataForm, response.data)
// 获取市平台对应年份下的招生计划
// getCityPlan({ id: dataForm.id }).then((data: any) => {
// cityPlanIdList.value = data.data
// })
})
}
})
}
}).catch(() => {
// 错误处理
})
} else {
// 新增模式:设置默认招生计划
getList().then((data: any) => {
if (data.data && data.data.length > 0) {
dataForm.groupId = data.data[0]?.id || ""
}
})
}
}
// 暴露方法给父组件