yxh
8 天以前 51101f83762dba9c75f4d757c00edd03c7b6e038
src/views/project/fund/applyDetail/index.vue
@@ -2521,6 +2521,10 @@
            addorupdateFund(this.form).then(response => {
              if (response.code === 200) {
                // 2026-11-23:后端剔除了无效(blob:/data:)附件地址时给出提示
                if (response.attachWarn) {
                  this.$modal.msgWarning(response.attachWarn);
                }
                this.$modal.msgSuccess("申请单保存成功!");
                // 非提醒状态下执行审批解决异步调用延迟问题
                if (!this.Savereminder) {
@@ -3072,13 +3076,33 @@
    },
    remove(file, fileList) {
      const rbDetails = [...this.rbDetails];
      // 2026-11-23:不再用"预览用临时列表"(blob: URL) 整表覆盖附件字段,
      // 改为按文件名精确删除,避免 blob: 地址被保存进 annexfiles / invoicefiles。
      const name =
        (file && (file.name || (file.raw && file.raw.name))) || "";
      if (!this.rbDetails[this.atpresent]) {
        return;
      }
      if (this.activeName == "common") {
        this.fileListto.splice(this.fileListto.indexOf(file), 1);
        rbDetails[this.atpresent].annexfilesList = this.fileListto;
        this.spliceByName(this.fileListto, name);
        this.spliceByName(this.rbDetails[this.atpresent].annexfilesList, name);
      } else {
        this.invoicefileListto.splice(this.invoicefileListto.indexOf(file), 1);
        rbDetails[this.atpresent].invoicefilesList = this.invoicefileListto;
        this.spliceByName(this.invoicefileListto, name);
        this.spliceByName(
          this.rbDetails[this.atpresent].invoicefilesList,
          name
        );
      }
    },
    /** 按文件名从列表中删除一项(找不到则不做任何事) */
    spliceByName(list, name) {
      if (!list || !name) {
        return;
      }
      const idx = list.findIndex(item => item && item.name === name);
      if (idx > -1) {
        list.splice(idx, 1);
      }
    },
@@ -3150,9 +3174,11 @@
            type: /\.pdf$/i.test(file.name) ? "pdf" : "image"
          };
          this.pdfimgsrcList.push(localUrl);
          // 2026-11-23:url 存服务端路径(权威值),previewUrl 只用于本地预览
          this.fileListto.push({
            name: file.name,
            url: localUrl
            url: response.fileName,
            previewUrl: localUrl
          });
          this.$modal.msgSuccess(response.msg);
@@ -3185,9 +3211,11 @@
            type: /\.pdf$/i.test(file.name) ? "pdf" : "image"
          };
          this.invoicepdfimgsrcList.push(localUrl);
          // 2026-11-23:url 存服务端路径(权威值),previewUrl 只用于本地预览
          this.invoicefileListto.push({
            name: file.name,
            url: localUrl
            url: response.fileName,
            previewUrl: localUrl
          });
          this.$modal.msgSuccess(response.msg);
@@ -3257,7 +3285,9 @@
              .then(blob => {
                return {
                  name: value.name,
                  url: URL.createObjectURL(blob)
                  // 2026-11-23:权威地址仍是服务端路径,blob 只放 previewUrl
                  url: value.url,
                  previewUrl: URL.createObjectURL(blob)
                };
              })
              .catch(error => {
@@ -3269,9 +3299,10 @@
        Promise.all(fetchPromises).then(fileListto => {
          this.fileListto = fileListto.filter(item => item !== null);
          this.pdfimg = this.fileListto[0].url;
          this.pdfimg =
            this.fileListto.length > 0 ? this.fileListto[0].previewUrl : "";
          console.log(this.pdfimg, "pdfimg");
          this.pdfimgsrcList = this.fileListto.map(item => item.url);
          this.pdfimgsrcList = this.fileListto.map(item => item.previewUrl);
        });
        this.previewpdf = true;
@@ -3290,7 +3321,9 @@
              .then(blob => {
                return {
                  name: value.name,
                  url: URL.createObjectURL(blob)
                  // 2026-11-23:权威地址仍是服务端路径,blob 只放 previewUrl
                  url: value.url,
                  previewUrl: URL.createObjectURL(blob)
                };
              })
              .catch(error => {
@@ -3304,10 +3337,13 @@
          this.invoicefileListto = invoicefileListto.filter(
            item => item !== null
          );
          this.invoicepdfimg = this.invoicefileListto[0].url;
          this.invoicepdfimg =
            this.invoicefileListto.length > 0
              ? this.invoicefileListto[0].previewUrl
              : "";
          console.log(this.invoicepdfimg, "invoicepdfimg");
          this.invoicepdfimgsrcList = this.invoicefileListto.map(
            item => item.url
            item => item.previewUrl
          );
        });
@@ -3331,10 +3367,15 @@
    downFile(item) {
      const source =
        this.activeName == "common" ? this.fileListto : this.invoicefileListto;
      let list = (source || []).map(f => ({ name: f.name, url: f.url }));
      let index = list.findIndex(f => f.url === item.url);
      if (index < 0 && item && item.url) {
        list = [{ name: item.name, url: item.url }];
      // 2026-11-23:预览优先用本地 blob(previewUrl),没有则退回服务端路径
      let list = (source || []).map(f => ({
        name: f.name,
        url: f.previewUrl || f.url
      }));
      const target = item && (item.previewUrl || item.url);
      let index = list.findIndex(f => f.url === target);
      if (index < 0 && target) {
        list = [{ name: item.name, url: target }];
        index = 0;
      }
      this.$previewFile(list, index > -1 ? index : 0);
@@ -3355,7 +3396,10 @@
      console.log(row);
      let indexvalue = "";
      if (this.activeName == "common") {
        const indexlist = this.getIndexInArray(this.pdfimgsrcList, row.url);
        const indexlist = this.getIndexInArray(
          this.pdfimgsrcList,
          row.previewUrl || row.url
        );
        this.pdfimgsrcList.splice(indexlist, 1);
        const index = this.getIndexInArray(this.fileListto, row);
        this.fileListto.splice(index, 1);
@@ -3364,11 +3408,13 @@
          item => item.name == row.name
        );
        console.log(indexvalue, "删除索引");
        this.rbDetails[this.atpresent].annexfilesList.splice(indexvalue, 1);
        if (indexvalue > -1) {
          this.rbDetails[this.atpresent].annexfilesList.splice(indexvalue, 1);
        }
      } else {
        const indexlist = this.getIndexInArray(
          this.invoicepdfimgsrcList,
          row.url
          row.previewUrl || row.url
        );
        this.invoicepdfimgsrcList.splice(indexlist, 1);
        const index = this.getIndexInArray(this.invoicefileListto, row);
@@ -3378,7 +3424,9 @@
          item => item.name == row.name
        );
        console.log(indexvalue, "删除索引");
        this.rbDetails[this.atpresent].invoicefilesList.splice(indexvalue, 1);
        if (indexvalue > -1) {
          this.rbDetails[this.atpresent].invoicefilesList.splice(indexvalue, 1);
        }
      }
    },
    // 点击上移
@@ -3431,7 +3479,17 @@
      // console.log(this.rbDetails[this.atpresent].invoicefilesList,'invoicefilesList');
    },
    Downloadfile(row) {
      window.location.href = row.url;
      // 2026-11-23:优先用本地 blob 下载;没有则拼服务端地址
      const target = (row && (row.previewUrl || row.url)) || "";
      if (!target) {
        return;
      }
      if (/^(blob:|data:|https?:)/i.test(target)) {
        window.location.href = target;
      } else {
        window.location.href =
          this.Networkheader + process.env.VUE_APP_BASE_API + target;
      }
    },
    //专家/医疗机构/费用报销机构选择