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

甘特图上AO号pdf跳转

parent 62ef049c
...@@ -48,6 +48,7 @@ export default { ...@@ -48,6 +48,7 @@ export default {
}).catch((error) => { }).catch((error) => {
console.log(error) console.log(error)
notify.close() notify.close()
this.seePdfShow = false
}) })
} else { } else {
this.$message({ this.$message({
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<script> <script>
import CsvExportor from 'csv-exportor' import CsvExportor from 'csv-exportor'
import { post } from '@/utils/http' import { post, downloadFile } from '@/utils/http'
export default { export default {
name: 'TfMomWebGantt', name: 'TfMomWebGantt',
props: { props: {
...@@ -286,7 +286,7 @@ export default { ...@@ -286,7 +286,7 @@ export default {
template: function(obj) { template: function(obj) {
if (obj.$level === 1) { if (obj.$level === 1) {
return ( return (
"<div class='seepdf'>" + "<div class='seepdf is-active-text'>" +
obj.text + obj.text +
'</div>' '</div>'
) )
...@@ -596,11 +596,48 @@ export default { ...@@ -596,11 +596,48 @@ export default {
.finally(() => { .finally(() => {
that.getData() 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> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.seepdf{
cursor: pointer;
}
</style> </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