diff --git a/src/views/recruit/recruitplanmajor/detaiform.vue b/src/views/recruit/recruitplanmajor/detaiform.vue index 8bd0ca1..db750b2 100644 --- a/src/views/recruit/recruitplanmajor/detaiform.vue +++ b/src/views/recruit/recruitplanmajor/detaiform.vue @@ -4,8 +4,6 @@ :close-on-click-modal="false" v-model="visible" width="600px" - destroy-on-close - > @@ -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 || "" + } + }) + } } // 暴露方法给父组件 diff --git a/src/views/recruit/recruitprestudent/enrolplantemplate-form.vue b/src/views/recruit/recruitprestudent/enrolplantemplate-form.vue index 56eae03..08b5835 100644 --- a/src/views/recruit/recruitprestudent/enrolplantemplate-form.vue +++ b/src/views/recruit/recruitprestudent/enrolplantemplate-form.vue @@ -3,217 +3,268 @@ :title="!dataForm.id ? '新增' : '修改'" :close-on-click-modal="false" v-model="visible" - width="600px" + width="900px" > + + + + + + + + + + + + + + + + + + + + + + + + + + + {{ item.label }} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -