a
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
<el-dialog
|
||||
:title="!dataForm.id ? '新增' : '修改'"
|
||||
:close-on-click-modal="false"
|
||||
:visible.sync="visible"
|
||||
v-model="visible"
|
||||
append-to-body
|
||||
>
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="140px">
|
||||
<el-form :model="dataForm" :rules="dataRule" ref="dataFormRef" @keyup.enter="dataFormSubmit" label-width="140px">
|
||||
|
||||
<el-form-item label="模拟学生" prop="serialNumber">
|
||||
<el-select
|
||||
@@ -15,7 +15,7 @@
|
||||
remote
|
||||
clearable
|
||||
reserve-keyword
|
||||
:disabled="!dataForm.id ? false : true" placeholder="请选择唯一号" size="small" style="width: 100%"
|
||||
:disabled="!!dataForm.id" placeholder="请选择唯一号" size="small" style="width: 100%"
|
||||
:remote-method="remoteTeacherByQuery"
|
||||
>
|
||||
<el-option
|
||||
@@ -27,7 +27,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="来源" prop="isOut">
|
||||
<el-select v-model="dataForm.isOut" filterable disabled placeholder="请选择来源" size="small" style="width: 100%" >
|
||||
<el-select v-model="dataForm.isOut" filterable disabled placeholder="请选择来源" size="small" style="width: 100%" >
|
||||
<el-option
|
||||
v-for="item in isOutList"
|
||||
:key="item.value"
|
||||
@@ -37,7 +37,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="拟报专业1" prop="wishMajorOne">
|
||||
<el-select v-model="dataForm.wishMajorOne" filterable placeholder="请选择拟报专业1" size="small" style="width: 100%">
|
||||
<el-select v-model="dataForm.wishMajorOne" filterable placeholder="请选择拟报专业1" size="small" style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in planMajorList"
|
||||
:key="item.zydm"
|
||||
@@ -49,7 +49,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="拟报专业2" prop="wishMajorTwo">
|
||||
<el-select v-model="dataForm.wishMajorTwo" filterable placeholder="请选择拟报专业2" size="small" style="width: 100%">
|
||||
<el-select v-model="dataForm.wishMajorTwo" filterable placeholder="请选择拟报专业2" size="small" style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in planMajorList"
|
||||
:key="item.zydm"
|
||||
@@ -61,7 +61,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="拟报专业3" prop="wishMajorThree">
|
||||
<el-select v-model="dataForm.wishMajorThree" filterable placeholder="请选择拟报专业3" size="small" style="width: 100%">
|
||||
<el-select v-model="dataForm.wishMajorThree" filterable placeholder="请选择拟报专业3" size="small" style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in planMajorList"
|
||||
:key="item.zydm"
|
||||
@@ -73,7 +73,7 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="录取专业" prop="confirmedMajor">
|
||||
<el-select v-model="dataForm.confirmedMajor" filterable placeholder="请选择录取专业" size="small" style="width: 100%">
|
||||
<el-select v-model="dataForm.confirmedMajor" filterable placeholder="请选择录取专业" size="small" style="width: 100%">
|
||||
<el-option
|
||||
v-for="item in planMajorEduList"
|
||||
:key="item.zydm"
|
||||
@@ -83,181 +83,213 @@
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
</el-form>
|
||||
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit()" v-if="canSubmit">确定</el-button>
|
||||
</span>
|
||||
<template #footer>
|
||||
<div class="dialog-footer">
|
||||
<el-button @click="visible = false">取消</el-button>
|
||||
<el-button type="primary" @click="dataFormSubmit" v-if="canSubmit">确定</el-button>
|
||||
</div>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {addMNObj, getMNObj, putMNObj} from '@/api/recruit/recruitImitateAdjustBatch'
|
||||
import {getList} from "@/api/recruit/recruitstudentsignup";
|
||||
import {list as planMajor, listByEdu} from "@/api/recruit/recruitplanmajor";
|
||||
import {queryTeacherStationInfo} from "@/api/professional/teacherbase";
|
||||
<script setup lang="ts">
|
||||
import { ref, reactive, nextTick } from 'vue'
|
||||
import { ElNotification } from 'element-plus'
|
||||
import { addMNObj, getMNObj, putMNObj } from '@/api/recruit/recruitImitateAdjustBatch'
|
||||
import { getList } from "@/api/recruit/recruitstudentsignup"
|
||||
import { list as planMajor, listByEdu } from "@/api/recruit/recruitplanmajor"
|
||||
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
visible: false,
|
||||
canSubmit: false,
|
||||
dataForm: {
|
||||
id:"",
|
||||
serialNumber:"",
|
||||
groupId:"",
|
||||
wishMajorOne:'',
|
||||
wishMajorTwo:'',
|
||||
wishMajorThree:'',
|
||||
confirmedMajor:'',
|
||||
isOut:'',
|
||||
degreeOfEducation:"",
|
||||
name:"",
|
||||
gender:"",
|
||||
idNumber:"",
|
||||
},
|
||||
disabled:false,
|
||||
serialNumberList:[],
|
||||
planMajorEduList:[],
|
||||
isOutList:[{label:"学校",value:"0"},{label:"市平台",value:"1"}],
|
||||
planMajorList:[],
|
||||
dataRule: {
|
||||
serialNumber: [
|
||||
{ required: true, message: '模拟学生不能为空', trigger: 'blur' },
|
||||
],
|
||||
confirmedMajor: [
|
||||
{ required: true, message: '录取专业不能为空', trigger: 'blur' },
|
||||
],
|
||||
}
|
||||
// Emits
|
||||
const emit = defineEmits<{
|
||||
(e: 'refreshDataList'): void
|
||||
}>()
|
||||
|
||||
// 表单引用
|
||||
const dataFormRef = ref()
|
||||
|
||||
// 响应式数据
|
||||
const visible = ref(false)
|
||||
const canSubmit = ref(false)
|
||||
const disabled = ref(false)
|
||||
const serialNumberList = ref<any[]>([])
|
||||
const planMajorEduList = ref<any[]>([])
|
||||
const planMajorList = ref<any[]>([])
|
||||
|
||||
const isOutList = [
|
||||
{ label: "学校", value: "0" },
|
||||
{ label: "市平台", value: "1" }
|
||||
]
|
||||
|
||||
const dataForm = reactive({
|
||||
id: "",
|
||||
serialNumber: "",
|
||||
groupId: "",
|
||||
batchNo: "",
|
||||
wishMajorOne: '',
|
||||
wishMajorTwo: '',
|
||||
wishMajorThree: '',
|
||||
confirmedMajor: '',
|
||||
isOut: '',
|
||||
degreeOfEducation: "",
|
||||
name: "",
|
||||
gender: "",
|
||||
idNumber: "",
|
||||
oldConfirmedMajor: ""
|
||||
})
|
||||
|
||||
const dataRule = {
|
||||
serialNumber: [
|
||||
{ required: true, message: '模拟学生不能为空', trigger: 'blur' },
|
||||
],
|
||||
confirmedMajor: [
|
||||
{ required: true, message: '录取专业不能为空', trigger: 'blur' },
|
||||
],
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断拟报专业是否已经占用,占用不可选
|
||||
*/
|
||||
const isDisable = (zydm: string) => {
|
||||
if (zydm == dataForm.wishMajorOne
|
||||
|| zydm == dataForm.wishMajorTwo
|
||||
|| zydm == dataForm.wishMajorThree
|
||||
) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
// 初始化数据
|
||||
const initData = () => {
|
||||
planMajorList.value = []
|
||||
serialNumberList.value = []
|
||||
planMajor({ groupId: dataForm.groupId }).then((data: any) => {
|
||||
planMajorList.value = data.data
|
||||
})
|
||||
}
|
||||
|
||||
// 远程搜索学生
|
||||
const remoteTeacherByQuery = (query: string) => {
|
||||
serialNumberList.value = []
|
||||
if (query !== '') {
|
||||
setTimeout(() => {
|
||||
getList({ groupId: dataForm.groupId, name: query }).then((response: any) => {
|
||||
serialNumberList.value = response.data
|
||||
})
|
||||
}, 200)
|
||||
}
|
||||
}
|
||||
|
||||
// 学生选择变化
|
||||
const changeStu = () => {
|
||||
planMajorEduList.value = []
|
||||
dataForm.wishMajorOne = ''
|
||||
dataForm.wishMajorTwo = ''
|
||||
dataForm.wishMajorThree = ''
|
||||
dataForm.degreeOfEducation = ""
|
||||
dataForm.oldConfirmedMajor = ""
|
||||
dataForm.name = ""
|
||||
dataForm.idNumber = ""
|
||||
dataForm.confirmedMajor = ""
|
||||
dataForm.gender = ""
|
||||
dataForm.isOut = ""
|
||||
serialNumberList.value.forEach(e => {
|
||||
if (e.serialNumber == dataForm.serialNumber) {
|
||||
dataForm.wishMajorOne = e.wishMajorOne
|
||||
dataForm.wishMajorTwo = e.wishMajorTwo
|
||||
dataForm.wishMajorThree = e.wishMajorThree
|
||||
dataForm.degreeOfEducation = e.degreeOfEducation
|
||||
dataForm.name = e.name
|
||||
dataForm.idNumber = e.idNumber
|
||||
dataForm.gender = e.gender
|
||||
dataForm.isOut = e.isOut
|
||||
dataForm.confirmedMajor = e.confirmedMajor
|
||||
dataForm.oldConfirmedMajor = e.confirmedMajor
|
||||
getMajorListByEdu()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 根据学历获取专业列表
|
||||
const getMajorListByEdu = () => {
|
||||
planMajorEduList.value = []
|
||||
listByEdu({ groupId: dataForm.groupId, degreeOfEducation: dataForm.degreeOfEducation }).then((res: any) => {
|
||||
planMajorEduList.value = res.data
|
||||
})
|
||||
}
|
||||
|
||||
// 表单提交
|
||||
const dataFormSubmit = () => {
|
||||
dataFormRef.value?.validate((valid: boolean) => {
|
||||
if (valid) {
|
||||
if (dataForm.oldConfirmedMajor == dataForm.confirmedMajor) {
|
||||
ElNotification.error({
|
||||
title: '错误',
|
||||
message: '模拟调整的专业不能和原录取专业相同,请检查'
|
||||
})
|
||||
return
|
||||
}
|
||||
},
|
||||
created () {
|
||||
},
|
||||
methods: {
|
||||
init (id,groupId,batchNo) {
|
||||
this.dataForm.id = id || null;
|
||||
this.dataForm.batchNo = batchNo;
|
||||
this.dataForm.groupId= groupId;
|
||||
this.visible = true;
|
||||
this.canSubmit = true;
|
||||
this.planMajorEduList = [];
|
||||
this.initData();
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].resetFields()
|
||||
if (this.dataForm.id) {
|
||||
getMNObj(this.dataForm.id).then(response => {
|
||||
this.dataForm = response.data.data
|
||||
this.getMajorListByEdu();
|
||||
})
|
||||
}else{
|
||||
this.disabled = true;
|
||||
}
|
||||
canSubmit.value = false
|
||||
if (dataForm.id) {
|
||||
putMNObj(dataForm).then(() => {
|
||||
ElNotification.success({
|
||||
title: '成功',
|
||||
message: '修改成功'
|
||||
})
|
||||
visible.value = false
|
||||
emit('refreshDataList')
|
||||
}).catch(() => {
|
||||
canSubmit.value = true
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 判断拟报专业是否已经占用,占用不可选
|
||||
* @param notBedNo
|
||||
* @returns {boolean}
|
||||
*/
|
||||
isDisable(zydm){
|
||||
if(zydm == this.dataForm.wishMajorOne
|
||||
|| zydm == this.dataForm.wishMajorTwo
|
||||
|| zydm == this.dataForm.wishMajorThree
|
||||
){
|
||||
return true
|
||||
}else {
|
||||
return false
|
||||
}
|
||||
},
|
||||
initData() {
|
||||
this.planMajorList=[];
|
||||
this.serialNumberList=[];
|
||||
planMajor({groupId: this.dataForm.groupId}).then(data =>{
|
||||
this.planMajorList = data.data.data;
|
||||
});
|
||||
// getList({groupId:this.dataForm.groupId}).then(data =>{
|
||||
// this.serialNumberList = data.data.data
|
||||
// });
|
||||
},
|
||||
remoteTeacherByQuery(query) {
|
||||
this.serialNumberList = []
|
||||
if (query !== '') {
|
||||
setTimeout(() => {
|
||||
getList({groupId:this.dataForm.groupId,name:query}).then(response => {
|
||||
this.serialNumberList = response.data.data
|
||||
})
|
||||
}, 200);
|
||||
}
|
||||
},
|
||||
changeStu(){
|
||||
let _this = this;
|
||||
_this.planMajorEduList = [];
|
||||
_this.dataForm.wishMajorOne='';
|
||||
_this.dataForm.wishMajorTwo='';
|
||||
_this.dataForm.wishMajorThree='';
|
||||
_this.dataForm.degreeOfEducation = "";
|
||||
_this.dataForm.oldConfirmedMajor = "";
|
||||
_this.dataForm.name = "";
|
||||
_this.dataForm.idNumber = "";
|
||||
_this.dataForm.confirmedMajor = "";
|
||||
_this.dataForm.gender = "";
|
||||
_this.dataForm.isOut = "";
|
||||
console.log(_this.dataForm);
|
||||
_this.serialNumberList.forEach(e=>{
|
||||
if(e.serialNumber == _this.dataForm.serialNumber){
|
||||
_this.dataForm.wishMajorOne = e.wishMajorOne;
|
||||
_this.dataForm.wishMajorTwo = e.wishMajorTwo;
|
||||
_this.dataForm.wishMajorThree = e.wishMajorThree;
|
||||
_this.dataForm.degreeOfEducation = e.degreeOfEducation;
|
||||
_this.dataForm.name = e.name;
|
||||
_this.dataForm.idNumber = e.idNumber;
|
||||
|
||||
_this.dataForm.gender = e.gender;
|
||||
_this.dataForm.isOut = e.isOut;
|
||||
_this.dataForm.confirmedMajor = e.confirmedMajor;
|
||||
_this.dataForm.oldConfirmedMajor = e.confirmedMajor;
|
||||
_this.getMajorListByEdu();
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
getMajorListByEdu(){
|
||||
this.planMajorEduList=[];
|
||||
listByEdu({groupId: this.dataForm.groupId,degreeOfEducation:this.dataForm.degreeOfEducation}).then(res=> {
|
||||
this.planMajorEduList = res.data.data;
|
||||
});
|
||||
},
|
||||
// 表单提交
|
||||
dataFormSubmit () {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
if(this.dataForm.oldConfirmedMajor == this.dataForm.confirmedMajor){
|
||||
this.$notify.error('模拟调整的专业不能和原录取专业相同,请检查');
|
||||
return
|
||||
}
|
||||
this.canSubmit = false;
|
||||
if (this.dataForm.id) {
|
||||
putMNObj(this.dataForm).then(data => {
|
||||
this.$notify.success('修改成功')
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}).catch(() => {
|
||||
this.canSubmit = true;
|
||||
});
|
||||
} else {
|
||||
addMNObj(this.dataForm).then(data => {
|
||||
this.$notify.success('添加成功')
|
||||
this.visible = false
|
||||
this.$emit('refreshDataList')
|
||||
}).catch(() => {
|
||||
this.canSubmit = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
addMNObj(dataForm).then(() => {
|
||||
ElNotification.success({
|
||||
title: '成功',
|
||||
message: '添加成功'
|
||||
})
|
||||
visible.value = false
|
||||
emit('refreshDataList')
|
||||
}).catch(() => {
|
||||
canSubmit.value = true
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 初始化方法
|
||||
const init = (id: string | null, groupId: string, batchNo: string) => {
|
||||
dataForm.id = id || ""
|
||||
dataForm.batchNo = batchNo
|
||||
dataForm.groupId = groupId
|
||||
visible.value = true
|
||||
canSubmit.value = true
|
||||
planMajorEduList.value = []
|
||||
initData()
|
||||
nextTick(() => {
|
||||
dataFormRef.value?.resetFields()
|
||||
if (dataForm.id) {
|
||||
getMNObj(dataForm.id).then((response: any) => {
|
||||
Object.assign(dataForm, response.data)
|
||||
getMajorListByEdu()
|
||||
})
|
||||
} else {
|
||||
disabled.value = true
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// 暴露方法给父组件
|
||||
defineExpose({
|
||||
init
|
||||
})
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.dialog-footer {
|
||||
text-align: right;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user