Skip to content

Commit

Permalink
fix:教室修改||课程增加保错信息
Browse files Browse the repository at this point in the history
  • Loading branch information
yangfan909 committed May 20, 2022
1 parent 4c8f6c5 commit 1047354
Showing 2 changed files with 37 additions and 18 deletions.
41 changes: 27 additions & 14 deletions src/components/Classtable.vue
Original file line number Diff line number Diff line change
@@ -10,8 +10,9 @@
</el-button>
</el-form-item>
<el-form-item :rule="class_edit_rule">
<el-input v-model="classroom_edit.oldname" placeholder="待修改教室" style="width:110px"></el-input>
<el-input v-model="classroom_edit.newname" placeholder="修改为" style="width:110px"></el-input>
<el-input v-model="classroom_edit.old_name" size="small" placeholder="待修改教室" style="width:110px"></el-input>
<el-input v-model="classroom_edit.new_name" size="small" placeholder="修改为" style="width:110px"></el-input>
<el-input v-model="classroom_edit.new_space" size="small" placeholder="教室容量" type="number" min="10" style="width:110px"></el-input>
<el-button type="primary" @click="edit_classroom">
修改教室
</el-button>
@@ -81,8 +82,9 @@ export default {
space:'',
tabledata:[],
classroom_edit:{
oldname:'',
newname:''
old_name:'',
new_name:'',
new_space:''
},
classroom_delete:'',
class_rule:{
@@ -106,19 +108,25 @@ export default {
]
},
class_edit_rule:{
oldname:[
old_name:[
{
required: true
}
],
newname:[
new_name:[
{
required: true,
validator: (rule, value, callback)=>{
/^\[A-Z]d{4}$/.test(this.classroom_edit.newname)?callback():callback(new Error("教师格式错误!"));
},
trigger: "blur",
}
],
new_space: [
{
required: true,
trigger:"blur"
}
]
}
}
@@ -141,22 +149,27 @@ export default {
methods:{
edit_classroom() {
const formData = new FormData()
formData.append('old_name', this.classroom_edit.oldname)
formData.append('new_name', this.classroom_edit.newname)
formData.append('old_name', this.classroom_edit.old_name)
formData.append('new_name', this.classroom_edit.new_name)
formData.append('new_space', this.classroom_edit.new_space)
this.$axios.put('/classroom/admin/altclassroom', formData).then((resp) => {
if (resp.data) {this.$message({
message: '修改成功',
type: 'success'
});
this.classroom_edit={
oldname:'',
newname:''
}
this.$axios.get('/classroom/common/getclassrooms').then((resp)=>{
this.classroomList=resp.data
})
old_name:'',
new_name:'',
new_space:''
}
this.$axios.get('/classroom/common/getclassrooms').then((resp)=>{
this.classroomList=resp.data
})
}
else this.$message.error('修改失败');
}).catch((error)=>{
console.log(error)
})
},
clear_class(){
14 changes: 10 additions & 4 deletions src/components/CourseTable.vue
Original file line number Diff line number Diff line change
@@ -461,11 +461,17 @@ data() {
if (resp.data.submitted) {
this.$message("添加成功");
} else {
if(!resp.data.stage_suitable){
this.$message("提交失败,请注意选课阶段!");
}else {
let text='提交失败!'
if(resp.data.courseInfoFormat.teacher_id==false){
text+='教师不存在。'
}else if(resp.data.courseInfoFormat.teacher_feasible==false){
text+='教师课程冲突!'
}
if(resp.data.courseInfoFormat.semester==false){
text+='请检查开课学期填写!'
}
this.$message("提交失败,请注意表单内容!")
}
}
})
},

0 comments on commit 1047354

Please sign in to comment.