From a1098ffafc78811bf3624b104d25a16a5fa26fda Mon Sep 17 00:00:00 2001 From: weinan2087 Date: Wed, 23 Nov 2022 18:14:13 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=90=E8=97=8Fpdf=E5=AF=BC=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/user/Mynotes.vue | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/src/views/user/Mynotes.vue b/src/views/user/Mynotes.vue index 0b1e00a0..5aa21480 100644 --- a/src/views/user/Mynotes.vue +++ b/src/views/user/Mynotes.vue @@ -6,9 +6,9 @@ 导出 - + + + Excel @@ -329,12 +329,12 @@ export default { }) }, exportStart(){ - let ids = this.datalist.map(item=>{ if(item.contentType !=3) { return item.id; } }) + let data = { name:this.userData.name, sign:this.userData.sign, @@ -344,10 +344,30 @@ export default { type:this.num, startTime:this.startTime, endTime:this.endTime, - author:this.userData.avatar,//this.userInfo.avatar, + currentUserHeadImgUrl: this.fileBaseUrl + this.userData.avatar, + currentUserSign: this.userData.sign, + currentUserName: this.userData.name, + currentUserDepartName:this.userInfo.departFullName } + if(this.exportType == '1') { + + + apiNote.exportPdf(data).then(res=>{ + console.log("导出pdf完成"); + const link = document.createElement('a');// 创建a标签 + // let blob = new Blob([res],{type: 'application/vnd.ms-pdf;charset=UTF-8'}); // 设置文件类型 + let blob = new Blob([res],{type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8'}); // 设置文件类型 + link.style.display = "none"; + link.href = URL.createObjectURL(blob); // 创建URL + link.setAttribute("download", "我的笔记.pdf"); + document.body.appendChild(link); + link.click(); + link.remove(); // 一次性的,用完就删除a标签 + this.dialogVisible = false; + }) + //apiNote.exportPdf(data); // apiNote.exportPdf(data).then(res=>{ // if(res.status) {