sinake
5 天以前 df97bab9fcb3e6044ad736cd7483498f61f0feb4
src/views/project/unitCost/particulars/index.vue
@@ -489,6 +489,7 @@
        :title="pdftitle"
        :visible.sync="pdfVisible"
        width="60%"
        custom-class="pdf-resize-dialog"
      >
        <div class="pdfimg">
          <div class="box-pdf">
@@ -981,14 +982,8 @@
    },
    // 获取请求头
    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() {
@@ -1255,7 +1250,7 @@
      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;
@@ -1311,7 +1306,7 @@
      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 => {
@@ -1354,19 +1349,13 @@
    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("当前文件暂不支持预览");