mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-10 19:36:43 +08:00
调整笔记导出预览功能
This commit is contained in:
@@ -138,13 +138,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="export-dialog-right">
|
<div class="export-dialog-right">
|
||||||
<p>累计导出{{datalist.length}}条</p>
|
<p>累计导出{{exportPreData.length}}条</p>
|
||||||
<p style="margin-top:10px">导出时间:{{formatDate(new Date())}}</p>
|
<p style="margin-top:10px">导出时间:{{formatDate(new Date())}}</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="export-dialog-body">
|
<div class="export-dialog-body">
|
||||||
<div class="Export-info" style="" v-for="(item,idx) in datalist" :key="idx">
|
<div class="Export-info" style="" v-for="(item,idx) in exportPreData" :key="idx">
|
||||||
<div class="all-title">
|
<div class="all-title">
|
||||||
<h3> {{item.courseName}}</h3>
|
<h3> {{item.courseName}}</h3>
|
||||||
<div v-if="item.playTime != ''"><img src="../../../public/images/coteplay.png" alt="">{{item.playTime}}</div>
|
<div v-if="item.playTime != ''"><img src="../../../public/images/coteplay.png" alt="">{{item.playTime}}</div>
|
||||||
@@ -227,6 +227,7 @@ export default {
|
|||||||
startTime:'',
|
startTime:'',
|
||||||
endTime:'',
|
endTime:'',
|
||||||
datalist:[ ],
|
datalist:[ ],
|
||||||
|
exportPreData:[ ],
|
||||||
thu:true,
|
thu:true,
|
||||||
couresna:[],
|
couresna:[],
|
||||||
courseName:'',
|
courseName:'',
|
||||||
@@ -251,9 +252,32 @@ export default {
|
|||||||
methods: {
|
methods: {
|
||||||
exportCommand(e) {
|
exportCommand(e) {
|
||||||
this.exportType = e;
|
this.exportType = e;
|
||||||
this.dialogVisible = true;
|
this.dialogVisible = false;
|
||||||
|
let data = {
|
||||||
|
orderType:this.orderType,
|
||||||
|
orderField:this.orderField,
|
||||||
|
courseId:this.courseId,
|
||||||
|
type:this.num,
|
||||||
|
startTime:this.startTime,
|
||||||
|
endTime:this.endTime,
|
||||||
|
}
|
||||||
|
// 获取导出文件前的预览数据
|
||||||
|
apiNote.exportExcelPre(data).then(res=>{
|
||||||
|
if(res.status != 200){return;}
|
||||||
|
if(res.result.data.length == 0){
|
||||||
|
this.$message.warning('未查询到满足条件的数据')
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.exportPreData = res.result.data;
|
||||||
|
if(res.result.isImage && e == 2){
|
||||||
|
this.$message.warning('当前筛选条件下含图片类内容,无法导出Excel!')
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.dialogVisible = true;
|
||||||
|
})
|
||||||
},
|
},
|
||||||
exportStart(){
|
exportStart(){
|
||||||
|
|
||||||
let ids = this.datalist.map(item=>{
|
let ids = this.datalist.map(item=>{
|
||||||
if(item.contentType !=3) {
|
if(item.contentType !=3) {
|
||||||
return item.id;
|
return item.id;
|
||||||
@@ -262,7 +286,12 @@ export default {
|
|||||||
let data = {
|
let data = {
|
||||||
name:this.userData.name,
|
name:this.userData.name,
|
||||||
sign:this.userData.sign,
|
sign:this.userData.sign,
|
||||||
ids:ids,
|
orderType:this.orderType,
|
||||||
|
orderField:this.orderField,
|
||||||
|
courseId:this.courseId,
|
||||||
|
type:this.num,
|
||||||
|
startTime:this.startTime,
|
||||||
|
endTime:this.endTime,
|
||||||
author:this.userData.avatar,//this.userInfo.avatar,
|
author:this.userData.avatar,//this.userInfo.avatar,
|
||||||
}
|
}
|
||||||
if(this.exportType == '1') {
|
if(this.exportType == '1') {
|
||||||
@@ -274,7 +303,7 @@ export default {
|
|||||||
let blob = new Blob([res],{type: 'application/vnd.ms-pdf;charset=UTF-8'}); // 设置文件类型
|
let blob = new Blob([res],{type: 'application/vnd.ms-pdf;charset=UTF-8'}); // 设置文件类型
|
||||||
link.style.display = "none";
|
link.style.display = "none";
|
||||||
link.href = URL.createObjectURL(blob); // 创建URL
|
link.href = URL.createObjectURL(blob); // 创建URL
|
||||||
link.setAttribute("download", "我的笔记.xls");
|
link.setAttribute("download", "我的笔记.pdf");
|
||||||
document.body.appendChild(link);
|
document.body.appendChild(link);
|
||||||
link.click();
|
link.click();
|
||||||
document.body.removeChild(link);
|
document.body.removeChild(link);
|
||||||
@@ -283,7 +312,16 @@ export default {
|
|||||||
|
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
apiNote.exportExcel(ids).then(res=>{
|
let data = {
|
||||||
|
orderType:this.orderType,
|
||||||
|
orderField:this.orderField,
|
||||||
|
courseId:this.courseId,
|
||||||
|
type:this.num,
|
||||||
|
startTime:this.startTime,
|
||||||
|
endTime:this.endTime,
|
||||||
|
}
|
||||||
|
// apiNote.exportExcel(ids).then(res=>{
|
||||||
|
apiNote.exportExcel(data).then(res=>{
|
||||||
if(res.status) {
|
if(res.status) {
|
||||||
this.$message.error('导出失败');
|
this.$message.error('导出失败');
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user