|
@@ -27,12 +27,12 @@
|
|
import { getDict } from '@/hooks/web/useDictionaries'
|
|
import { getDict } from '@/hooks/web/useDictionaries'
|
|
defineOptions({name: 'dialogExtend-InfoForm'})
|
|
defineOptions({name: 'dialogExtend-InfoForm'})
|
|
import { reactive, ref } from 'vue'
|
|
import { reactive, ref } from 'vue'
|
|
-import { schoolList, departmentList } from '@/api/recruit/personal/resume'
|
|
|
|
import { getUserAvatar } from '@/utils/avatar'
|
|
import { getUserAvatar } from '@/utils/avatar'
|
|
import { uploadFile } from '@/api/common'
|
|
import { uploadFile } from '@/api/common'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
import Snackbar from '@/plugins/snackbar'
|
|
import { useI18n } from '@/hooks/web/useI18n'; const { t } = useI18n()
|
|
import { useI18n } from '@/hooks/web/useI18n'; const { t } = useI18n()
|
|
import { isValidIdCard18 } from '@/utils/validate'
|
|
import { isValidIdCard18 } from '@/utils/validate'
|
|
|
|
+import { getSchoolList, getDepartmentListBySchoolId, getMajorList } from '@/api/recruit/personal/student'
|
|
|
|
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
option: {
|
|
option: {
|
|
@@ -50,6 +50,20 @@ const isShowCopper = ref(false)
|
|
|
|
|
|
const male = ref('1')
|
|
const male = ref('1')
|
|
const showIcon = ref(false)
|
|
const showIcon = ref(false)
|
|
|
|
+
|
|
|
|
+// 专业名称下拉列表
|
|
|
|
+let majorName = null
|
|
|
|
+const getMajorData = async (name) => {
|
|
|
|
+ const item = items.value.options.find(e => e.key === 'majorId')
|
|
|
|
+ if (!item) return
|
|
|
|
+ if (item.items?.length && (majorName === name)) return // 防抖
|
|
|
|
+ majorName = name
|
|
|
|
+ if (name) {
|
|
|
|
+ const data = await getMajorList({ name })
|
|
|
|
+ item.items = data
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
const items = ref({
|
|
const items = ref({
|
|
options: [
|
|
options: [
|
|
{
|
|
{
|
|
@@ -137,41 +151,50 @@ const items = ref({
|
|
default: null,
|
|
default: null,
|
|
label: '就读学校 *',
|
|
label: '就读学校 *',
|
|
outlined: true,
|
|
outlined: true,
|
|
- itemText: 'schoolName',
|
|
|
|
|
|
+ itemText: 'name',
|
|
itemValue: 'schoolId',
|
|
itemValue: 'schoolId',
|
|
rules: [v => !!v || '请选择就读学校'],
|
|
rules: [v => !!v || '请选择就读学校'],
|
|
items: [],
|
|
items: [],
|
|
- change: e => getDepartmentList(e),
|
|
|
|
|
|
+ change: e => getDepartmentList(e, 'schoolDeptId', 0),
|
|
},
|
|
},
|
|
{
|
|
{
|
|
type: 'autocomplete',
|
|
type: 'autocomplete',
|
|
- key: 'schoolDepartmentName',
|
|
|
|
|
|
+ key: 'schoolDeptId',
|
|
value: null,
|
|
value: null,
|
|
default: null,
|
|
default: null,
|
|
label: '所在院系 *',
|
|
label: '所在院系 *',
|
|
outlined: true,
|
|
outlined: true,
|
|
- itemText: 'departmentTitle',
|
|
|
|
- itemValue: 'departmentTitle',
|
|
|
|
|
|
+ itemText: 'name',
|
|
|
|
+ itemValue: 'id',
|
|
rules: [v => !!v || '请选择所在院系'],
|
|
rules: [v => !!v || '请选择所在院系'],
|
|
|
|
+ change: e => getDepartmentList(e, 'schoolClassId', 2),
|
|
items: []
|
|
items: []
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- type: 'text',
|
|
|
|
- key: 'majorName',
|
|
|
|
- value: '',
|
|
|
|
- default: null,
|
|
|
|
- label: '所学专业 *',
|
|
|
|
|
|
+ type: 'combobox',
|
|
|
|
+ key: 'schoolClassId',
|
|
|
|
+ value: null,
|
|
|
|
+ label: '所在班级 *',
|
|
outlined: true,
|
|
outlined: true,
|
|
- rules: [v => !!v || '请输入所学专业']
|
|
|
|
|
|
+ clearable: true,
|
|
|
|
+ canBeInputted: true,
|
|
|
|
+ itemTextName: 'schoolClassName',
|
|
|
|
+ itemText: 'name',
|
|
|
|
+ itemValue: 'id',
|
|
|
|
+ rules: [v => !!v || '请选择所在班级'],
|
|
|
|
+ items: []
|
|
},
|
|
},
|
|
{
|
|
{
|
|
- type: 'text',
|
|
|
|
- key: 'schoolClassName',
|
|
|
|
- value: '',
|
|
|
|
- default: null,
|
|
|
|
- label: '所在班级 *',
|
|
|
|
|
|
+ type: 'autocomplete',
|
|
|
|
+ key: 'majorId',
|
|
|
|
+ value: null,
|
|
|
|
+ label: '所学专业 *',
|
|
outlined: true,
|
|
outlined: true,
|
|
- rules: [v => !!v || '请填写所在班级']
|
|
|
|
|
|
+ itemText: 'nameCn',
|
|
|
|
+ itemValue: 'id',
|
|
|
|
+ rules: [v => !!v || '请选择所学专业'],
|
|
|
|
+ search: e => getMajorData(e),
|
|
|
|
+ items: []
|
|
},
|
|
},
|
|
{
|
|
{
|
|
type: 'text',
|
|
type: 'text',
|
|
@@ -202,29 +225,27 @@ const items = ref({
|
|
]
|
|
]
|
|
})
|
|
})
|
|
|
|
|
|
-if (import.meta.env.VITE_NODE_ENV === 'production') {
|
|
|
|
- items.value.options = items.value.options.filter(e => e.slotName !== 'analysis')
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// // 学校下拉列表
|
|
|
|
|
|
+// 学校下拉列表
|
|
const getSchoolListData = async () => {
|
|
const getSchoolListData = async () => {
|
|
const item = items.value.options.find(e => e.key === 'schoolId')
|
|
const item = items.value.options.find(e => e.key === 'schoolId')
|
|
if (!item) return
|
|
if (!item) return
|
|
- const { records } = await schoolList({current: 1,size: 9999})
|
|
|
|
- item.items = records || []
|
|
|
|
|
|
+ const data = await getSchoolList()
|
|
|
|
+ item.items = data || []
|
|
}
|
|
}
|
|
getSchoolListData()
|
|
getSchoolListData()
|
|
|
|
|
|
-const getDepartmentList = async (e) => {
|
|
|
|
- const item = items.value.options.find(e => e.key === 'schoolDepartmentName')
|
|
|
|
|
|
+// 根据学校id获取院系、班级列表
|
|
|
|
+const getDepartmentList = async (id, key, type) => {
|
|
|
|
+ const item = items.value.options.find(e => e.key === key)
|
|
if (!item) return
|
|
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)
|
|
|
|
|
|
+
|
|
|
|
+ let params = { type } // type: 0院系|1专业|2班级
|
|
|
|
+ // 查院系用schoolId,查班级用parentId
|
|
|
|
+ if (key === 'schoolDeptId') params.schoolId = id
|
|
|
|
+ else params.parentId = id
|
|
|
|
+
|
|
|
|
+ const data = await getDepartmentListBySchoolId(params)
|
|
|
|
+ item.items = data || []
|
|
}
|
|
}
|
|
|
|
|
|
// 选择文件
|
|
// 选择文件
|
|
@@ -306,7 +327,13 @@ const getQuery = async () => {
|
|
const obj = {}
|
|
const obj = {}
|
|
items.value.options.forEach(e => {
|
|
items.value.options.forEach(e => {
|
|
if (Object.prototype.hasOwnProperty.call(e, 'data')) return obj[e.key] = e.data
|
|
if (Object.prototype.hasOwnProperty.call(e, 'data')) return obj[e.key] = e.data
|
|
- obj[e.key] = e.value === '' ? null : e.value
|
|
|
|
|
|
+ if (e.key === 'schoolClassId') {
|
|
|
|
+ const classObj = e.items.find(k => k[e.itemValue] === e.value)
|
|
|
|
+ if (!classObj) {
|
|
|
|
+ obj[e.key] = null
|
|
|
|
+ obj[e.itemTextName] = e.value
|
|
|
|
+ } else obj[e.key] = e.value
|
|
|
|
+ } else obj[e.key] = e.value === '' ? null : e.value
|
|
})
|
|
})
|
|
if (!obj.avatar) obj.avatar = getUserAvatar(null, obj.sex)
|
|
if (!obj.avatar) obj.avatar = getUserAvatar(null, obj.sex)
|
|
query = Object.assign(query, obj)
|
|
query = Object.assign(query, obj)
|