diff --git a/src/views/recruit/recruitstudentsignup/detaiform.vue b/src/views/recruit/recruitstudentsignup/detaiform.vue
index 007379f..4192985 100644
--- a/src/views/recruit/recruitstudentsignup/detaiform.vue
+++ b/src/views/recruit/recruitstudentsignup/detaiform.vue
@@ -649,10 +649,6 @@
-
-
-
-
@@ -662,7 +658,6 @@ import { ElNotification } from 'element-plus'
import { Picture } from '@element-plus/icons-vue'
import { useMessage, useMessageBox } from '/@/hooks/message'
import { getObj, putObj, addObj ,makeCorrectScore} from '/@/api/recruit/recruitstudentsignup'
-import { list as listByGroupId } from '/@/api/recruit/recruitstudentschool'
import { getList } from "/@/api/recruit/recruitstudentplangroup"
import { listByEdu } from "/@/api/recruit/recruitstudentplan"
import { getDictsByTypes } from "/@/api/admin/dict"
@@ -671,7 +666,7 @@ import { areaList, areaSonList } from "/@/api/recruit/recruitstudentschool"
import { list as scoreList } from "/@/api/recruit/recruitstudentplancorrectscoreconfig"
import { queryAllTeacher } from "/@/api/professional/professionaluser/teacherbase"
import { getNationalList } from "/@/api/basic/basicnation"
-import { verifyIdCardAll, verifyAdmissionNumber } from '/@/utils/toolsValidate'
+import { verifyIdCardAll, verifyAdmissionNumber, verifyPhone } from '/@/utils/toolsValidate'
import { AUDIT_STATUS_LIST, getStatusConfig } from '/@/config/global'
const message = useMessage()
@@ -692,7 +687,6 @@ const title = ref("")
const { yes_no_type, sexy, color_discrimination } = useDict('yes_no_type', 'sexy', 'color_discrimination')
const eduList = ref([])
-const imgList = ref([])
const type = ref(null)
const isShow = ref(false)
const isEdit = ref(false)
@@ -712,7 +706,6 @@ const areaAreaList = ref([])
const areaHomeProvinceList = ref([])
const areaHomeCityList = ref([])
const areaHomeAreaList = ref([])
-const dialogUploadVisible = ref(false)
const sevenMajorList = ref([])
const sixMajorList = ref([])
const fiveMajorList = ref([])
@@ -801,7 +794,7 @@ const dataForm = reactive({
householdPicList: [] as string[]
})
-const dataRule = {
+const dataRule = reactive({
groupId: [
{required: true, message: '招生计划不能为空', trigger: 'change'}
],
@@ -870,9 +863,6 @@ const dataRule = {
trigger: 'blur'
}
],
- otherProvince: [
- {required: true, message: '外省不能为空', trigger: 'change'}
- ],
residenceProvince: [
{required: true, message: '户口所在地不能为空', trigger: 'change'}
],
@@ -900,24 +890,19 @@ const dataRule = {
parentName: [
{required: true, message: '家长姓名不能为空', trigger: 'change'}
],
- parentTel_1: [
- {required: true, message: '家长手机不能为空', trigger: 'change'}
- ],
- // wishMajorOne: [
- // {
- // validator: (rule: any, value: any, callback: any) => {
- // // 新增时不需要验证,修改时需要验证
- // if (!dataForm.id) {
- // callback()
- // } else if (!value) {
- // callback(new Error('拟报专业不能为空'))
- // } else {
- // callback()
- // }
- // },
- // trigger: 'change'
- // }
- // ],
+ parentTelOne: [
+ {required: true, message: '家长手机不能为空', trigger: 'change'},
+ {
+ validator: (rule: any, value: any, callback: any) => {
+ if (value && !verifyPhone(value)) {
+ callback(new Error('请输入正确的手机号码'))
+ } else {
+ callback()
+ }
+ },
+ trigger: 'blur'
+ }
+ ],
contactName: [
{required: true, message: '联系人不能为空', trigger: 'change'}
],
@@ -926,8 +911,8 @@ const dataRule = {
],
correctedScore:[
{required: true, message: '折算分不能为空', trigger: 'change'}
- ]
-}
+ ]
+})
// 初始化
const init = (id: string | null, typeParam: number) => {
@@ -1136,12 +1121,6 @@ const changeEducation = () => {
loadMajorListAndGroup()
}
-const handlePicCardPreview = (file: string) => {
- const array = file.split(",")
- imgList.value = array
- dialogUploadVisible.value = true
-}
-
const initData = () => {
// 联系人(教职工)
queryAllTeacher().then((res: any) => {
@@ -1356,7 +1335,6 @@ const updateTuitionByMajorAndEducation = () => {
const dataFormSubmit = (state: string) => {
dataForm.auditStatus = state
let submitTitle = "确认通过该学生的报名申请么?"
-
// 新增模式
if (!dataForm.id) {
submitTitle = "确认保存并提交该学生的报名信息么?"
@@ -1377,62 +1355,65 @@ const dataFormSubmit = (state: string) => {
}
}
- if (dataForm.degreeOfEducation == '1' && (dataForm.score == undefined || dataForm.score == '')) {
- ElNotification.error({
- title: '错误',
- message: '初中生报名请填写成绩'
- })
- return
- }
- if (dataForm.degreeOfEducation == '1' && dataForm.schoolArea == '3' && (dataForm.fullScore == undefined || dataForm.fullScore == '')) {
- ElNotification.error({
- title: '错误',
- message: '外地初中生报名请填写当地总分'
- })
- return
- }
- if (dataForm.degreeOfEducation == '1' && dataForm.schoolArea == '2' && (dataForm.schoolArea == undefined || dataForm.jsOtherCity == undefined) && state == 20) {
- ElNotification.error({
- title: '错误',
- message: '初中生审核请选择学校归属地和所在省市'
- })
- return
- }
- if (dataForm.degreeOfEducation == '1' && dataForm.schoolArea == '3' && (dataForm.schoolArea == undefined || dataForm.otherProvince == undefined) && state == 20) {
- ElNotification.error({
- title: '错误',
- message: '初中生审核请选择学校归属地和所在省市'
- })
- return
+ // 清空相关验证规则
+ dataRule.score = []
+ dataRule.fullScore = []
+ dataRule.jsOtherCity = []
+ dataRule.otherProvince = []
+ if (dataForm.degreeOfEducation == '1') {
+ dataRule.score = [
+ {required: true, message: '初中生报名请填写成绩', trigger: 'change'}
+ ]
+ if(dataForm.schoolArea){
+ if(dataForm.schoolArea == '3'){
+ // 外省外市
+ dataRule.fullScore = [
+ {required: true, message: '外地初中生报名请填写当地总分', trigger: 'change'}
+ ]
+ dataRule.otherProvince = [
+ {required: true, message: '初中生请选择学校归属地和所在省市', trigger: 'change'}
+ ]
+ }
+ if(dataForm.schoolArea == '2'){
+ // 本省外市
+ dataRule.jsOtherCity = [
+ {required: true, message: '初中生请选择学校归属地和所在省市', trigger: 'change'}
+ ]
+ }
+ }
}
- messageBox.confirm(submitTitle).then(() => {
- dataFormRef.value?.validate((valid: boolean) => {
- if (valid) {
- canSubmit.value = false
- if (dataForm.id) {
- // 编辑模式
- putObj(dataForm).then(() => {
- message.success('操作成功')
- visible.value = false
- emit('refreshDataList')
- }).finally(() => {
- canSubmit.value = true
- })
- } else {
- // 新增模式
- addObj(dataForm).then(() => {
- message.success('新增成功')
- visible.value = false
- emit('refreshDataList')
- }).finally(() => {
- canSubmit.value = true
- })
- }
+ // 先进行表单验证,验证成功后再弹出确认框
+ dataFormRef.value?.validate((valid: boolean) => {
+ if (!valid) {
+ return
+ }
+
+ // 表单验证通过,弹出确认框
+ messageBox.confirm(submitTitle).then(() => {
+ canSubmit.value = false
+ if (dataForm.id) {
+ // 编辑模式
+ putObj(dataForm).then(() => {
+ message.success('操作成功')
+ visible.value = false
+ emit('refreshDataList')
+ }).finally(() => {
+ canSubmit.value = true
+ })
+ } else {
+ // 新增模式
+ addObj(dataForm).then(() => {
+ message.success('新增成功')
+ visible.value = false
+ emit('refreshDataList')
+ }).finally(() => {
+ canSubmit.value = true
+ })
}
+ }).catch(() => {
+ // 用户取消
})
- }).catch(() => {
- // 用户取消
})
}