Browse Source

制式表格下载预览添加错误提示

dev
long 2 years ago
parent
commit
bdc9961678
  1. 21
      src/views/accessrecords/statement/ProcessMaterialWarehousingStatement.vue
  2. 8
      src/views/accessrecords/statement/ProcessMaterialsPlanStatement.vue
  3. 21
      src/views/accessrecords/statement/ProcessMaterialsPlanStatement2.vue

21
src/views/accessrecords/statement/ProcessMaterialWarehousingStatement.vue

@ -63,12 +63,12 @@
this.showSessionId = window.location.search this.showSessionId = window.location.search
}, },
created() { created() {
downFile(this.url.queryPlanPrevie, { id: this.queryParam.id }).then((data) => { // downFile(this.url.queryPlanPrevie, { id: this.queryParam.id }).then((data) => {
console.log(data) // console.log(data)
const blob = new Blob([data], { type: 'application/pdf' }) // const blob = new Blob([data], { type: 'application/pdf' })
this.pdfWord = window.URL.createObjectURL(blob) // this.pdfWord = window.URL.createObjectURL(blob)
//
}) // })
// this.loadData(); // this.loadData();
}, },
activated() { activated() {
@ -86,6 +86,10 @@
// //
downWord() { downWord() {
downFile(this.url.queryPlandDownWord, { id: this.queryParam.id }).then((data) => { downFile(this.url.queryPlandDownWord, { id: this.queryParam.id }).then((data) => {
if (!data) {
this.$message.warning("文件下载失败")
return
}
const blob = new Blob([data]) // const blob = new Blob([data]) //
var a = document.createElement('a') //<a></a> var a = document.createElement('a') //<a></a>
a.href = URL.createObjectURL(blob) // ahref a.href = URL.createObjectURL(blob) // ahref
@ -99,7 +103,10 @@
}, },
previewWord() { previewWord() {
downFile(this.url.queryPlanPrevie, { id: this.queryParam.id }).then((data) => { downFile(this.url.queryPlanPrevie, { id: this.queryParam.id }).then((data) => {
console.log(data) if (!data) {
this.$message.warning("文件预览失败")
return
}
const blob = new Blob([data], { type: 'application/pdf' }) const blob = new Blob([data], { type: 'application/pdf' })
this.pdfSrc = window.URL.createObjectURL(blob) this.pdfSrc = window.URL.createObjectURL(blob)
console.log(this.pdfSrc) console.log(this.pdfSrc)

8
src/views/accessrecords/statement/ProcessMaterialsPlanStatement.vue

@ -86,6 +86,10 @@
// //
downWord() { downWord() {
downFile(this.url.queryPlandDownWord, { id: this.queryParam.id }).then((data) => { downFile(this.url.queryPlandDownWord, { id: this.queryParam.id }).then((data) => {
if (!data) {
this.$message.warning("文件下载失败")
return
}
const blob = new Blob([data]) // const blob = new Blob([data]) //
var a = document.createElement('a') //<a></a> var a = document.createElement('a') //<a></a>
a.href = URL.createObjectURL(blob) // ahref a.href = URL.createObjectURL(blob) // ahref
@ -99,6 +103,10 @@
}, },
previewWord() { previewWord() {
downFile(this.url.queryPlanPrevie, { id: this.queryParam.id }).then((data) => { downFile(this.url.queryPlanPrevie, { id: this.queryParam.id }).then((data) => {
if (!data) {
this.$message.warning("文件预览失败")
return
}
console.log(data) console.log(data)
const blob = new Blob([data], { type: 'application/pdf' }) const blob = new Blob([data], { type: 'application/pdf' })
this.pdfSrc = window.URL.createObjectURL(blob) this.pdfSrc = window.URL.createObjectURL(blob)

21
src/views/accessrecords/statement/ProcessMaterialsPlanStatement2.vue

@ -63,12 +63,12 @@
this.showSessionId = window.location.search this.showSessionId = window.location.search
}, },
created() { created() {
downFile(this.url.queryPlanPrevie, { id: this.queryParam.id }).then((data) => { // downFile(this.url.queryPlanPrevie, { id: this.queryParam.id }).then((data) => {
console.log(data) // console.log(data)
const blob = new Blob([data], { type: 'application/pdf' }) // const blob = new Blob([data], { type: 'application/pdf' })
this.pdfWord = window.URL.createObjectURL(blob) // this.pdfWord = window.URL.createObjectURL(blob)
//
}) // })
// this.loadData(); // this.loadData();
}, },
activated() { activated() {
@ -86,6 +86,10 @@
// //
downWord() { downWord() {
downFile(this.url.queryPlandDownWord, { id: this.queryParam.id }).then((data) => { downFile(this.url.queryPlandDownWord, { id: this.queryParam.id }).then((data) => {
if (!data) {
this.$message.warning("文件下载失败")
return
}
const blob = new Blob([data]) // const blob = new Blob([data]) //
var a = document.createElement('a') //<a></a> var a = document.createElement('a') //<a></a>
a.href = URL.createObjectURL(blob) // ahref a.href = URL.createObjectURL(blob) // ahref
@ -99,7 +103,10 @@
}, },
previewWord() { previewWord() {
downFile(this.url.queryPlanPrevie, { id: this.queryParam.id }).then((data) => { downFile(this.url.queryPlanPrevie, { id: this.queryParam.id }).then((data) => {
console.log(data) if (!data) {
this.$message.warning("文件预览失败")
return
}
const blob = new Blob([data], { type: 'application/pdf' }) const blob = new Blob([data], { type: 'application/pdf' })
this.pdfSrc = window.URL.createObjectURL(blob) this.pdfSrc = window.URL.createObjectURL(blob)
console.log(this.pdfSrc) console.log(this.pdfSrc)

Loading…
Cancel
Save