Skip to content

Commit

Permalink
fix:已修课程,perf
Browse files Browse the repository at this point in the history
:选课表内容居中
  • Loading branch information
labyrinth-ssr committed May 18, 2022
1 parent 11b0588 commit 71eeda8
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 17 deletions.
20 changes: 16 additions & 4 deletions src/components/CourseAudit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,22 @@ data() {
}
else if(val=='AddCourseRequest'){
return 'success'
}
}else return "info"
},
get_request_type(val){
return val.split(/(?=[A-Z])/)[0]
console.log(val)
if (val=='AddCourseSelRequest') {
return "选课申请"
}
else if(val=='AddCourseRequest'){
return "添加课程"
}
if(val=='UpdateCourseRequest'){
return "编辑课程"
}
else if(val=='DeleteCourseRequest'){
return "删除课程"
}
},
get_table(){
this.$axios.get('/requests/courses/admin/view/all')
Expand All @@ -111,7 +123,7 @@ data() {
approve: true
}).then((resp)=>{
console.log(resp)
if(resp.data.isOk){
if(resp.data.ok){
this.get_table()
row.handler_id=this.$store.state.user_id
row.handle_result='approved'
Expand All @@ -129,7 +141,7 @@ data() {
approve: false
}).then((resp)=>{
console.log(resp)
if(resp.data.isOk){
if(resp.data.ok){
this.get_table()
row.handler_id=this.$store.state.user_id
row.handle_result='rejected'
Expand Down
5 changes: 4 additions & 1 deletion src/components/CourseForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,13 @@ export default {
// this.form=this.formdata_prop
this.form.courseTerm=this.format_semester(this.formdata_prop),
this.time_options=this.gen_time_options()
this.format_major()
this.$axios.get("/org/common/getorgs",{})
.then(response => {
console.log(response.data)
this.majorList = response.data
this.format_major()
var res = {}
var res2 = []
response.data.forEach(element => {
Expand Down Expand Up @@ -410,6 +411,8 @@ export default {
if(this.necessary){
if(this.course_multiple){
this.form.acceptMajor = this.form.allowed_major.toString().split(',').map(ele=>{
console.log(this.majorList)
console.log(ele)
let temp= this.majorList.find(item=>item.id ==ele)
let res=[]
res.push(temp.department)
Expand Down
5 changes: 3 additions & 2 deletions src/components/CourseSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ positiveSemester: this.semester
}
return {"background-color": bg_color, "padding": "0px","border": border}
}
return { padding: "0px" };
return { 'padding': "0px" ,'text-align':'center'};
// return {padding:'0px'}
},
// })
Expand Down Expand Up @@ -192,7 +192,7 @@ this.$axios.all([getSemester(), getStage()])
};
console.log(learned_condition)
this.$axios
.post("/course_sel/common/get_course/by_course_sel", learned_condition)
.post("/course_sel/student/get_course_sel/by_student", learned_condition)
.then((resp) => {
this.learned_courses = resp.data;
console.log(this.learned_courses)
Expand Down Expand Up @@ -240,4 +240,5 @@ positiveSemester: this.semester
h4 {
margin: 0px;
}
</style>
2 changes: 1 addition & 1 deletion src/components/CourseTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ data() {
console.log(resp.data)
this.course_sort_f()
})
this.course_sort_f()
// this.course_sort_f()
},
course_sort_f(){
var that = this;
Expand Down
22 changes: 14 additions & 8 deletions src/components/CourseTableSingle.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<el-table :data="row_search()" style="width: 100%" @row-click="row_click" :row-style="row_style"
<el-table :data="row_search()" style="width: 100% " @row-click="row_click" :row-style="row_style"
:cell-style="{padding:'0px'}" highlight-current-row>
<el-table-column prop="id" label="课程代码" width="130" v-if="status=='unselect'">
<template slot="header" slot-scope="scope">
Expand All @@ -23,7 +23,7 @@
</template>
</el-table-column>
<el-table-column prop="teacher_name" label="任课教师" width="100" v-else />
<el-table-column prop="semester" label="修课学期" v-if="status=='learned'" width="130" :filters="semester_list"
<el-table-column prop="this_semester" label="修课学期" v-if="status=='learned'" width="130" :filters="semester_list"
:filter-method="semesterFilterHandler" />
<el-table-column prop="introduction" label="课程介绍" />
<el-table-column prop="class_time" label="上课时间" :filters="classtime_list"
Expand Down Expand Up @@ -161,11 +161,17 @@ export default {
format_semester(data){
var semester_set=new Set();
data.forEach((ele)=>{
semester_set.add(ele.semester)
semester_set.add(ele.this_semester)
})
return Array.from(semester_set,(ele)=>{return {text:ele,value:ele}});
},
canSelect(row){
// if (this.status!='learned') {
this.tableData.forEach((ele)=>{
ele.majors=this.format_major(ele.allowed_major)
})
// }
console.log(this.tableData)
var noconflict=true;
const row_time=row.class_time.split(',');
row_time.forEach((time)=>{
Expand All @@ -185,10 +191,7 @@ export default {
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()) )&&
Expand All @@ -201,7 +204,7 @@ export default {
return row['classroom_id'] === value;
},
semesterFilterHandler(value, row, column) {
return row['semester'] === value;
return row['this_semester'] === value;
},
row_style({row, rowIndex}){
return { height: "0px" };
Expand All @@ -228,5 +231,8 @@ export default {
</script>

<style>
.el-table td.el-table__cell div {
box-sizing: border-box;
}
</style>
2 changes: 1 addition & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
devServer: {
proxy: {
'/api': {
target: 'http://localhost:8000/',
target: 'http://121.36.205.112:8000/',
changeOrigin: true,
pathRewrite: {
'^/api': ''
Expand Down

0 comments on commit 71eeda8

Please sign in to comment.