|
|
|
@ -147,8 +147,10 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import Cookie from 'js-cookie' |
|
|
|
|
import { Loading } from "element-ui"; |
|
|
|
|
import util from '@/util' |
|
|
|
|
import Util from '@/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/tinymceConfig' |
|
|
|
|
export default { |
|
|
|
|
data () { |
|
|
|
|
return { |
|
|
|
|
headers: { |
|
|
|
|
token: Cookie.get('admin-token'), |
|
|
|
|
}, |
|
|
|
|
editorConfig, |
|
|
|
|
reportId: this.$route.query.reportId, |
|
|
|
|
title: "实验报告", |
|
|
|
@ -239,7 +244,7 @@ export default { |
|
|
|
|
} |
|
|
|
|
this.expData = list |
|
|
|
|
}, |
|
|
|
|
exportPage () { |
|
|
|
|
async exportPage () { |
|
|
|
|
const form = Object.assign(this.form, this.infoData) |
|
|
|
|
const list = JSON.parse(JSON.stringify(this.expData)) |
|
|
|
|
list.map((e, i) => { |
|
|
|
@ -258,17 +263,21 @@ export default { |
|
|
|
|
this.loadIns = Loading.service({ |
|
|
|
|
background: "#fff" |
|
|
|
|
}); |
|
|
|
|
this.$post(this.project ? this.api.exportBankExperimentReport : this.api.exportLabReport, { |
|
|
|
|
...form, |
|
|
|
|
experimentalData: list |
|
|
|
|
}).then(res => { |
|
|
|
|
this.loadIns.close(); |
|
|
|
|
this.loading = false; |
|
|
|
|
util.downloadFileDirect(`实验报告.docx`, new Blob([res])) |
|
|
|
|
}).catch(res => { |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
const res = await Axios.post(this.api[this.project ? '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(); |
|
|
|
|
this.loading = false; |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
editReport () { // 编辑实验报告 |
|
|
|
|
if (this.editing) { |
|
|
|
|