123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <template>
- <div style="padding: 20px 30px">
- <div class="resume-header mb-3">
- <div class="resume-title">学生信息认证</div>
- </div>
- <div class="d-flex flex-column align-center pt-5">
- <CtForm ref="CtFormRef" :items="items" style="width: 900px;"></CtForm>
- <v-btn class="buttons mt-5" color="primary" @click.stop="handleSubmit">{{ $t('common.save') }}</v-btn>
- </div>
- </div>
- <Loading :visible="overlay"></Loading>
- </template>
- <script setup>
- defineOptions({name: 'personal-personCenter-studentInformation-index'})
- import { ref } from 'vue'
- import { saveStudentSimpleInfo } from '@/api/recruit/personal/shareJob'
- import { schoolList, departmentList, getStudentInfo } from '@/api/recruit/personal/resume'
- import { useI18n } from '@/hooks/web/useI18n'
- import Snackbar from '@/plugins/snackbar'
- import { isValidIdCard18 } from '@/utils/validate'
- const { t } = useI18n()
- const overlay = ref(false)
- const CtFormRef = ref()
- const items = ref({
- options: [
- {
- type: 'autocomplete',
- key: 'schoolId',
- value: null,
- default: null,
- label: '就读学校 *',
- outlined: true,
- itemText: 'schoolName',
- itemValue: 'schoolId',
- rules: [v => !!v || '请选择就读学校'],
- items: [],
- change: e => getDepartmentList(e),
- },
- {
- type: 'autocomplete',
- key: 'schoolDepartmentName',
- value: null,
- default: null,
- label: '所在院系 *',
- outlined: true,
- itemText: 'departmentTitle',
- itemValue: 'schoolDepartmentId',
- rules: [v => !!v || '请选择所在院系'],
- items: []
- },
- {
- type: 'text',
- key: 'majorName',
- value: '',
- default: null,
- label: '所学专业 *',
- outlined: true,
- rules: [v => !!v || '请输入所学专业']
- },
- {
- type: 'text',
- key: 'schoolClassName',
- value: '',
- default: null,
- label: '所在班级 *',
- outlined: true,
- rules: [v => !!v || '请填写所在班级']
- },
- {
- type: 'text',
- key: 'studentNo',
- value: '',
- default: null,
- label: '学号 *',
- outlined: true,
- rules: [v => !!v || '请填写学号']
- },
- // {
- // type: 'text',
- // key: 'emergencyContactName',
- // value: '',
- // default: null,
- // label: '紧急联系人姓名 *',
- // outlined: true,
- // rules: [v => !!v || '请填写紧急联系人姓名']
- // },
- // {
- // type: 'phoneNumber',
- // key: 'emergencyContactPhone',
- // value: '',
- // clearable: true,
- // label: '紧急联系人手机号 *',
- // rules: [v => !!v || '请填写紧急联系人手机号']
- // },
- ]
- })
- // 左侧加mr
- items.value.options.forEach((e, index) => {
- e.col = 6
- if ((index + 2) % 2 === 0) e.flexStyle = 'mr-3'
- })
- // // 学校下拉列表
- const getSchoolListData = async () => {
- const item = items.value.options.find(e => e.key === 'schoolId')
- if (!item) return
- const { records } = await schoolList({current: 1,size: 9999})
- item.items = records || []
- }
- getSchoolListData()
- const getDepartmentList = async (e) => {
- const item = items.value.options.find(e => e.key === 'schoolDepartmentName')
- if (!item) return
- const query = {
- page: { size: 9999, current: 1 },
- entity: { schoolId: e }
- }
- const res = await departmentList(query)
- const list = res?.records?.length ? res.records : []
- item.items = list.map(e => e.entity)
- }
- // 获取学生基本信息
- const getStudentInfoFun = async () => {
- const data = await getStudentInfo()
- if (data.schoolId) getDepartmentList(data.schoolId)
- // 回显
- items.value.options.forEach(e => {
- if (data[e.key]) e.value = data[e.key]
- })
- }
- getStudentInfoFun()
- // 提交
- const handleSubmit = async () => {
- const { valid } = await CtFormRef.value.formRef.validate()
- if (!valid) return
- overlay.value = true
- const params = {}
- items.value.options.forEach(item => {
- params[item.key] = item.value
- })
- await saveStudentSimpleInfo(params)
- // getStudentInfoFun()
- setTimeout(async () => {
- Snackbar.success(t('common.submittedSuccessfully'))
- overlay.value = false
- }, 1000)
- }
- </script>
- <style scoped lang="scss">
- </style>
|