This commit is contained in:
daihh
2023-01-04 19:12:27 +08:00
2 changed files with 75 additions and 10 deletions

View File

@@ -9,7 +9,7 @@ const baseURL = process.env.VUE_APP_BOE_BASE_API;
/**
* 导出授课记录
*
* @param {Object} kid
* @param {Object} data
*/
const courseRecordExport = function(data) {
return axios.request({
@@ -20,14 +20,42 @@ const courseRecordExport = function(data) {
headers:{'Content-Type':'application/json;charset=utf-8'},
responseType: 'blob'
})
// return ajax.postJson('/b1/system/teacher/teacher-course-export',data);
}
/**
* 导出课程下的学员信息
*
*/
const exportStudentOfCourse = function(userId,courseId) {
return axios.request({
baseURL,
url: '/b1/system/teacher/teacher-course-student-export?userId='+userId+'&courseId='+courseId,
method: 'post',
headers:{'Content-Type':'application/json;charset=utf-8'},
responseType: 'blob'
})
}
/**
* 导出教师下的所有授课记录下的学员信息
*
*/
const exportStudentOfTearcher = function(userId) {
return axios.request({
baseURL,
url: '/b1/system/teacher/teacher-course-student-export?userId='+userId,
method: 'post',
headers:{'Content-Type':'application/json;charset=utf-8'},
responseType: 'blob'
})
}
/**
* 授课记录列表
*
* @param {Object} kid
* @param {Object} data
*/
const courseRecordList = function(data) {
return ajax.postJson('/b1/system/teacher/teacher-course-list',data);
@@ -37,6 +65,8 @@ const courseRecordList = function(data) {
export default {
courseRecordExport,
courseRecordList
courseRecordList,
exportStudentOfCourse,
exportStudentOfTearcher
}

View File

@@ -6,6 +6,7 @@
<div style="padding-left: 10px;"><el-button @click="recordList()" type="primary" icon="el-icon-search">搜索</el-button></div>
<div style="padding: 0px 5px;"><el-button icon="el-icon-refresh-right" @click="keyword = ''" type="primary" >重置</el-button></div>
<div style="padding: 0px 5px;"><el-button type="primary" @click="exportFile()" icon="el-icon-search" size="small" round>导出</el-button></div>
<div style="padding: 0px 5px;"><el-button type="primary" @click="exportStudentOfTearcher()" icon="el-icon-search" size="small" round>导出学员信息</el-button></div>
</div>
<div class="Export">
<!-- <div style="padding-left: 10px;"><el-button type="primary" @click="exportFile()" icon="el-icon-search" size="small" round>导出</el-button></div> -->
@@ -57,7 +58,7 @@
width="100px"
prop="score"
></el-table-column>
<!-- <el-table-column
<el-table-column
label="操作"
align="center"
width="150px"
@@ -65,9 +66,9 @@
fixed="right"
>
<template v-slot="scope">
<el-button type="primary" size="small">导出学员信息</el-button>
<el-button type="text" @click="exportStudentOfCourse(scope.row.courseId)" size="small">导出学员信息</el-button>
</template>
</el-table-column> -->
</el-table-column>
</el-table>
</div>
@@ -109,10 +110,11 @@ export default {
methods: {
// 导出所有记录
exportFile(){
let req = {
userId: this.userInfo.sysId
// teacherId:"70F80F4E-34BA-10AB-894A-8FA812B19637"
// userId:"70F80F4E-34BA-10AB-894A-8FA812B19637"
}
apiCourse.courseRecordExport(req).then(res=>{
const link = document.createElement('a');// 创建a标签
@@ -126,9 +128,42 @@ export default {
})
},
// 导出课程下的学员信息
exportStudentOfCourse(courseId){
let userId = this.userInfo.sysId;
apiCourse.exportStudentOfCourse(userId,courseId).then(res=>{
const link = document.createElement('a');// 创建a标签
let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); // 设置文件类型
link.style.display = "none";
link.href = URL.createObjectURL(blob); // 创建URL
link.setAttribute("download", "授课记录.xls");
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
})
},
// 导出教师下的所有授课记录下的学员信息
exportStudentOfTearcher(){
let userId = this.userInfo.sysId;
// let userId = '5D36C207-64F4-C512-312D-C9598257695C';
apiCourse.exportStudentOfTearcher(userId).then(res=>{
const link = document.createElement('a');// 创建a标签
let blob = new Blob([res.data],{type: 'application/vnd.ms-excel'}); // 设置文件类型
link.style.display = "none";
link.href = URL.createObjectURL(blob); // 创建URL
link.setAttribute("download", "授课记录.xls");
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
})
},
recordList(pageIndex){
let req = {
//     teacherId:"70F80F4E-34BA-10AB-894A-8FA812B19637",
//     userId:"6B049FAF-C314-7CCF-0D28-0D23F4C42531",
userId: this.userInfo.sysId,
keyword:this.keyword,
    page:pageIndex,