| | |
| | | :title="pdftitle" |
| | | :visible.sync="pdfVisible" |
| | | width="60%" |
| | | custom-class="pdf-resize-dialog" |
| | | > |
| | | <div class="pdfimg"> |
| | | <div class="box-pdf"> |
| | |
| | | }, |
| | | // 获取请求头 |
| | | Getnetworkheader() { |
| | | let string = window.location.href; |
| | | if (string.includes("9091")) { |
| | | const index = string.indexOf("9091"); |
| | | this.Networkheader = string.slice(0, index + 4); // 截取9091及其前部字符 |
| | | } else { |
| | | const index = string.indexOf("8032"); |
| | | this.Networkheader = string.slice(0, index + 4); // 截取8032及其前部字符 |
| | | } |
| | | // 以当前页面 origin 为准,兼容 80/8032/9091 及后续端口调整 |
| | | this.Networkheader = window.location.origin; |
| | | }, |
| | | // 表单重置 |
| | | reset() { |
| | |
| | | return sums; |
| | | }, |
| | | // 文件------------------------ |
| | | /** 2026-11-23:按文件名从列表中精确删除一项,避免用预览列表(blob)整表覆盖附件字段 */ |
| | | spliceByName(list, name) { |
| | | if (!list || !name) { |
| | | return; |
| | | } |
| | | const idx = list.findIndex(item => item && item.name === name); |
| | | if (idx > -1) { |
| | | list.splice(idx, 1); |
| | | } |
| | | }, |
| | | remove(file, fileList) { |
| | | const donorchargeorgans = [...this.donorchargeorgans]; |
| | | |
| | | this.fileListto.splice(this.fileListto.indexOf(file), 1); |
| | | donorchargeorgans[this.atpresent].annexFilesList = this.fileListto; |
| | | this.spliceByName(this.fileListto, file && file.name); |
| | | this.spliceByName( |
| | | donorchargeorgans[this.atpresent].annexFilesList, |
| | | file && file.name |
| | | ); |
| | | }, |
| | | |
| | | uploadSccess(response, file, fileList) { |
| | |
| | | const config = { |
| | | headers: { Authorization: "Bearer " + this.ICDtoken } |
| | | }; |
| | | const pdfimg = this.Networkheader + "/prod-api" + response.fileName; |
| | | const pdfimg = this.Networkheader + process.env.VUE_APP_BASE_API + response.fileName; |
| | | //获取票据信息位置 |
| | | if (response.code == 200) { |
| | | this.previewpdf = true; |
| | |
| | | if (this.donorchargeorgans[index].annexFilesList) { |
| | | const fetchPromises = this.donorchargeorgans[index].annexFilesList.map( |
| | | (value, indexson) => { |
| | | const pdfimg = this.Networkheader + "/prod-api" + value.url; |
| | | const pdfimg = this.Networkheader + process.env.VUE_APP_BASE_API + value.url; |
| | | return fetch(pdfimg, config) |
| | | .then(response => response.blob()) |
| | | .then(blob => { |
| | |
| | | downFile(item) { |
| | | this.pdftitle = |
| | | "共" + this.pdfimgsrcList.length + "项,当前选中" + item.name; |
| | | let name = item.name.split("."); |
| | | if (name[1] == "pdf") { |
| | | this.$modal.msgWarning("当前文件暂不支持预览"); |
| | | this.previewpdf = false; |
| | | this.hintitle = "当前文件暂不支持预览"; |
| | | } else if (name[1] == "jpg" || "png") { |
| | | console.log(item, "展示"); |
| | | this.previewpdf = true; |
| | | if (item.url) { |
| | | this.pdfimg = item.url; |
| | | } else { |
| | | this.pdfimg = ""; |
| | | } |
| | | const ext = String(item.name || "pdf").toLowerCase().split(".").pop(); |
| | | if (ext === "pdf") { |
| | | this.$previewFile([{ name: item.name, url: item.url }]); |
| | | return; |
| | | } else if (["jpg", "jpeg", "png", "gif", "bmp", "webp"].includes(ext)) { |
| | | this.$previewFile([{ name: item.name, url: item.url }]); |
| | | return; |
| | | } else { |
| | | this.hintitle = "当前文件暂不支持预览"; |
| | | this.$modal.msgWarning("当前文件暂不支持预览"); |