Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/kexing' into kexing
Browse files Browse the repository at this point in the history
  • Loading branch information
yangfan909 committed May 13, 2022
2 parents 2d9f219 + 658a23a commit d82d576
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 15 deletions.
10 changes: 6 additions & 4 deletions src/components/CourseForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ export default {
},
time_loop:function(){
// this.form.class_time=[['']]
return this.form.point==''?1:parseInt(this.form.classes_per_week)
console.log(this.form)
return this.form.classes_per_week==''?1:parseInt(this.form.classes_per_week);
},
},
Expand All @@ -112,14 +113,15 @@ export default {
this.rawTime= this.format_classtime(newval)
this.form.courseTerm= this.format_semester(newval)
this.form=newval
console.log(this.rawTime)
console.log(this.form)
this.format_major();
},
action_prop:function (newval) {
this.action = newval
if(this.action=='add'){
this.flush()
// this.flush()
}
},
resp_prop:function (newval) {
Expand Down Expand Up @@ -157,7 +159,7 @@ export default {
console.log(resp.data)
})
this.form=this.formdata_prop
// this.form=this.formdata_prop
this.form.courseTerm=this.format_semester(this.formdata_prop),
this.time_options=this.gen_time_options()
this.$axios.get("/org/common/getorgs",{})
Expand Down
36 changes: 30 additions & 6 deletions src/components/CourseSelect.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template>
<div>
<h4>当前选课阶段:{{stage}};学期:{{real_semester}}</h4>
<el-table border :data="selected_table" style="width: 100%" :cell-style="getCellStyle" :row-style="row_style">
<el-table-column prop="sectionId" label="节次" width="80">
</el-table-column>
Expand Down Expand Up @@ -33,11 +34,12 @@ export default {
name: "CourseSelect",
data() {
return {
real_semester:'',
day_num: 7,
can_select_courses: [],
selected_courses: [],
learned_courses: [],
semester: "2022.1",
semester: "",
stage: 1,
studentId: this.$store.state.user_id,
selected_table: [],
Expand All @@ -47,8 +49,23 @@ export default {
};
},
methods: {
next_semester(semester){
var arr=semester.toString().split('.')
console.log(arr)
var pre,su;
if (parseInt(arr[1])==3){
pre=(parseInt(arr[0])+1).toString()
su='0'
}
else{
pre=arr[0]
su=(parseInt(arr[1])+1).toString()
}
console.log(Number(pre+'.'+su))
return Number(pre+'.'+su)
},
updatePage(){
const selected_condition = {
const selected_condition = {
studentId: this.studentId,
semester: this.semester,
status: this.stage-1,//stage1 预选(0)stage2 已选(1)
Expand All @@ -63,7 +80,7 @@ export default {
const can_select_condition = {
getCourseSelRequest: {
studentId: this.studentId
},
},
positiveSemester: this.semester
};
this.$axios
Expand Down Expand Up @@ -146,12 +163,14 @@ positiveSemester: this.semester
}
var getStage=()=> {
return this.$axios.get('/permission/common/choose_course_stage');
return this.$axios.get('/permission/common/check_choose_course');
}
this.$axios.all([getSemester(), getStage()])
.then(this.$axios.spread((semester, stage) => {
this.semester=semester.data;
this.real_semester=semester.data
this.semester=this.next_semester(semester.data);
console.log(this.semester)
this.stage=stage.data;
const selected_condition = {
Expand All @@ -162,6 +181,7 @@ this.$axios.all([getSemester(), getStage()])
this.$axios
.post("/course_sel/common/get_course/by_course_sel", selected_condition)
.then((resp) => {
console.log(resp.data)
this.selected_courses = resp.data;
this.formattable();
Expand All @@ -183,6 +203,7 @@ this.$axios.all([getSemester(), getStage()])
studentId: this.studentId
},
positiveSemester: this.semester
};
this.$axios
.post(
Expand Down Expand Up @@ -212,8 +233,11 @@ positiveSemester: this.semester
};
</script>

<style>
<style scoped>
.subpage{
margin-top: 10px;
}
h4 {
margin: 0px;
}
</style>
29 changes: 24 additions & 5 deletions src/components/CourseTableSingle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default {
course_id:'',
course_name:'',
course_teacher:'',
user_department:'',
user_major:'',
display_data:[],
componentKey:0,
semester_list:this.format_semester(this.tableData)
Expand Down Expand Up @@ -94,9 +94,15 @@ export default {
//多选时间段后,只要部分匹配即可
this.format_time(this.classroom_list,this.tableData)
this.$axios.get('/userinfo/common/getuserinfo').then((resp) => {
this.user_department = resp.data.department
})
// this.user_major = resp.data.major
this.$axios.get('/org/common/getorgs').then((resp2)=>{
console.log(resp2.data.find(x=>x.major==resp.data.major))
this.user_major =resp2.data.find(x=>x.major==resp.data.major).id
console.log(this.user_major)
})
})
},
methods:{
selectCourse(row){
Expand Down Expand Up @@ -167,15 +173,23 @@ export default {
noconflict=false;
}
})
if(row.department!=this.user_department) row.message='专业受限'
var major_limit=false
if (typeof(row.majors)!='undefined'&& row.majors.length!=0&&typeof(row.majors.find(x=>x==this.user_major))=='undefined') {
major_limit=true
}
if(major_limit) row.message='专业受限'
else if(Array.from(this.selected_data,x=>x.number).indexOf(row.number)!=-1) row.message='已选同编号课程'
else if(!noconflict) row.message='时间冲突'
else if(this.stage==2&&row.selected_num>=row.max_student) row.message='人数受限'
return (row.department==this.user_department)&&( Array.from(this.selected_data,x=>x.number).indexOf(row.number)==-1)&&noconflict&&(!(this.stage==2&&row.selected_num>=row.max_student))
return (!major_limit)&&( Array.from(this.selected_data,x=>x.number).indexOf(row.number)==-1)&&noconflict&&(!(this.stage==2&&row.selected_num>=row.max_student))
},
row_search(){
this.tableData.forEach((ele)=>{
ele.majors=this.format_major(ele.allowed_major)
})
console.log(this.tableData)
return this.tableData.filter(data =>( !this.course_id || data.id.toLowerCase().includes(this.course_id.toLowerCase()) )&&
( !this.course_name || data.name.toLowerCase().includes(this.course_name.toLowerCase()) )&&
( !this.course_teacher || data.teacher_name.toLowerCase().includes(this.course_teacher.toLowerCase()) ))
Expand All @@ -202,6 +216,11 @@ export default {
});
console.log(table_hightlight)
this.$emit('click_row',table_hightlight);
},
format_major(majorstr){
if (majorstr=='') return []
console.log(majorstr.split(',').map(x=>parseInt(x)))
return majorstr.split(',').map(x=>parseInt(x))
}
},
props:['status','tableData','selected_data','learned_data','semester','student_id','stage']
Expand Down

0 comments on commit d82d576

Please sign in to comment.