|
|
|
@ -148,7 +148,9 @@ |
|
|
|
|
import { Loading } from "element-ui"; |
|
|
|
|
import html2Canvas from "html2canvas"; |
|
|
|
|
import JsPDF from "jspdf"; |
|
|
|
|
import util from "@/libs/util"; |
|
|
|
|
import Setting from '@/setting' |
|
|
|
|
import Util from '@/libs/util' |
|
|
|
|
import Axios from 'axios' |
|
|
|
|
import breadcrumb from '@/components/breadcrumb' |
|
|
|
|
import quill from "@/components/quill"; |
|
|
|
|
import Editor from '@tinymce/tinymce-vue' |
|
|
|
@ -156,6 +158,9 @@ import editorConfig from '@/components/editor' |
|
|
|
|
export default { |
|
|
|
|
data () { |
|
|
|
|
return { |
|
|
|
|
headers: { |
|
|
|
|
token: Util.session.get(Setting.tokenKey) |
|
|
|
|
}, |
|
|
|
|
routes: [], |
|
|
|
|
editorConfig, |
|
|
|
|
fromPython: this.$route.query.python, // 来自python子系统 |
|
|
|
@ -300,7 +305,7 @@ export default { |
|
|
|
|
back () { |
|
|
|
|
history.back() |
|
|
|
|
}, |
|
|
|
|
exportPage () { |
|
|
|
|
async exportPage () { |
|
|
|
|
this.loadIns = Loading.service({ |
|
|
|
|
background: "#fff" |
|
|
|
|
}) |
|
|
|
@ -317,15 +322,20 @@ export default { |
|
|
|
|
delete e.lcStudentAnswer |
|
|
|
|
}) |
|
|
|
|
form.purpose = form.purpose.replace(/<[^>]+>/g, '') |
|
|
|
|
this.$post(this.isLc ? this.api.exportBankExperimentReport : this.api.exportLabReport, { |
|
|
|
|
...form, |
|
|
|
|
experimentalData: list |
|
|
|
|
}).then(res => { |
|
|
|
|
util.downloadFileDirect(`实验报告.docx`, new Blob([res])) |
|
|
|
|
this.loadIns.close() |
|
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
const res = await Axios.post(this.api[this.isLc ? 'exportBankExperimentReport' : 'exportLabReport'], { |
|
|
|
|
...form, |
|
|
|
|
experimentalData: list |
|
|
|
|
}, { |
|
|
|
|
headers: this.headers, |
|
|
|
|
responseType: 'blob' |
|
|
|
|
}) |
|
|
|
|
const name = res.headers['content-disposition'] |
|
|
|
|
Util.downloadFileDirect(name ? decodeURI(name) : `实验报告.docx`, new Blob([res.data])) |
|
|
|
|
} finally { |
|
|
|
|
this.loadIns.close() |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
exportPage1 () { // 导出实验报告 |
|
|
|
|
this.loadIns = Loading.service({ |
|
|
|
@ -373,7 +383,7 @@ export default { |
|
|
|
|
if (this.editing) { |
|
|
|
|
this.$post(this.api.updateReport, this.infoData).then(res => { |
|
|
|
|
this.editing = false; |
|
|
|
|
util.successMsg("修改成功"); |
|
|
|
|
Util.successMsg("修改成功"); |
|
|
|
|
}).catch(err => { }); |
|
|
|
|
} else { |
|
|
|
|
this.editing = true; |
|
|
|
|