This commit is contained in:
zhoutianchi
2026-01-14 10:52:06 +08:00
parent 8c1f4ec05e
commit d0c8ea0223
140 changed files with 16969 additions and 11469 deletions

View File

@@ -0,0 +1,113 @@
<template>
<el-dialog
:title="!dataForm.id ? '新增' : '修改'"
:close-on-click-modal="false"
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="140px">
<el-form-item label="招生计划" prop="groupId">
<el-select v-model="dataForm.groupId" filterable :disabled="!dataForm.id ? false : true" placeholder="请选择招生计划" size="small" style="width: 100%">
<el-option
v-for="item in planList"
:key="item.id"
:label="item.groupName"
:value="item.id">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="批次名称" prop="batchName">
<el-input v-model="dataForm.batchName" placeholder="批次名称"></el-input>
</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>
</el-dialog>
</template>
<script>
import {addObj, getObj, putObj} from '@/api/recruit/recruitImitateAdjustBatch'
import {list} from "@/api/recruit/recruitstudentplangroup";
export default {
data () {
return {
visible: false,
canSubmit: false,
dataForm: {
id:"",
batchName:"",
groupId:"",
},
disabled:false,
planList: [],
areaList:[],
deptList:[],
dataRule: {
groupId: [
{ required: true, message: '招生计划不能为空', trigger: 'blur' },
],
batchName: [
{ required: true, message: '批次名称不能为空', trigger: 'blur' },
{ min: 1, max: 20, message: '批次名称长度不大于20个字符', trigger: 'blur' }
],
}
}
},
created () {
},
methods: {
init (id) {
this.dataForm.id = id || null;
this.visible = true;
this.canSubmit = true;
this.initData();
this.$nextTick(() => {
this.$refs['dataForm'].resetFields()
if (this.dataForm.id) {
getObj(this.dataForm.id).then(response => {
this.dataForm = response.data.data
})
}else{
this.disabled = true;
}
})
},
initData() {
list().then(data =>{
this.planList = data.data.data
if(!this.dataForm.id){
this.dataForm.groupId=this.planList[0].id
}
});
},
// 表单提交
dataFormSubmit () {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.canSubmit = false;
if (this.dataForm.id) {
putObj(this.dataForm).then(data => {
this.$notify.success('修改成功')
this.visible = false
this.$emit('refreshDataList')
}).catch(() => {
this.canSubmit = true;
});
} else {
addObj(this.dataForm).then(data => {
this.$notify.success('添加成功')
this.visible = false
this.$emit('refreshDataList')
}).catch(() => {
this.canSubmit = true;
});
}
}
})
}
}
}
</script>