Commit 71179480 authored by 罗林杰's avatar 罗林杰

修改导出

parent 7dfe036d
......@@ -340,3 +340,12 @@ export function updateCourseStatusIds(data) {
data
})
}
// 6. 导出课程表
export function exportCourse(query) {
return request({
url: '/blesson/export',
method: 'get',
params: query,
responseType: 'blob'
})
}
......@@ -198,6 +198,16 @@
>{{ commonField.addName }}
</el-button>
</el-form-item>
<el-form-item>
<el-button
v-has-permi="hasAddPerm"
:class="commonField.addClass"
:type="commonField.typePrimary"
:size="commonField.smallSize"
@click="handleExport"
>导出
</el-button>
</el-form-item>
<el-form-item>
<el-button
v-has-permi="hasAddPerm"
......@@ -782,7 +792,12 @@ import {
findZIpInfo,
delZip,
downloadZip,
queryPcLessonEvaluationByPagination, ossinfoUploadCourse, ossinfoUpload, updateVideo, updateCourseStatusIds
queryPcLessonEvaluationByPagination,
ossinfoUploadCourse,
ossinfoUpload,
updateVideo,
updateCourseStatusIds,
exportCourse
} from '@/api/courseManagement/indexApi'
import { updatePagesRes, updateRes, updateResponseUrl } from '@/utils/updateUrl'
import commonField from '@/utils/commonField'
......@@ -792,6 +807,7 @@ import { urlDecrypt, urlEncrypt } from '@/utils/jsencrypt'
import home_pic_kecheng from '@/assets/image/home_pic_kecheng.png'
import { getDataCache, setDataCache } from '@/assets/js/filterData'
import axios from 'axios'
import { exportCmsBanner } from '@/api/contentManagement/cmsBanner'
export default {
name: 'Index',
components: {
......@@ -2447,6 +2463,68 @@ export default {
if (this.filelist.length > 0) {
this.filelist = []
}
},
/** 导出按钮操作 */
handleExport() {
// 列表渲染数据
const _this = this
var newClassPlan = ''
var newClassPlanSchool = ''
if (_this.queryParams.classPlan.length > 0) {
newClassPlan = _this.queryParams.classPlan.join(',')
} else {
newClassPlan = _this.queryParams.classPlan
}
if (_this.queryParams.classPlanSchool.length > 0) {
newClassPlanSchool = _this.queryParams.classPlanSchool.join(',')
} else {
newClassPlanSchool = _this.queryParams.classPlanSchool
}
const params = {
page: _this.queryParams.page,
rows: _this.queryParams.rows,
lessonDescription: _this.queryParams.lessonDescription,
lessonName: _this.queryParams.lessonName,
classHour: _this.queryParams.classHour,
classPlan: newClassPlan,
classPlanSchool: newClassPlanSchool,
jobClassify: _this.queryParams.jobClassify,
tecClassify: _this.queryParams.tecClassify,
tecClassifySchool: _this.queryParams.tecClassifySchool,
difficultyClassify: _this.queryParams.difficultyClassify,
lessonBrief: _this.queryParams.lessonBrief,
lessonTeaName: _this.queryParams.lessonTeaName,
lessonPrice: _this.queryParams.lessonPrice,
homeDisplay: _this.queryParams.homeDisplay,
flag: _this.queryParams.flag,
schoolQualityLesson: _this.queryParams.schoolQualityLesson,
entQualityLesson: _this.queryParams.entQualityLesson,
qualityLesson: _this.queryParams.qualityLesson,
lessonType: _this.queryParams.lessonType.length > 1 ? '2' : _this.queryParams.lessonType.join(','),
chronologicalOrdering: _this.queryParams.chronologicalOrdering,
isAppraisal: _this.queryParams.isAppraisal,
courseType: _this.queryParams.courseType,
courseTypeC: _this.queryParams.courseTypeC,
intelligentClassroom: _this.queryParams.intelligentClassroom,
enterpriseCourseDimensions: _this.queryParams.courseDimensions
}
this.$confirm('是否确认操作?', '警告', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(function() {
return exportCourse(params).then(response => {
const blob = new Blob([response])
const downloadElement = document.createElement('a')
const href = window.URL.createObjectURL(blob)// 创建下载的链接
downloadElement.href = href
downloadElement.download = '课程信息' + '.xls' // 下载后文件名
document.body.appendChild(downloadElement)
downloadElement.click()// 点击下载
document.body.removeChild(downloadElement)// 下载完成移除元素
window.URL.revokeObjectURL(href)// 释放掉blob对象
})
})
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment