index.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <div style="padding: 20px 30px">
  3. <div class="resume-header mb-3">
  4. <div class="resume-title">学生信息认证</div>
  5. </div>
  6. <div class="d-flex flex-column align-center pt-5">
  7. <CtForm ref="CtFormRef" :items="items" style="width: 900px;"></CtForm>
  8. <v-btn class="buttons mt-5" color="primary" @click.stop="handleSubmit">{{ $t('common.save') }}</v-btn>
  9. </div>
  10. </div>
  11. <Loading :visible="overlay"></Loading>
  12. </template>
  13. <script setup>
  14. defineOptions({name: 'personal-personCenter-studentInformation-index'})
  15. import { ref } from 'vue'
  16. import { saveStudentSimpleInfo } from '@/api/recruit/personal/shareJob'
  17. import { schoolList, departmentList, getStudentInfo } from '@/api/recruit/personal/resume'
  18. import { useI18n } from '@/hooks/web/useI18n'
  19. import Snackbar from '@/plugins/snackbar'
  20. import { isValidIdCard18 } from '@/utils/validate'
  21. const { t } = useI18n()
  22. const overlay = ref(false)
  23. const CtFormRef = ref()
  24. const items = ref({
  25. options: [
  26. {
  27. type: 'autocomplete',
  28. key: 'schoolId',
  29. value: null,
  30. default: null,
  31. label: '就读学校 *',
  32. outlined: true,
  33. itemText: 'schoolName',
  34. itemValue: 'schoolId',
  35. rules: [v => !!v || '请选择就读学校'],
  36. items: [],
  37. change: e => getDepartmentList(e),
  38. },
  39. {
  40. type: 'autocomplete',
  41. key: 'schoolDepartmentName',
  42. value: null,
  43. default: null,
  44. label: '所在院系 *',
  45. outlined: true,
  46. itemText: 'departmentTitle',
  47. itemValue: 'schoolDepartmentId',
  48. rules: [v => !!v || '请选择所在院系'],
  49. items: []
  50. },
  51. {
  52. type: 'text',
  53. key: 'majorName',
  54. value: '',
  55. default: null,
  56. label: '所学专业 *',
  57. outlined: true,
  58. rules: [v => !!v || '请输入所学专业']
  59. },
  60. {
  61. type: 'text',
  62. key: 'schoolClassName',
  63. value: '',
  64. default: null,
  65. label: '所在班级 *',
  66. outlined: true,
  67. rules: [v => !!v || '请填写所在班级']
  68. },
  69. {
  70. type: 'text',
  71. key: 'studentNo',
  72. value: '',
  73. default: null,
  74. label: '学号 *',
  75. outlined: true,
  76. rules: [v => !!v || '请填写学号']
  77. },
  78. // {
  79. // type: 'text',
  80. // key: 'emergencyContactName',
  81. // value: '',
  82. // default: null,
  83. // label: '紧急联系人姓名 *',
  84. // outlined: true,
  85. // rules: [v => !!v || '请填写紧急联系人姓名']
  86. // },
  87. // {
  88. // type: 'phoneNumber',
  89. // key: 'emergencyContactPhone',
  90. // value: '',
  91. // clearable: true,
  92. // label: '紧急联系人手机号 *',
  93. // rules: [v => !!v || '请填写紧急联系人手机号']
  94. // },
  95. ]
  96. })
  97. // 左侧加mr
  98. items.value.options.forEach((e, index) => {
  99. e.col = 6
  100. if ((index + 2) % 2 === 0) e.flexStyle = 'mr-3'
  101. })
  102. // // 学校下拉列表
  103. const getSchoolListData = async () => {
  104. const item = items.value.options.find(e => e.key === 'schoolId')
  105. if (!item) return
  106. const { records } = await schoolList({current: 1,size: 9999})
  107. item.items = records || []
  108. }
  109. getSchoolListData()
  110. const getDepartmentList = async (e) => {
  111. const item = items.value.options.find(e => e.key === 'schoolDepartmentName')
  112. if (!item) return
  113. const query = {
  114. page: { size: 9999, current: 1 },
  115. entity: { schoolId: e }
  116. }
  117. const res = await departmentList(query)
  118. const list = res?.records?.length ? res.records : []
  119. item.items = list.map(e => e.entity)
  120. }
  121. // 获取学生基本信息
  122. const getStudentInfoFun = async () => {
  123. const data = await getStudentInfo()
  124. if (data.schoolId) getDepartmentList(data.schoolId)
  125. // 回显
  126. items.value.options.forEach(e => {
  127. if (data[e.key]) e.value = data[e.key]
  128. })
  129. }
  130. getStudentInfoFun()
  131. // 提交
  132. const handleSubmit = async () => {
  133. const { valid } = await CtFormRef.value.formRef.validate()
  134. if (!valid) return
  135. overlay.value = true
  136. const params = {}
  137. items.value.options.forEach(item => {
  138. params[item.key] = item.value
  139. })
  140. await saveStudentSimpleInfo(params)
  141. // getStudentInfoFun()
  142. setTimeout(async () => {
  143. Snackbar.success(t('common.submittedSuccessfully'))
  144. overlay.value = false
  145. }, 1000)
  146. }
  147. </script>
  148. <style scoped lang="scss">
  149. </style>