yxh
6 天以前 e1dd822239ce5b1fd85462c95b264b300153a4cf
src/views/project/travelexpenseapply/travelexpensedetail/index.vue
@@ -5,7 +5,7 @@
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-row><el-col :span="5">
            <el-form-item label="申请日期" prop="applyTime">
              <el-date-picker style="width: 100%" v-model="form.applyTime" type="date"
              <el-date-picker style="width: 100%" v-model="form.applyTime" type="date" format="yyyy-MM-dd"
                value-format="yyyy-MM-dd HH:mm:ss" placeholder="申请日期" :disabled="true">
              </el-date-picker>
            </el-form-item>
@@ -14,8 +14,8 @@
            <el-form-item label="经办人" prop="username">
              <el-select v-model="form.username" clearable filterable allow-create ref="getReportname"
                default-first-option placeholder="请选择">
                <el-option v-for="item in personsList" :key="item.reportNo" :label="item.reportName"
                  :value="item.reportName">
                <el-option v-for="(item, index) in personsList" :key="item.reportNo + '-' + index"
                  :label="item.reportName" :value="item.reportName">
                </el-option>
              </el-select>
            </el-form-item>
@@ -47,12 +47,18 @@
            </el-form-item>
          </el-col>
          <el-col :span="5">
            <el-form-item label="捐献者" prop="infoid" v-show="form.costtype == 3||form.costtype == 4">
            <el-form-item label="捐献者" prop="infoid" v-show="form.costtype == 3 || form.costtype == 4">
              <el-select v-model="form.infoid" @change="selectbaseinfo" clearable filterable placeholder="请选择捐献者">
                <el-option v-for="item in baselist" :key="item.index" :label="item.name" :value="item.infoid">
                <el-option v-for="(item, index) in baselist" :key="item.index + '-' + index" :label="item.name"
                  :value="item.infoid">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="4">
            <div style="margin-left: 10px;">
              <dict-tag :options="dict.type.sys_DonationStatus" :value="form.invoicecount" />
            </div>
          </el-col>
        </el-row>
        <el-row style="margin-top: 10px">
@@ -86,7 +92,7 @@
            <el-form-item label="出差人" prop="travelers">
              <el-select v-model="form.travelers" clearable filterable allow-create ref="getReportname"
                default-first-option placeholder="请选择" @change="getAccountinfo()">
                <el-option v-for="item in travelers" :key="item.reportNo" :label="item.reportName"
                <el-option v-for="item in travelers"  :label="item.reportName"
                  :value="item.reportName">
                </el-option>
              </el-select>
@@ -224,7 +230,7 @@
                    }
                  }
                }" clearable size="small" style="width: 100%" v-model="scope.row.starttime" type="date"
                  value-format="yyyy-MM-dd HH:mm:ss" placeholder="开始日期" @blur="getdays(scope.row)">
                  format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" placeholder="开始日期" @blur="getdays(scope.row)">
                </el-date-picker>
              </template>
            </el-table-column>
@@ -240,7 +246,7 @@
                    }
                  }
                }" clearable size="small" style="width: 100%" v-model="scope.row.endtime" type="date"
                  value-format="yyyy-MM-dd HH:mm:ss" placeholder="结束日期" @blur="getdays(scope.row)">
                  format="yyyy-MM-dd" value-format="yyyy-MM-dd HH:mm:ss" placeholder="结束日期" @blur="getdays(scope.row)">
                </el-date-picker>
              </template>
            </el-table-column>
@@ -445,7 +451,7 @@
            <!--
            <el-table-column prop="paiddate" slot="" label="打款日期" fixed align="center" width="150">
              <template slot-scope="scope">
                <el-date-picker clearable size="small" style="width: 100%" v-model="scope.row.paiddate" type="date"
                <el-date-picker clearable size="small" style="width: 100%" v-model="scope.row.paiddate" type="date" format="yyyy-MM-dd"
                  value-format="yyyy-MM-dd HH:mm:ss" placeholder="打款日期" :disabled="true">
                </el-date-picker>
              </template>
@@ -527,19 +533,42 @@
    </div>
    <el-dialog v-dialogDrags :modal="false" :close-on-click-modal="false" :title="pdftitle" :visible.sync="pdfVisible"
      width="60%">
      :fullscreen="pdfFullscreen" width="60%" custom-class="pdf-resize-dialog" @closed="pdfFullscreen = false">
      <template slot="title">
        <span>{{ pdftitle }}</span>
        <el-button class="pdf-fullscreen-btn" size="mini"
          :icon="pdfFullscreen ? 'el-icon-close' : 'el-icon-full-screen'" @click="pdfFullscreen = !pdfFullscreen">{{
            pdfFullscreen ? "还原" : "全屏" }}</el-button>
      </template>
      <el-alert
        :title="
          activeName == 2
            ? '当前正在操作:发票文件(请确认票据属于发票)'
            : '当前正在操作:普通附件(请勿在此上传发票)'
        "
        :type="activeName == 2 ? 'success' : 'warning'"
        :closable="false"
        show-icon
        style="margin-bottom: 10px;"
      />
      <div style="margin-bottom: 10px;">
        <el-table :data="tableDatatop" style="width: 100%">
          <el-table-column prop="orderno" label="序号"> </el-table-column>
          <el-table-column prop="personname" label="费用人员">
          </el-table-column>
          <el-table-column prop="starttime" label="开始日期"> </el-table-column>
          <el-table-column prop="endtime" label="结束日期"> </el-table-column>
          <el-table-column prop="starttime" label="开始日期">
            <template slot-scope="scope">
              {{ scope.row.starttime ? parseTime(scope.row.starttime, "{y}-{m}-{d}") : "" }}
            </template>
          </el-table-column>
          <el-table-column prop="endtime" label="结束日期">
            <template slot-scope="scope">
              {{ scope.row.endtime ? parseTime(scope.row.endtime, "{y}-{m}-{d}") : "" }}
            </template>
          </el-table-column>
          <el-table-column prop="departure" label="出发地"> </el-table-column>
          <el-table-column prop="destination" label="到达地"> </el-table-column>
          <el-table-column prop="days" label="天数"> </el-table-column>
        </el-table>
        <el-table :data="tableDatatop" style="width: 100%">
          <el-table-column prop="traffictype" label="出发交通工具">
          </el-table-column>
          <el-table-column prop="traffictype2" label="返回交通工具">
@@ -566,7 +595,7 @@
              <div>
                <el-upload size="mini" class="upload-demo" :action="uploadFileUrl" :file-list="fileListto"
                  :show-file-list="false" multiple drag :headers="headers" :on-success="(response, file, fileList) =>
                    uploadSccess(response, file, fileList)
                      uploadSccess(response, file, fileList)
                    " :on-preview="downFile" :disabled="operationType == 'detail'" :on-error="handleUploadError"
                  :on-remove="remove" accept="image/*,.pdf">
                  <i class="el-icon-upload"></i>
@@ -597,24 +626,7 @@
              </div>
            </div>
            <div v-if="this.previewpdf && pdfimgsrcList.length" class="pdfimgmin">
              <!-- <img :src="pdfimg" /> -->
              <!-- <el-image
                style="width: 95%; height: 90%"
                :src="pdfimg"
                :preview-src-list="pdfimgsrcList" -->
              >
              <el-image ref="imagePreview" style="width: 95%; height: 90%" :src="pdfimg"
                @click="handleImageClick(initialIndex)">
              </el-image>
              <custom-image-viewer :url-list="pdfimgsrcList" :initial-index="currentIndex" :visible="viewerVisible"
                @update:visible="viewerVisible = $event" @close="handleViewerClose" />
              <!-- <div slot="error" class="image-slot">
              <i class="el-icon-picture-outline"></i>
            </div> -->
              <!-- </el-image> -->
            </div>
            <div v-else class="pdfimgmins">{{ hintitle }}</div>
            <attachment-preview-pane :file="embeddedFile" style="flex: 1; min-width: 0;" />
          </div>
        </el-tab-pane>
        <el-tab-pane label="发票文件" :name="2">
@@ -623,7 +635,7 @@
              <div>
                <el-upload size="mini" class="upload-demo" :action="uploadFileUrl" :file-list="invoicefileList"
                  :show-file-list="false" multiple drag :headers="headers" :on-success="(response, file, fileList) =>
                    uploadSccess(response, file, fileList)
                      uploadSccess(response, file, fileList)
                    " :on-preview="downFile" :disabled="operationType == 'detail'" :on-error="handleUploadError"
                  :on-remove="remove" accept="image/*,.pdf">
                  <i class="el-icon-upload"></i>
@@ -654,16 +666,7 @@
              </div>
            </div>
            <div v-if="this.previewpdf && invoicepdfimgsrcList.length" class="pdfimgmin">
              <!-- <img :src="pdfimg" /> -->
              <el-image style="width: 95%; height: 90%" :src="invoicepdfimg"
                @click="invoicehandleImageClick(initialIndex)">
              </el-image>
              <custom-image-viewer :url-list="invoicepdfimgsrcList" :initial-index="invoicecurrentIndex"
                :visible="invoiceviewerVisible" @update:visible="invoiceviewerVisible = $event"
                @close="invoicehandleViewerClose" />
            </div>
            <div v-else class="pdfimgmins">{{ hintitle }}</div>
            <attachment-preview-pane :file="invoiceEmbeddedFile" style="flex: 1; min-width: 0;" />
          </div>
        </el-tab-pane>
      </el-tabs>
@@ -703,7 +706,8 @@
  exportReimbursement,
  getdownload,
  checkfund,
  fundSubmit
  fundSubmit,
  listbypowerone
} from "@/api/project/reimbursement";
import {
  addReimbursementdetail,
@@ -725,6 +729,8 @@
import { listReportname, listUser } from "@/api/project/organization";
import { getToken } from "@/utils/auth";
import debounce from "lodash/debounce";
import { moneySum, moneyAdd, moneyRound } from "@/utils/money";
import { checkFileName, checkDetails } from "@/utils/fileNameCheck";
export default {
  components: {
    Treeselect,
@@ -741,7 +747,8 @@
    "sys_recordstatus",
    "sys_travelexpensebelong",
    "sys_traffictype",
    "sys_area_name"
    "sys_area_name",
    "sys_DonationStatus"
  ],
  data() {
    return {
@@ -757,13 +764,14 @@
      personsList: [],
      //下拉可以选择人员列表
      personsSel: [],
      activeName: 1, //文件类型
      activeName: 2, //文件类型:默认发票文件
      // 部门树选项
      deptOptions: undefined,
      //票据文件
      pdftitle: "",
      pdfimg: "",
      invoiceEmbeddedFile: null,
      pdfVisible: false,
      costtypeobj: {
        value: 0,
@@ -912,6 +920,8 @@
        flowconclusion: null,
        fundid: null
      },
      //连续审批:待审批列表
      pendingList: [],
      jurisdiction: false,
      //保存按钮控制
@@ -1070,17 +1080,8 @@
    handleUploadError() { },
    // 获取请求头
    Getnetworkheader() {
      console.log(window.location.href);
      let string = window.location.href;
      if (string.includes("9091")) {
        const index = string.indexOf("9091");
        this.Networkheader = string.slice(0, index + 4); // 截取9091及其前部字符
        console.log(this.Networkheader);
      } else {
        const index = string.indexOf("8032");
        this.Networkheader = string.slice(0, index + 4); // 截取8032及其前部字符
        console.log(this.Networkheader);
      }
      // 以当前页面 origin 为准,兼容 80/8032/9091 及后续端口调整
      this.Networkheader = window.location.origin;
    },
    // 发票切换
    handleClick(tab, event) {
@@ -1106,32 +1107,68 @@
    },
    //文件上传成功回调
    /**
     * 2026-10-15:上传时校验附件文件名(业务要求:不合格立即提示且不加入列表)。
     * 规则与后端 AttachmentNameValidator 同口径:不强制含中文 / 去掉扩展名后主干 ≤20 字 /
     * 不含空格及 / \ : * ? " < > | # % 等特殊字符。
     */
    checkUploadFileName(file) {
      const raw = file && file.raw ? file.raw.name : file && file.name;
      const r = checkFileName(raw);
      if (!r.ok) {
        this.$modal.msgError(r.msg);
        return false;
      }
      return true;
    },
    /**
     * 2026-10-15:保存前校验整单明细附件文件名(含同一行内重名)。
     * 口径(业务确认):只校验"本次变更"的附件——老单据里已存在的不合规附件名不能把保存卡死
     * (否则老单据改一个金额都存不进去)。后端按 id 读旧记录放行历史附件;前端拿不到"哪些是历史"
     * 的权威信息,因此**仅新增单据**做保存前拦截,编辑老单据时新增的不合规附件由后端二次校验拦下。
     */
    checkDetailFileNames() {
      if (this.form && this.form.id) {
        return true;
      }
      const c = checkDetails(this.rbDetails);
      if (!c.ok) {
        this.$modal.msgError(c.msg);
        return false;
      }
      return true;
    },
    uploadSccess(response, file, fileList) {
      if (!this.checkUploadFileName(file)) {
        return;
      }
      this.rbDetails;
      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 (this.activeName == 1) {
        if (response.code == 200) {
          this.previewpdf = true;
          fetch(pdfimg, config)
            .then(response => response.blob())
            .then(blob => {
              // 将获取的数据流转换为URL
              this.pdfimg = URL.createObjectURL(blob);
              this.pdfimgsrcList.push(URL.createObjectURL(blob));
              this.fileListto.push({
                name: file.name,
                url: URL.createObjectURL(blob)
              });
            })
            .catch(error => {
              console.error("Error loading image", error);
              return;
            });
          // 新上传文件直接使用浏览器本地 File,避免服务端文件地址/Token
          // 异常时把 JSON 错误响应当成图片或 PDF 预览。
          const localBlob = file.raw;
          const localUrl = URL.createObjectURL(localBlob);
          this.pdfimg = localUrl;
          this.embeddedFile = {
            name: file.name,
            url: localUrl,
            type: /\.pdf$/i.test(file.name) ? "pdf" : "image"
          };
          this.pdfimgsrcList.push(localUrl);
          this.fileListto.push({
            name: file.name,
            url: localUrl
          });
          this.$modal.msgSuccess(response.msg);
@@ -1150,21 +1187,19 @@
      } else {
        if (response.code == 200) {
          this.previewpdf = true;
          fetch(pdfimg, config)
            .then(response => response.blob())
            .then(blob => {
              // 将获取的数据流转换为URL
              this.invoicepdfimg = URL.createObjectURL(blob);
              this.invoicepdfimgsrcList.push(URL.createObjectURL(blob));
              this.invoicefileListto.push({
                name: file.name,
                url: URL.createObjectURL(blob)
              });
            })
            .catch(error => {
              console.error("Error loading image", error);
              return;
            });
          const localBlob = file.raw;
          const localUrl = URL.createObjectURL(localBlob);
          this.invoicepdfimg = localUrl;
          this.invoiceEmbeddedFile = {
            name: file.name,
            url: localUrl,
            type: /\.pdf$/i.test(file.name) ? "pdf" : "image"
          };
          this.invoicepdfimgsrcList.push(localUrl);
          this.invoicefileListto.push({
            name: file.name,
            url: localUrl
          });
          this.$modal.msgSuccess(response.msg);
@@ -1200,7 +1235,7 @@
      if (this.rbDetails[index].annexfilesList) {
        const fetchPromises = this.rbDetails[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 => {
@@ -1233,7 +1268,7 @@
      if (this.rbDetails[index].invoicefilesList) {
        const fetchPromises = this.rbDetails[index].invoicefilesList.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 => {
@@ -1267,7 +1302,7 @@
        this.pdftitle = "";
      }
      if (this.activeName == "common") {
      if (this.activeName == 1) {
        this.pdftitle = "共" + this.pdfimgsrcList.length + "项";
      } else {
        this.pdftitle = "共" + this.invoicepdfimgsrcList.length + "项";
@@ -1276,50 +1311,17 @@
      console.log(this.rbDetails[index].annexfilesList, "annexfilesList");
    },
    // 点击已上传文件
    // 差旅报销:附件统一使用独立 FilePreview(录入、审批、详情一致)
    downFile(item) {
      if (this.activeName == 1) {
        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 = "";
          }
        } else {
          this.hintitle = "当前文件暂不支持预览";
          this.$modal.msgWarning("当前文件暂不支持预览");
          this.previewpdf = false;
        }
      } else {
        this.pdftitle =
          "共" + this.invoicepdfimgsrcList.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") {
          this.previewpdf = true;
          if (item.url) {
            this.invoicepdfimg = item.url;
          } else {
            this.invoicepdfimg = "";
          }
        } else {
          this.hintitle = "当前文件暂不支持预览";
          this.$modal.msgWarning("当前文件暂不支持预览");
          this.previewpdf = false;
        }
      const source =
        this.activeName == 1 ? 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 }];
        index = 0;
      }
      this.$previewFile(list, index > -1 ? index : 0);
    },
    getIndexInArray(arr, obj) {
      return arr.indexOf(obj);
@@ -1554,9 +1556,9 @@
          if (tempStr == "杭州") {
            row.otherexpense = "";
          } else if (
            tempStr == "杭州-桐庐" ||
            tempStr == "杭州-建德" ||
            tempStr == "杭州-淳安"
            tempStr.includes("桐庐") ||
            tempStr.includes("建德") ||
            tempStr.includes("淳安")
          ) {
            row.otherexpense = (parseInt(row.days) * 60).toString();
          } else {
@@ -1678,10 +1680,22 @@
        if (item.id == this.form.infoid) {
          this.form.donorno = item.donorno;
          this.form.donorname = item.name;
          // 新增:将捐献者的 recordstate 赋值到 invoicecount
          if (item.recordstate !== undefined && item.recordstate !== null) {
            this.form.invoicecount = item.recordstate.toString();
          } else {
            this.form.invoicecount = ""; // 如果 recordstate 为空,清空字段
          }
        }
      });
    },
    // 添加清除方法
    clearDonatorInfo() {
      this.form.donorno = "";
      this.form.donorname = "";
      this.form.invoicecount = ""; // 清空 invoicecount
    },
    onpick(e) {
      // console.log(e,this.value1)
    },
@@ -1933,7 +1947,7 @@
            .map(item => ({ url: item, name: item }))
          : [];
        //审核状态
        this.form.recordstatus = response.data.recordstatus + "";
        this.form.recordstatus = this.toStatusText(response.data.recordstatus, "-1");
        let ids = response.data.id;
        let listFundflowparams = {
          fundid: ids,
@@ -1944,14 +1958,19 @@
        });
        //报销明细
        getReimbursementdetaillist(ids).then(res => {
          this.rbDetails = res.data;
          //合计费用
          // if (this.rbDetails.length > 0) this.sumTotalFee();
          for (let i = 0; i < this.rbDetails.length; i++) {
            this.sumRowFee(this.rbDetails[i]);
          }
        });
        getReimbursementdetaillist(ids)
          .then(res => {
            this.rbDetails = this.normalizeDetailList(res);
            //合计费用
            // if (this.rbDetails.length > 0) this.sumTotalFee();
            for (let i = 0; i < this.rbDetails.length; i++) {
              this.sumRowFee(this.rbDetails[i]);
            }
          })
          .catch(err => {
            this.rbDetails = [];
            console.error("获取报销明细失败,id=" + ids, err);
          });
        //付款信息
        this.queryParamsPayee.rbid = ids;
@@ -1974,12 +1993,21 @@
      this.reset();
      this.open = true;
      const id = ids || this.ids;
      this.checkObj.fundid = id;
      // 重置审批信息,避免上一单的审批结果带入下一单
      this.checkObj = {
        flowlevelone: null,
        flowconclusion: null,
        fundid: id
      };
      // 连续审批:加载当前用户的待审批列表
      this.getPendingList();
      getReimbursement(id).then(response => {
        this.form = response.data;
        console.log(this.form.checkstatus, "checkstatus");
        this.form.checkstatus = this.form.checkstatus.toString();
        // checkstatus 在库中可为空(预审状态尚未产生时),直接 toString 会抛 TypeError 中断后续取数
        this.form.checkstatus = this.toStatusText(this.form.checkstatus, "-1");
        //票据
        this.fileListto = this.form.annexfiles
@@ -2006,16 +2034,22 @@
        });
        //报销明细
        getReimbursementdetaillist(ids).then(res => {
          this.rbDetails = res.data;
          console.log(this.rbDetails);
        getReimbursementdetaillist(ids)
          .then(res => {
            this.rbDetails = this.normalizeDetailList(res);
            console.log("报销明细行数:", this.rbDetails.length, this.rbDetails);
          //合计费用
          // if (this.rbDetails.length > 0) this.sumTotalFee();
          for (let i = 0; i < this.rbDetails.length; i++) {
            this.sumRowFee(this.rbDetails[i]);
          }
        });
            //合计费用
            // if (this.rbDetails.length > 0) this.sumTotalFee();
            for (let i = 0; i < this.rbDetails.length; i++) {
              this.sumRowFee(this.rbDetails[i]);
            }
          })
          .catch(err => {
            // 取数失败时不再静默:置空并打出原因,避免“接口有数据但页面空白”无从排查
            this.rbDetails = [];
            console.error("获取报销明细失败,id=" + ids, err);
          });
        //付款信息
        this.queryParamsPayee.rbid = ids;
@@ -2064,26 +2098,86 @@
        if (res.code == 200) {
          this.$modal.closeLoading();
          this.$modal.msgSuccess("提交审核成功!");
          // 关闭窗口
          this.$store.dispatch("tagsView/delView", this.$route);
          this.$router.go(-1);
          // 连续审批:询问是否继续审批下一单
          this.continueOrExit();
        } else {
          this.$modal.closeLoading();
          if (res.msg) {
            this.$modal.msgError("操作失误");
          } else {
            this.$modal.msgError(res.msg);
          }
          this.$modal.msgError(res.msg || "操作失败");
        }
      });
    },
    // 获取当前用户待审批列表(用于连续审批)
    getPendingList() {
      listbypowerone({
        pageNum: 1,
        pageSize: 1000,
        CHECKFLAG: 1
      })
        .then(res => {
          this.pendingList = res.rows || [];
        })
        .catch(() => {
          this.pendingList = [];
        });
    },
    // 审批完成后:询问是否继续审批下一单
    continueOrExit() {
      const list = this.pendingList || [];
      const curId = String(this.checkObj.fundid);
      const idx = list.findIndex(item => String(item.id) === curId);
      let next = null;
      if (idx > -1 && idx + 1 < list.length) {
        next = list[idx + 1];
      } else {
        // 当前已是末位(或从中间开始),取剩余列表中第一条非当前单据
        next = list.find(item => String(item.id) !== curId) || null;
      }
      if (next) {
        this.$confirm("审批已完成,是否继续审批下一张待审批单据?", "提示", {
          confirmButtonText: "继续审批",
          cancelButtonText: "返回列表",
          type: "info"
        })
          .then(() => {
            // 直接在当前页面加载下一张待审批单据
            this.handleCheck(next.id);
            // 同步更新地址栏,避免刷新后回到上一单
            this.$router
              .replace({
                path: this.$route.path,
                query: { id: next.id, pos: 4 }
              })
              .catch(() => { });
          })
          .catch(() => {
            this.exitToPage();
          });
      } else {
        this.$modal.msgSuccess("已无待审批单据,返回列表");
        this.exitToPage();
      }
    },
    // 返回列表页
    exitToPage() {
      this.$store.dispatch("tagsView/delView", this.$route);
      this.$router.go(-1);
    },
    /** 提交保存按钮 */
    submitForm: debounce(function (data) {
      // 2026-10-15:保存前附件文件名规范校验(仅新增单据;老单据的历史附件由后端按"只校验本次变更"放行)
      if (!this.checkDetailFileNames()) {
        return;
      }
      this.$refs["form"].validate(valid => {
        if (valid) {
          //票据文件处理
          // const addnumber = new Decimal(this.rbPayees.reduce((amount, item) => amount + Number(item.amount), 0 ));
          // const addnumber = new Decimal(this.rbPayees.reduce((amount, item) => amount + Number(item.amount), 0 ));
          // console.log(this.form.amountrequested,addnumber);
          // //校验请款金额合计是否等于报销单金额
          // if (this.form.amountrequested != addnumber) {
@@ -2163,7 +2257,7 @@
            //保存明细
            for (let i = 0; i < rbDetails.length; i++) {
              if (rbDetails[i].rbid != null) {
                if (rbDetails[i].persontype == "家属"||rbDetails[i].persontype == "专家") {
                if (rbDetails[i].persontype == "家属" || rbDetails[i].persontype == "专家") {
                  if (this.form.infoid) {
                    updateReimbursementdetail(rbDetails[i]);
                  } else {
@@ -2303,6 +2397,11 @@
    },
    // 接受提醒立刻保存
    Savenow() {
      // 2026-10-15:保存前附件文件名规范校验(仅新增单据;老单据的历史附件由后端按"只校验本次变更"放行)
      if (!this.checkDetailFileNames()) {
        return;
      }
      this.Savereminder = false;
      this.Reminderquantity = 0;
      this.totalquantity = 0;
@@ -2579,108 +2678,71 @@
        });
    },
    //计算一行合计
    //计算当前行报销内容费用合计
    sumRowFee(row) {
      let totalFee = 0;
      if (!isNaN(parseFloat(row.trafficexpense))) {
        totalFee += parseFloat(row.trafficexpense);
    /**
     * 状态类字段转字符串(接口可能返回 null)。
     *
     * 背景:checkstatus、recordstatus 等在库中可空,早期直接调用 .toString()
     * 会抛 TypeError 并中断其后的取数逻辑,表现为“接口已有数据但明细区空白”。
     *
     * @param {*} value 原始状态值
     * @param {string} fallback 为空时的兜底值
     * @returns {string}
     */
    toStatusText(value, fallback) {
      if (value === null || value === undefined || value === "") {
        return fallback;
      }
      if (!isNaN(parseFloat(row.cityfee))) {
        totalFee += parseFloat(row.cityfee);
      }
      if (!isNaN(parseFloat(row.hotelexpense))) {
        totalFee += parseFloat(row.hotelexpense);
      }
      if (!isNaN(parseFloat(row.otherexpense))) {
        totalFee += parseFloat(row.otherexpense);
      }
      if (!isNaN(parseFloat(row.foodexpenses))) {
        totalFee += parseFloat(row.foodexpenses);
      }
      if (!isNaN(parseFloat(row.foodallowance))) {
        totalFee += parseFloat(row.foodallowance);
      }
      if (!isNaN(parseFloat(row.otherfeeamount))) {
        totalFee += parseFloat(row.otherfeeamount);
      }
      row.total = totalFee.toFixed(2);
      return String(value);
    },
      /*
      if (!isNaN(parseFloat(this.rbDetails[rowIndex].trafficexpense))) {
        totalFee += parseFloat(this.rbDetails[rowIndex].trafficexpense);
    /**
     * 统一从明细接口响应中取出数组。
     *
     * 正常为 AjaxResult 的 data 数组;若后端改为分页结构(total + rows),
     * res.data 将不是数组,直接绑定到 el-table 会导致“有数据但不显示”。
     *
     * @param {Object} res 接口原始响应
     * @returns {Array} 明细数组(异常时为空数组,不会让表格拿到非数组)
     */
    normalizeDetailList(res) {
      if (!res) {
        return [];
      }
      if (!isNaN(parseFloat(this.rbDetails[rowIndex].cityfee))) {
        totalFee += parseFloat(this.rbDetails[rowIndex].cityfee);
      if (Array.isArray(res.data)) {
        return res.data;
      }
      if (!isNaN(parseFloat(this.rbDetails[rowIndex].hotelexpense))) {
        totalFee += parseFloat(this.rbDetails[rowIndex].hotelexpense);
      if (Array.isArray(res.rows)) {
        return res.rows;
      }
      if (!isNaN(parseFloat(this.rbDetails[rowIndex].otherexpense))) {
        totalFee += parseFloat(this.rbDetails[rowIndex].otherexpense);
      }
      if (!isNaN(parseFloat(this.rbDetails[rowIndex].foodexpenses))) {
        totalFee += parseFloat(this.rbDetails[rowIndex].foodexpenses);
      }
      if (!isNaN(parseFloat(this.rbDetails[rowIndex].foodallowance))) {
        totalFee += parseFloat(this.rbDetails[rowIndex].foodallowance);
      }
      if (!isNaN(parseFloat(this.rbDetails[rowIndex].otherfeeamount))) {
        totalFee += parseFloat(this.rbDetails[rowIndex].otherfeeamount);
      }
      this.rbDetails[rowIndex].total = parseFloat(totalFee).toFixed(2);
      this.$set(this.rbDetails, rowIndex, this.rbDetails[rowIndex]);
      */
      return [];
    },
    //计算一行合计
    //计算当前行报销内容费用合计(金额一律走精确运算)
    sumRowFee(row) {
      const totalFee = moneySum([
        row.trafficexpense,
        row.cityfee,
        row.hotelexpense,
        row.otherexpense,
        row.foodexpenses,
        row.foodallowance,
        row.otherfeeamount
      ]);
      row.total = moneyRound(totalFee).toFixed(2);
      //重新计算整个报销单的合计
      this.sumTotalFee();
    },
    //计算费用合计
    sumTotalFee() {
      let allSum = 0;
      //捐献者家属费用
      if (!isNaN(parseFloat(this.form.donoramount))) {
        allSum += parseFloat(this.form.donoramount);
      }
      //报销明细费用
      try {
        for (let i = 0; i < this.rbDetails.length; i++) {
          /*
          let totalFee = 0;
          //计算当前报销内容费用合计
          if (!isNaN(parseFloat(this.rbDetails[i].total))) {
            totalFee += parseFloat(this.rbDetails[i].total);
          }
          if (!isNaN(parseFloat(this.rbDetails[i].cityfee))) {
            totalFee += parseFloat(this.rbDetails[i].cityfee);
          }
          if (!isNaN(parseFloat(this.rbDetails[i].hotelexpense))) {
            totalFee += parseFloat(this.rbDetails[i].hotelexpense);
          }
          if (!isNaN(parseFloat(this.rbDetails[i].otherexpense))) {
            totalFee += parseFloat(this.rbDetails[i].otherexpense);
          }
          if (!isNaN(parseFloat(this.rbDetails[i].foodexpenses))) {
            totalFee += parseFloat(this.rbDetails[i].foodexpenses);
          }
          if (!isNaN(parseFloat(this.rbDetails[i].foodallowance))) {
            totalFee += parseFloat(this.rbDetails[i].foodallowance);
          }
          if (!isNaN(parseFloat(this.rbDetails[i].otherfeeamount))) {
            totalFee += parseFloat(this.rbDetails[i].otherfeeamount);
          }
          this.rbDetails[i].total = parseFloat(totalFee).toFixed(2);
          this.$set(this.rbDetails, i, this.rbDetails[i]);
          */
          if (!isNaN(parseFloat(this.rbDetails[i].total))) {
            allSum += parseFloat(this.rbDetails[i].total);
          }
        }
        this.form.amountrequested = allSum.toFixed(2);
        this.form.amountrequested = moneyAdd(
          moneySum(this.rbDetails, "total"),
          this.form.donoramount
        ).toFixed(2);
        this.form.bigstrmoney = this.convertCurrency(this.form.amountrequested);
      } catch { }
    },