Commit 1ff3a0d0 authored by “lixuyan”'s avatar “lixuyan”

甘特图上AO号pdf跳转

parent 62ef049c
......@@ -48,6 +48,7 @@ export default {
}).catch((error) => {
console.log(error)
notify.close()
this.seePdfShow = false
})
} else {
this.$message({
......
......@@ -6,7 +6,7 @@
<script>
import CsvExportor from 'csv-exportor'
import { post } from '@/utils/http'
import { post, downloadFile } from '@/utils/http'
export default {
name: 'TfMomWebGantt',
props: {
......@@ -286,7 +286,7 @@ export default {
template: function(obj) {
if (obj.$level === 1) {
return (
"<div class='seepdf'>" +
"<div class='seepdf is-active-text'>" +
obj.text +
'</div>'
)
......@@ -596,11 +596,48 @@ export default {
.finally(() => {
that.getData()
})
},
seePdf(id) {
if (id) {
if (this.seePdfShow) {
return
}
const notify = this.$notify({
title: '提示',
message: 'PDF正在加载中...,请稍后!',
duration: 0
})
this.seePdfShow = true
downloadFile(`/ExtProcessPlan/createPDF?id=${id}`, 'get').then(res => {
const blob = new Blob([res.data], {
type: 'application/pdf'
})
if (window.navigator.msSaveOrOpenBlob) {
navigator.msSaveBlob(blob)
} else {
var openUrl = URL.createObjectURL(blob)
this.seePdfShow = false
notify.close()
window.open(openUrl, '_blank')
}
}).catch((error) => {
console.log(error)
notify.close()
this.seePdfShow = false
})
} else {
this.$message({
message: '该AO没有PDF',
type: 'warning'
})
}
}
}
}
</script>
<style lang="scss" scoped>
.seepdf{
cursor: pointer;
}
</style>
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