Skip to content

Commit

Permalink
fix:学生选课申请查看
Browse files Browse the repository at this point in the history
  • Loading branch information
yangfan909 committed May 19, 2022
1 parent 0849851 commit 4c8f6c5
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 24 deletions.
99 changes: 76 additions & 23 deletions src/components/ApplyFromStu.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div v-if ="applyPermit">
<el-form :v-model="form" v-if ='amIStu' style="text-align: left" ref="form" :rules="rules"
<el-form :v-model="form" style="text-align: left" ref="form" :rules="rules"
label-position="right" label-width="100px">
<el-form-item label="申请人 :" prop="studentId">
<el-input v-model="form.studentId" disabled style="width:180px"></el-input>
Expand All @@ -14,24 +14,28 @@
<el-button @click="stuApply" size="small" type="primary">提交</el-button>
</el-form-item>
</el-form>
<el-table
:data="applyList.filter(data=>(!amIStu || data.studentId === form.studentId))">
<el-table-column
prop="studentId"
label="申请人"
width="100px">
</el-table-column>
<el-table-column
prop=""
label="申请课程id"
width="100px">
</el-table-column>
<el-table-column
prop=""
label="申请理由"
width="300px">
</el-table-column>
</el-table>
<div class="app-container" style="text-align:center;">
<el-table :data="tableData" height="620" style="width:90%;">
<el-table-column prop="requester_id" label="请求id" >
</el-table-column>
<el-table-column prop="request_class" label="请求类型" >
<template slot-scope="scope">
<el-tag size="medium" :type="tag_color_reqtype(scope.row.request_class)" effect="plain">{{ get_request_type(scope.row.request_class) }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="request_content.courseId" label="请求课程" >
</el-table-column>
<el-table-column prop="request_content.reason" label="申请理由" >
</el-table-column>
<el-table-column prop="handler_id" label="处理人" >
</el-table-column>
<el-table-column prop="point" label="状态" >
<template slot-scope="scope">
<el-tag size="medium" :type="tag_color(scope.row.handle_result)">{{ scope.row.handle_result }}</el-tag>
</template>
</el-table-column>
</el-table>
</div>
</div>
<div v-else>
<h5>当前选课申请未开放!</h5>
Expand All @@ -47,16 +51,19 @@ export default {
this.$axios.get("/permission/common/check_choose_course")
.then((resp)=>{
this.applyPermit= resp.data==2
// this.applyPermit= true
}).catch((error)=>{
console.log(error)
})
this.form.studentId=this.$store.state.user_id;
this.form.studentId=this.$store.state.user_id;
this.get_table()
},
data() {
return{
applyPermit: false,
amIStu:this.$store.state.role ==='student',
applyList:[],
tableData:[],
form: {
studentId: '',
courseId: '',
Expand All @@ -83,6 +90,37 @@ export default {
}
},
methods: {
tag_color(val){
if(val=='processing'){
return 'primary'
}
else if(val=='rejected'){
return 'danger'
}
else if(val=='approved'){
return 'success'
}
},
tag_color_reqtype(val){
if(val=='UpdateCourseRequest'){
return 'primary'
}
else if(val=='DeleteCourseRequest'){
return 'danger'
}
else if(val=='AddCourseRequest'){
return 'success'
}else return "info"
},
get_table(){
this.$axios.get('/requests/courses/user/view/by_requester',{params:{"requester_id":this.form.studentId}})
.then((resp)=>{
console.log(resp.data)
this.tableData = resp.data;
}).catch((error)=>{
console.log(error)
})
},
stuApply(){
this.$axios.post('/course_sel/student/request_course_sel',this.form)
.then((resp)=>{
Expand All @@ -99,7 +137,22 @@ export default {
})
}
})
}
},
get_request_type(val){
console.log(val)
if (val=='AddCourseSelRequest') {
return "选课申请"
}
else if(val=='AddCourseRequest'){
return "添加课程"
}
if(val=='UpdateCourseRequest'){
return "编辑课程"
}
else if(val=='DeleteCourseRequest'){
return "删除课程"
}
},
}
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ export const asyncRouterMap = [
name: '学生选课申请',
component: ApplyFromStu,
meta: {
role: ['student','admin']
role: ['student']
}
}
]
Expand Down

0 comments on commit 4c8f6c5

Please sign in to comment.