|  | @@ -38,16 +38,17 @@
 | 
											
												
													
														|  |            <uni-datetime-picker type="date" return-type="timestamp" v-model="formData.birthday" />
 |  |            <uni-datetime-picker type="date" return-type="timestamp" v-model="formData.birthday" />
 | 
											
												
													
														|  |          </uni-forms-item>
 |  |          </uni-forms-item>
 | 
											
												
													
														|  |          <uni-forms-item name="schoolId" label="就读学校" required>
 |  |          <uni-forms-item name="schoolId" label="就读学校" required>
 | 
											
												
													
														|  | -          <uni-data-picker v-model="formData.schoolId" :localdata="schools" :clear-icon="false" popup-title="请选择就读学校" @change="getDepartmentList" :map="{ text: 'schoolName', value: 'schoolId' }"></uni-data-picker>
 |  | 
 | 
											
												
													
														|  | 
 |  | +          <uni-data-picker v-model="formData.schoolId" :localdata="selects?.schools" :clear-icon="false" popup-title="请选择就读学校" @change="getSelectData(0)" :map="{ text: 'name', value: 'schoolId' }"></uni-data-picker>
 | 
											
												
													
														|  |          </uni-forms-item>
 |  |          </uni-forms-item>
 | 
											
												
													
														|  | -        <uni-forms-item name="schoolDepartmentName" label="所在院系" required>
 |  | 
 | 
											
												
													
														|  | -          <uni-data-picker v-model="formData.schoolDepartmentName" :localdata="schoolDepartmentList" :clear-icon="false" popup-title="请选择所在院系" :map="{ text: 'departmentTitle', value: 'schoolDepartmentId' }"></uni-data-picker>
 |  | 
 | 
											
												
													
														|  | 
 |  | +        <uni-forms-item name="schoolDeptId" label="所在院系" required>
 | 
											
												
													
														|  | 
 |  | +          <uni-data-picker v-model="formData.schoolDeptId" :localdata="selects?.dept" :clear-icon="false" popup-title="请选择所在院系" @change="getSelectData(2)" :map="{ text: 'name', value: 'id' }"></uni-data-picker>
 | 
											
												
													
														|  |          </uni-forms-item>
 |  |          </uni-forms-item>
 | 
											
												
													
														|  | -        <uni-forms-item name="majorName" label="所学专业" required>
 |  | 
 | 
											
												
													
														|  | -          <uni-easyinput placeholder="请输入所学专业" v-model="formData.majorName" :inputBorder="false" type="text"></uni-easyinput>
 |  | 
 | 
											
												
													
														|  | 
 |  | +        <uni-forms-item name="majorId" label="所学专业" required>
 | 
											
												
													
														|  | 
 |  | +          <uni-data-picker v-model="formData.majorId" :localdata="selects?.major" :clear-icon="false" popup-title="请选择所学专业" @change="getSelectData(2)" :map="{ text: 'nameCn', value: 'id' }"></uni-data-picker>
 | 
											
												
													
														|  |          </uni-forms-item>
 |  |          </uni-forms-item>
 | 
											
												
													
														|  | -        <uni-forms-item name="schoolClassName" label="所在班级" required>
 |  | 
 | 
											
												
													
														|  | -          <uni-easyinput placeholder="请填写所在班级" v-model="formData.schoolClassName" :inputBorder="false" type="text"></uni-easyinput>
 |  | 
 | 
											
												
													
														|  | 
 |  | +        <uni-forms-item name="schoolClassId" label="所在班级" required>
 | 
											
												
													
														|  | 
 |  | +          <searchComBox ref="schoolClassIdRef" v-model="formData.schoolClassId" :candidates="classList" itemTextName='schoolClassName' itemValueName='schoolClassId' labelKey='name' valueKey='id' placeholder="请选择所在班级"></searchComBox>
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |          </uni-forms-item>
 |  |          </uni-forms-item>
 | 
											
												
													
														|  |          <uni-forms-item name="studentNo" label="学号" required>
 |  |          <uni-forms-item name="studentNo" label="学号" required>
 | 
											
												
													
														|  |            <uni-easyinput placeholder="请填写学号" v-model="formData.studentNo" :inputBorder="false" type="text"></uni-easyinput>
 |  |            <uni-easyinput placeholder="请填写学号" v-model="formData.studentNo" :inputBorder="false" type="text"></uni-easyinput>
 | 
											
										
											
												
													
														|  | @@ -80,7 +81,8 @@ import { saveStudentSimpleInfo } from '@/api/user'
 | 
											
												
													
														|  |  import { showAuthModal } from '@/hooks/useModal'
 |  |  import { showAuthModal } from '@/hooks/useModal'
 | 
											
												
													
														|  |  import { userStore } from '@/store/user'; const useUserStore = userStore()
 |  |  import { userStore } from '@/store/user'; const useUserStore = userStore()
 | 
											
												
													
														|  |  import { uploadFile } from '@/api/file'
 |  |  import { uploadFile } from '@/api/file'
 | 
											
												
													
														|  | -import { schoolList, departmentList } from '@/api/pickerData'
 |  | 
 | 
											
												
													
														|  | 
 |  | +import { getSchoolList, getDepartmentListBySchoolId, getMajorList } from '@/api/student'
 | 
											
												
													
														|  | 
 |  | +import searchComBox from '@/components/searchCombox'
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  const baseInfoRef = ref()
 |  |  const baseInfoRef = ref()
 | 
											
												
													
														|  |  const formData = ref({ // 必填项目
 |  |  const formData = ref({ // 必填项目
 | 
											
										
											
												
													
														|  | @@ -90,10 +92,12 @@ const formData = ref({ // 必填项目
 | 
											
												
													
														|  |    phone: null,
 |  |    phone: null,
 | 
											
												
													
														|  |    birthday: '1990-01-01',
 |  |    birthday: '1990-01-01',
 | 
											
												
													
														|  |    schoolId: null,
 |  |    schoolId: null,
 | 
											
												
													
														|  | -  schoolDepartmentName: null,
 |  | 
 | 
											
												
													
														|  | -  majorName: null,
 |  | 
 | 
											
												
													
														|  | 
 |  | +  schoolDeptId: null,
 | 
											
												
													
														|  | 
 |  | +  majorId: null,
 | 
											
												
													
														|  | 
 |  | +  schoolClassId: null,
 | 
											
												
													
														|  |    schoolClassName: null,
 |  |    schoolClassName: null,
 | 
											
												
													
														|  |    studentNo: null,
 |  |    studentNo: null,
 | 
											
												
													
														|  | 
 |  | +  idCardNo: null,
 | 
											
												
													
														|  |    emergencyContactName: null,
 |  |    emergencyContactName: null,
 | 
											
												
													
														|  |    emergencyContactPhone: null,
 |  |    emergencyContactPhone: null,
 | 
											
												
													
														|  |  })
 |  |  })
 | 
											
										
											
												
													
														|  | @@ -110,29 +114,55 @@ onMounted(() => {
 | 
											
												
													
														|  |    })
 |  |    })
 | 
											
												
													
														|  |  })
 |  |  })
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -const schools = ref([])
 |  | 
 | 
											
												
													
														|  | -// // 学校下拉列表
 |  | 
 | 
											
												
													
														|  | -const getSchoolListData = async () => {
 |  | 
 | 
											
												
													
														|  | -  const res = await schoolList({current: 1, size: 9999})
 |  | 
 | 
											
												
													
														|  | -  schools.value = res?.data?.records?.length ? res.data.records : []
 |  | 
 | 
											
												
													
														|  | 
 |  | +// // 下拉列表 
 | 
											
												
													
														|  | 
 |  | +const selects = ref({})
 | 
											
												
													
														|  | 
 |  | +const classList = ref([])
 | 
											
												
													
														|  | 
 |  | +const getSelectData = async (type = 'default', init = false) => { // type: 0院系|1专业|2班级
 | 
											
												
													
														|  | 
 |  | +  const params = { ...(type !== 'default' && { type }) }
 | 
											
												
													
														|  | 
 |  | +  // 查院系用 schoolId 查班级用 parentId
 | 
											
												
													
														|  | 
 |  | +  if (type === 0) {
 | 
											
												
													
														|  | 
 |  | +    if (!formData.value?.schoolId) return
 | 
											
												
													
														|  | 
 |  | +    params.schoolId = formData.value.schoolId
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +  if (type === 2) {
 | 
											
												
													
														|  | 
 |  | +    if (!formData.value?.schoolId && !formData.value?.schoolDeptId) return
 | 
											
												
													
														|  | 
 |  | +    if (formData.value?.schoolId) params.schoolId = formData.value.schoolId
 | 
											
												
													
														|  | 
 |  | +    if (formData.value?.schoolDeptId) params.parentId = formData.value.schoolDeptId
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +  const api = {
 | 
											
												
													
														|  | 
 |  | +    default: getSchoolList,
 | 
											
												
													
														|  | 
 |  | +    0: getDepartmentListBySchoolId,
 | 
											
												
													
														|  | 
 |  | +    1: getMajorList,
 | 
											
												
													
														|  | 
 |  | +    2: getDepartmentListBySchoolId,
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +  const res = await api[type](params)
 | 
											
												
													
														|  | 
 |  | +  if (type === 'default') {
 | 
											
												
													
														|  | 
 |  | +    selects.value.schools = res?.data?.length ? res.data : []
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +  if (type === 0) {
 | 
											
												
													
														|  | 
 |  | +    if (!init) {
 | 
											
												
													
														|  | 
 |  | +      formData.value.schoolDeptId = null
 | 
											
												
													
														|  | 
 |  | +      formData.value.schoolClassId = null
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    selects.value.dept = res?.data?.length ? res.data : []
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +  if (type === 1) {
 | 
											
												
													
														|  | 
 |  | +    selects.value.major = res?.data?.length ? res.data : []
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +  if (type === 2) {
 | 
											
												
													
														|  | 
 |  | +    if (!init) formData.value.schoolClassId = null
 | 
											
												
													
														|  | 
 |  | +    classList.value = res?.data?.length ? res.data : []
 | 
											
												
													
														|  | 
 |  | +    schoolClassIdRef.value && schoolClassIdRef.value.setLabel()
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  | -getSchoolListData()
 |  | 
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | -const schoolDepartmentList = ref([])
 |  | 
 | 
											
												
													
														|  | -const getDepartmentList = async (event) => {
 |  | 
 | 
											
												
													
														|  | -  const e = event?.detail?.value?.length ? event.detail.value[0].value : ''
 |  | 
 | 
											
												
													
														|  | -  if (!e) return
 |  | 
 | 
											
												
													
														|  | -  
 |  | 
 | 
											
												
													
														|  | -  const query = {
 |  | 
 | 
											
												
													
														|  | -    page: { size: 9999,	current: 1	},
 |  | 
 | 
											
												
													
														|  | -    entity: { schoolId: e }
 |  | 
 | 
											
												
													
														|  | -  }
 |  | 
 | 
											
												
													
														|  | -  schoolDepartmentList.value = []
 |  | 
 | 
											
												
													
														|  | -  formData.value.schoolDepartmentName = null
 |  | 
 | 
											
												
													
														|  | -  const res = await departmentList(query)
 |  | 
 | 
											
												
													
														|  | -  const list = res?.data?.records?.length ? res.data.records : []
 |  | 
 | 
											
												
													
														|  | -  schoolDepartmentList.value = list.map(e => e.entity)
 |  | 
 | 
											
												
													
														|  | 
 |  | +const getSelection = async () => {
 | 
											
												
													
														|  | 
 |  | +  await getSelectData('default', true)
 | 
											
												
													
														|  | 
 |  | +  await getSelectData(0, true)
 | 
											
												
													
														|  | 
 |  | +  await getSelectData(1, true)
 | 
											
												
													
														|  | 
 |  | +  await getSelectData(2, true)
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  | 
 |  | +getSelection()
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  const formRules = {
 |  |  const formRules = {
 | 
											
												
													
														|  |  	avatar:{
 |  |  	avatar:{
 | 
											
										
											
												
													
														|  | @@ -147,25 +177,25 @@ const formRules = {
 | 
											
												
													
														|  |    idCardNo: isValidIdCard18,
 |  |    idCardNo: isValidIdCard18,
 | 
											
												
													
														|  |    phone: mobile,
 |  |    phone: mobile,
 | 
											
												
													
														|  |    birthday:{
 |  |    birthday:{
 | 
											
												
													
														|  | -		rules: [{required: true, errorMessage: '请选择就读学校' }]
 |  | 
 | 
											
												
													
														|  | 
 |  | +		rules: [{required: true, errorMessage: '请选择出生日期' }]
 | 
											
												
													
														|  |  	},
 |  |  	},
 | 
											
												
													
														|  |    schoolId:{
 |  |    schoolId:{
 | 
											
												
													
														|  | 
 |  | +		rules: [{required: true, errorMessage: '请选择就读学校' }]
 | 
											
												
													
														|  | 
 |  | +	},
 | 
											
												
													
														|  | 
 |  | +  schoolDeptId:{
 | 
											
												
													
														|  |  		rules: [{required: true, errorMessage: '请选择所在院系' }]
 |  |  		rules: [{required: true, errorMessage: '请选择所在院系' }]
 | 
											
												
													
														|  |  	},
 |  |  	},
 | 
											
												
													
														|  | -  schoolDepartmentName:{
 |  | 
 | 
											
												
													
														|  | -		rules: [{required: true, errorMessage: '请输入所学专业' }]
 |  | 
 | 
											
												
													
														|  | 
 |  | +  majorId: {
 | 
											
												
													
														|  | 
 |  | +		rules: [{required: true, errorMessage: '请填写所在专业' }]
 | 
											
												
													
														|  |  	},
 |  |  	},
 | 
											
												
													
														|  | -  majorName: {
 |  | 
 | 
											
												
													
														|  | 
 |  | +  schoolClassId: {
 | 
											
												
													
														|  |  		rules: [{required: true, errorMessage: '请填写所在班级' }]
 |  |  		rules: [{required: true, errorMessage: '请填写所在班级' }]
 | 
											
												
													
														|  |  	},
 |  |  	},
 | 
											
												
													
														|  | -  schoolClassName: {
 |  | 
 | 
											
												
													
														|  | -		rules: [{required: true, errorMessage: '请填写学号' }]
 |  | 
 | 
											
												
													
														|  | -	},
 |  | 
 | 
											
												
													
														|  |    studentNo: {
 |  |    studentNo: {
 | 
											
												
													
														|  | -		rules: [{required: true, errorMessage: '请填写紧急联系人姓名' }]
 |  | 
 | 
											
												
													
														|  | 
 |  | +		rules: [{required: true, errorMessage: '请填写学号' }]
 | 
											
												
													
														|  |  	},
 |  |  	},
 | 
											
												
													
														|  |    emergencyContactName: {
 |  |    emergencyContactName: {
 | 
											
												
													
														|  | -		rules: [{required: true, errorMessage: '请填写紧急联系人手机号' }]
 |  | 
 | 
											
												
													
														|  | 
 |  | +		rules: [{required: true, errorMessage: '请填写紧急联系人姓名' }]
 | 
											
												
													
														|  |  	},
 |  |  	},
 | 
											
												
													
														|  |    emergencyContactPhone: mobile,
 |  |    emergencyContactPhone: mobile,
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
										
											
												
													
														|  | @@ -220,11 +250,21 @@ const uploadPhotos = () => {
 | 
											
												
													
														|  |    })
 |  |    })
 | 
											
												
													
														|  |  }
 |  |  }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  | 
 |  | +const schoolClassIdRef = ref()
 | 
											
												
													
														|  |  const submit = async () => {
 |  |  const submit = async () => {
 | 
											
												
													
														|  |    const validate = await unref(baseInfoRef).validate()
 |  |    const validate = await unref(baseInfoRef).validate()
 | 
											
												
													
														|  |    if (!validate) return uni.showToast({ title: '请将信息补充完整', icon: 'none' })
 |  |    if (!validate) return uni.showToast({ title: '请将信息补充完整', icon: 'none' })
 | 
											
												
													
														|  | 
 |  | +  
 | 
											
												
													
														|  | 
 |  | +  let params = {...formData.value}
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +  const schoolClassInput = schoolClassIdRef.value?.getOnInputValue()
 | 
											
												
													
														|  | 
 |  | +  const schoolClassObj = schoolClassIdRef.value?.getOnInputValueObj()
 | 
											
												
													
														|  | 
 |  | +  if (schoolClassInput === params.schoolClassId) {
 | 
											
												
													
														|  | 
 |  | +    params = {...params, ...schoolClassObj}
 | 
											
												
													
														|  | 
 |  | +  }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |    try {
 |  |    try {
 | 
											
												
													
														|  | -    await saveStudentSimpleInfo(formData.value)
 |  | 
 | 
											
												
													
														|  | 
 |  | +    await saveStudentSimpleInfo(params)
 | 
											
												
													
														|  |      uni.showToast({ title: '保存成功', icon: 'none' })
 |  |      uni.showToast({ title: '保存成功', icon: 'none' })
 | 
											
												
													
														|  |      await useUserStore.getInfo()
 |  |      await useUserStore.getInfo()
 | 
											
												
													
														|  |    } catch (err) {
 |  |    } catch (err) {
 |