yxh
4 天以前 45d4fe24016c03fcccbe7c9798533ca97e2e7aea
src/views/project/travelexpenseapply/travelexpensedetail/index.vue
@@ -605,7 +605,7 @@
                        type="primary">点击上传</el-button></em>
                  </div>
                </el-upload>
                <el-table :data="fileListto" @row-click="downFile" style="width: 100%" height="400">
                <el-table :data="fileListto" @row-click="previewInline" @row-dblclick="downFile" style="width: 100%" height="400">
                  <el-table-column prop="name" :show-overflow-tooltip="true" label="名称">
                    <template slot-scope="scope">
                      <i style="color:#409EFF" class=" el-icon-s-order" />{{
@@ -650,7 +650,7 @@
                        type="primary">点击上传</el-button></em>
                  </div>
                </el-upload>
                <el-table :data="invoicefileListto" @row-click="downFile" style="width: 100%" height="400">
                <el-table :data="invoicefileListto" @row-click="previewInline" @row-dblclick="downFile" style="width: 100%" height="400">
                  <el-table-column prop="name" :show-overflow-tooltip="true" label="文件名称">
                    <template slot-scope="scope">
                      <i style="color:#409EFF" class=" el-icon-s-order" />{{
@@ -932,6 +932,7 @@
      invoicefileListto: [],
      invoicepdfimg: "",
      invoicepdfimgsrcList: [],
      previewToken: 0,
      currentIndex: 0, // 初始索引
      invoicecurrentIndex: 0, // 初始索引
      initialIndex: 0, // 初始索引
@@ -1481,18 +1482,33 @@
      }
    },
    // 点击票据
    /**
     * 2026-11-30:清空票据弹窗的预览状态。
     * 原实现漏清 embeddedFile / invoiceEmbeddedFile,导致再次打开弹窗时
     * 预览组件仍显示上一次选择的发票图片。
     */
    resetPreviewState() {
      this.fileListto = [];
      this.invoicefileListto = [];
      this.pdfimg = "";
      this.invoicepdfimg = "";
      this.pdfimgsrcList = [];
      this.invoicepdfimgsrcList = [];
      this.embeddedFile = null;
      this.invoiceEmbeddedFile = null;
      this.pdftitle = "";
      // 递增令牌:让上一行尚未返回的 fetch 结果失效,避免异步回写覆盖
      this.previewToken = (this.previewToken || 0) + 1;
    },
    Filepopup(index, rows, row) {
      const config = {
        headers: { Authorization: "Bearer " + this.ICDtoken }
      };
      this.tableDatatop = [];
      this.fileListto = [];
      this.invoicefileListto = [];
      this.pdfimg = "";
      this.invoicepdfimg = [];
      this.pdfimgsrcList = [];
      this.invoicepdfimgsrcList = [];
      this.resetPreviewState();
      const previewToken = ++this.previewToken;
      this.tableDatatop.push(row);
      this.atpresent = index;
      this.pdfVisible = true;
@@ -1517,6 +1533,11 @@
        );
        Promise.all(fetchPromises).then(fileListto => {
          // 2026-11-30:切换行后旧请求返回,丢弃过期结果,避免覆盖当前行预览
          if (previewToken !== this.previewToken) {
            return;
          }
          this.fileListto = fileListto.filter(item => item !== null);
          this.pdfimg = this.fileListto[0].url;
          console.log(this.pdfimg, "pdfimg");
@@ -1555,6 +1576,11 @@
        );
        Promise.all(fetchPromises).then(invoicefileListto => {
          // 2026-11-30:切换行后旧请求返回,丢弃过期结果,避免覆盖当前行预览
          if (previewToken !== this.previewToken) {
            return;
          }
          this.invoicefileListto = invoicefileListto.filter(
            item => item !== null
          );
@@ -1584,6 +1610,30 @@
    },
    // 差旅报销:附件统一使用独立 FilePreview(录入、审批、详情一致)
    /**
     * 2026-11-30:单击列表项 → 在本页预览(右侧 preview-pane)。
     * 双击才打开独立的预览页面(downFile → $previewFile)。
     */
    previewInline(row) {
      if (!row) {
        return;
      }
      const url = row.previewUrl || row.url;
      if (!url) {
        return;
      }
      const file = {
        name: row.name || "",
        url,
        type: /\.pdf$/i.test(row.name || "") ? "pdf" : "image"
      };
      if (this.activeName == 2) {
        this.invoiceEmbeddedFile = file;
      } else {
        this.embeddedFile = file;
      }
    },
    downFile(item) {
      const source =
        this.activeName == 1 ? this.fileListto : this.invoicefileListto;
@@ -2870,6 +2920,9 @@
      } else {
        this.rbDetails.splice(rowIndex + 1, 0, rowData);
      }
      // 2026-11-30:新增行后把当前操作行切到新行,并清空上一次的预览态
      this.atpresent = this.rbDetails.indexOf(rowData);
      this.resetPreviewState();
      this.Reminderquantity++;
      this.totalquantity++;
      for (let i = 0; i < this.rbDetails.length; i++) {