|
@@ -1,7 +1,7 @@
|
|
|
<template>
|
|
|
<div style="padding: 20px 30px">
|
|
|
<div class="resume-header mb-3">
|
|
|
- <div class="resume-title">学生学籍信息</div>
|
|
|
+ <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>
|
|
@@ -16,98 +16,51 @@
|
|
|
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 { debounce } from 'lodash'
|
|
|
import { isValidIdCard18 } from '@/utils/validate'
|
|
|
-import { dealCanBeInputtedSave } from '@/utils/getText'
|
|
|
|
|
|
const { t } = useI18n()
|
|
|
|
|
|
const overlay = ref(false)
|
|
|
-// 学校下拉列表
|
|
|
-const schoolNameInput = ref('')
|
|
|
-const getSchoolListData = async (name) => {
|
|
|
- const item = items.value.options.find(e => e.key === 'schoolId')
|
|
|
- if (!item) return
|
|
|
- if (item.items?.length && (schoolNameInput.value === name)) return // 防抖
|
|
|
- item[item.itemTextName] = schoolNameInput.value = name
|
|
|
-
|
|
|
- if (name === null || name === '') { item.items = [] }
|
|
|
- else {
|
|
|
- const data = await schoolSearchByName({ name })
|
|
|
- item.items = data
|
|
|
- }
|
|
|
-}
|
|
|
-const debouncedCallbackSchool = debounce(newValue => {
|
|
|
- if (!newValue) return
|
|
|
- getSchoolListData(newValue)
|
|
|
-}, 500)
|
|
|
-
|
|
|
-// 专业下拉列表
|
|
|
-const majorNameInput = ref('')
|
|
|
-const getMajorListData = async (name) => {
|
|
|
- const item = items.value.options.find(e => e.key === 'majorId')
|
|
|
- if (name === '') { // 此接口不支持传空值
|
|
|
- item.items = []
|
|
|
- return
|
|
|
- }
|
|
|
- if (item.items?.length && (majorNameInput.value === name)) return // 防抖
|
|
|
- item[item.itemTextName] = majorNameInput.value = name
|
|
|
-
|
|
|
- if (name === null || name === '') { item.items = [] }
|
|
|
- else {
|
|
|
- const data = await schoolMajorByName({ name })
|
|
|
- item.items = data
|
|
|
- }
|
|
|
-}
|
|
|
-const debouncedCallbackMajor = debounce(newValue => {
|
|
|
- getMajorListData(newValue)
|
|
|
-}, 500)
|
|
|
|
|
|
const CtFormRef = ref()
|
|
|
const items = ref({
|
|
|
options: [
|
|
|
{
|
|
|
- type: 'combobox',
|
|
|
+ type: 'autocomplete',
|
|
|
key: 'schoolId',
|
|
|
value: null,
|
|
|
default: null,
|
|
|
- label: '学校名称 *',
|
|
|
+ label: '就读学校 *',
|
|
|
outlined: true,
|
|
|
- clearable: true,
|
|
|
- canBeInputted: true, //
|
|
|
- itemTextName: 'schoolName',
|
|
|
- itemText: 'value',
|
|
|
- itemValue: 'key',
|
|
|
- rules: [v => !!v || '请选择学校名称'],
|
|
|
- search: debouncedCallbackSchool,
|
|
|
+ itemText: 'schoolName',
|
|
|
+ itemValue: 'schoolId',
|
|
|
+ rules: [v => !!v || '请选择就读学校'],
|
|
|
items: [],
|
|
|
+ change: e => getDepartmentList(e),
|
|
|
},
|
|
|
{
|
|
|
- type: 'text',
|
|
|
+ type: 'autocomplete',
|
|
|
key: 'schoolDepartmentName',
|
|
|
- value: '',
|
|
|
+ value: null,
|
|
|
default: null,
|
|
|
label: '所在院系 *',
|
|
|
outlined: true,
|
|
|
- rules: [v => !!v || '请填写所在院系']
|
|
|
+ itemText: 'departmentTitle',
|
|
|
+ itemValue: 'schoolDepartmentId',
|
|
|
+ rules: [v => !!v || '请选择所在院系'],
|
|
|
+ items: []
|
|
|
},
|
|
|
{
|
|
|
- type: 'combobox',
|
|
|
- key: 'majorId',
|
|
|
- value: null,
|
|
|
+ type: 'text',
|
|
|
+ key: 'majorName',
|
|
|
+ value: '',
|
|
|
default: null,
|
|
|
label: '所学专业 *',
|
|
|
outlined: true,
|
|
|
- clearable: true,
|
|
|
- canBeInputted: true, //
|
|
|
- itemTextName: 'major',
|
|
|
- itemText: 'nameCn',
|
|
|
- itemValue: 'id',
|
|
|
- rules: [v => !!v || '请选择所学专业'],
|
|
|
- search: debouncedCallbackMajor,
|
|
|
- items: []
|
|
|
+ rules: [v => !!v || '请输入所学专业']
|
|
|
},
|
|
|
{
|
|
|
type: 'text',
|
|
@@ -166,25 +119,57 @@ const items = ref({
|
|
|
},
|
|
|
]
|
|
|
})
|
|
|
+
|
|
|
// 左侧加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 => {
|
|
|
- query.value[item.key] = item.value
|
|
|
- if (e.canBeInputted) { // 特殊处理可输入下拉框
|
|
|
- dealCanBeInputtedSave(e, obj)
|
|
|
- }
|
|
|
+ params[item.key] = item.value
|
|
|
})
|
|
|
- await saveStudentSimpleInfo(query.value)
|
|
|
+ await saveStudentSimpleInfo(params)
|
|
|
+ // getStudentInfoFun()
|
|
|
setTimeout(async () => {
|
|
|
Snackbar.success(t('common.submittedSuccessfully'))
|
|
|
overlay.value = false
|