yxh
2026-09-20 c870390bfc28b314f30240352895c5d6c466c148
src/views/project/fund/applyDetail/index.vue
@@ -69,6 +69,14 @@
              <el-input :disabled="true" v-model="form.donorname" placeholder="请输入捐献者姓名" />
            </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-col :span="10">
            <el-form-item label="申请说明" prop="remark">
              <el-input v-model="form.remark" placeholder="申请说明" />
@@ -727,7 +735,8 @@
  getdownloadBX,
  addorupdateFund,
  ManualCalculation,
  getdetailsByItemId
  getdetailsByItemId,
  listbypower
} from "@/api/project/fund";
import {
@@ -777,6 +786,7 @@
import Li_area_select from "@/components/Address";
import OrgSelecter from "@/views/project/components/orgselect";
import { getToken } from "@/utils/auth";
import { moneySum, moneyMul, moneySub, moneyRound } from "@/utils/money";
import CustomImageViewer from "@/components/CustomImageViewer"; // 根据你的路径调整
export default {
@@ -800,11 +810,12 @@
    //"sys_finsubject",
    //"sys_financeitemtype",
    //"sys_expensetype",
    'sys_DonationStatus',
    "sys_recordstatus",
    "sys_professionaltitle"
  ],
  data() {
  data() {
    // 自定义身份证号校验器
    const validateIdCard = (rule, value, callback) => {
      // 1. 如果为空,交给 required 规则去处理,这里直接放行
@@ -1020,6 +1031,8 @@
        flowconclusion: null,
        fundid: null
      },
      // 连续审批:待审批单据列表
      pendingList: [],
      // 查询参数
      queryParams: {
@@ -1268,9 +1281,12 @@
        this.businessType == "2" ||
        this.businessType == "3"
      ) {
        console.log(this.curCase,'this.curCase');
        this.form.infoid = this.curCase.id;
        this.form.donorname = this.curCase.name;
        this.form.donorno = this.curCase.donorno;
        this.form.invoicecount = this.curCase.recordstate;
      }
      //初始化明细
@@ -1373,6 +1389,14 @@
    handleCheck() {
      this.isopen = 0;
      this.reset();
      // 重置审批信息,避免上一单的审批结果带入下一单
      this.checkObj = {
        flowlevelone: null,
        flowconclusion: null,
        fundid: null
      };
      // 连续审批:加载当前业务类型下的待审批列表
      this.getPendingList();
      getFund(this.curId).then(response => {
        this.form = response.data;
@@ -1584,7 +1608,7 @@
              let tempDetail = this.rbDetails[j];
              if (
                isNaN(parseFloat(tempDetail.amount)) ||
                parseFloat(tempDetail.amount) == 0
                moneyRound(tempDetail.amount) == 0
              ) {
                this.$modal.msgWarning(
                  "服务项目表中,第" +
@@ -1599,7 +1623,7 @@
              let tempDetail = this.rbDetails[j];
              if (
                isNaN(parseFloat(tempDetail.amount)) ||
                parseFloat(tempDetail.amount) == 0
                moneyRound(tempDetail.amount) == 0
              ) {
                this.$modal.msgWarning(
                  "服务项目表中,第" +
@@ -1610,7 +1634,7 @@
              }
              if (
                isNaN(parseFloat(tempDetail.taxamount)) ||
                parseFloat(tempDetail.taxamount) == 0
                moneyRound(tempDetail.taxamount) == 0
              ) {
                tempDetail.taxedamount = parseFloat(tempDetail.amount);
              } else {
@@ -1748,6 +1772,66 @@
      this.Savenow();
      console.log("保存并审批");
    },
    // 连续审批:获取当前业务类型下的待审批列表
    getPendingList() {
      return listbypower({
        pageNum: 1,
        pageSize: 1000,
        CHECKFLAG: 1,
        APPLYTYPE: this.businessType
      })
        .then(res => {
          this.pendingList = res.rows || [];
        })
        .catch(() => {
          this.pendingList = [];
        });
    },
    // 连续审批:审批完成后询问是否继续审批下一单
    continueOrExit() {
      // 重新拉取待审批列表(当前单据已审批完成被移出列表)
      this.getPendingList().then(() => {
        const list = this.pendingList || [];
        const next = list[0] || null;
        if (next) {
          this.$confirm("审批已完成,是否继续审批下一张待审批单据?", "提示", {
            confirmButtonText: "继续审批",
            cancelButtonText: "返回列表",
            type: "info"
          })
            .then(() => {
              // 在当前页面直接加载下一张待审批单据
              this.curId = next.id;
              this.handleCheck();
              // 同步更新地址栏,避免刷新后回到上一单
              this.$router
                .replace({
                  path: this.$route.path,
                  query: {
                    id: next.id,
                    businessType: this.businessType,
                    operationType: "check"
                  }
                })
                .catch(() => {});
            })
            .catch(() => {
              this.exitToPage();
            });
        } else {
          this.$modal.msgSuccess("已无待审批单据,返回列表");
          this.exitToPage();
        }
      });
    },
    // 返回列表页
    exitToPage() {
      this.$store.dispatch("tagsView/delView", this.$route);
      this.$router.go(-1);
    },
    // 取消按钮
@@ -2022,14 +2106,13 @@
    //计算个税:type(A:已知税前金额,计算税后金额;B:已知税后金额,计算税前金额)
    calculateTax(row, type) {
      let targetValue = 0;
      for (let i = 0; i < this.rbDetails.length; i++) {
        if (!this.rbDetails[i].amount) {
          this.rbDetails[i].amount = 0;
        }
        targetValue += parseFloat(this.rbDetails[i].amount); // 假设每个对象中的特定值存储在'specificValue'属性下
      }
      this.form.pretaxcost = targetValue;
      // 合计金额必须精确累加,否则会写入 form.pretaxcost 并落库
      this.form.pretaxcost = moneySum(this.rbDetails, "amount");
    },
    //导入所有项目
@@ -2191,7 +2274,7 @@
              let tempDetail = this.rbDetails[j];
              if (
                isNaN(parseFloat(tempDetail.amount)) ||
                parseFloat(tempDetail.amount) == 0
                moneyRound(tempDetail.amount) == 0
              ) {
                this.$modal.msgWarning(
                  "服务项目表中,第" +
@@ -2206,7 +2289,7 @@
              let tempDetail = this.rbDetails[j];
              if (
                isNaN(parseFloat(tempDetail.amount)) ||
                parseFloat(tempDetail.amount) == 0
                moneyRound(tempDetail.amount) == 0
              ) {
                this.$modal.msgWarning(
                  "服务项目表中,第" +
@@ -2217,7 +2300,7 @@
              }
              if (
                isNaN(parseFloat(tempDetail.taxamount)) ||
                parseFloat(tempDetail.taxamount) == 0
                moneyRound(tempDetail.taxamount) == 0
              ) {
                tempDetail.taxedamount = parseFloat(tempDetail.amount);
              } else {
@@ -2258,8 +2341,8 @@
                    //关闭窗口
                    this.$modal.closeLoading();
                    this.$modal.msgSuccess("审核完成!");
                    this.$store.dispatch("tagsView/delView", this.$route);
                    this.$router.go(-1);
                    // 连续审批:询问是否继续审批下一单
                    this.continueOrExit();
                  } else {
                    this.$modal.closeLoading();
@@ -2498,33 +2581,32 @@
        });
      //全部删除后添加一条新行
    },
    //计算总金额
    //计算总金额(金额一律走精确运算,禁止 parseFloat 累加)
    sumTotalFee(row) {
      let allSum = 0;
      const detailsArr = [];
      if (this.form.applytype != null) {
        for (let i = 0; i < this.rbDetails.length; i++) {
          const detail = this.rbDetails[i];
          let totalFee = 0;
          let taxFee = 0;
          if (this.form.applytype == 1 || this.form.applytype == 2) {
            //计算当前报销内容费用合计
            if (!isNaN(parseFloat(this.rbDetails[i].amount))) {
              totalFee += parseFloat(this.rbDetails[i].amount);
              taxFee += parseFloat(this.rbDetails[i].amount);
            //计算当前报销内容费用合计:税前 - 扣税
            if (!isNaN(parseFloat(detail.amount))) {
              totalFee = moneySub(totalFee, -parseFloat(detail.amount));
              taxFee = moneySub(taxFee, -parseFloat(detail.amount));
            }
            if (!isNaN(parseFloat(this.rbDetails[i].taxamount))) {
              totalFee -= parseFloat(this.rbDetails[i].taxamount);
              taxFee -= parseFloat(this.rbDetails[i].taxamount);
            if (!isNaN(parseFloat(detail.taxamount))) {
              totalFee = moneySub(totalFee, detail.taxamount);
              taxFee = moneySub(taxFee, detail.taxamount);
            }
          } else if (this.form.applytype == 3 || this.form.applytype == 4) {
            //单价*数量=税前金额
            if (
              !isNaN(parseFloat(this.rbDetails[i].price)) &&
              !isNaN(parseFloat(this.rbDetails[i].quantity))
              !isNaN(parseFloat(detail.price)) &&
              !isNaN(parseFloat(detail.quantity))
            ) {
              totalFee +=
                parseFloat(this.rbDetails[i].price) *
                parseFloat(this.rbDetails[i].quantity);
              this.rbDetails[i].amount = totalFee;
              totalFee = moneyMul(detail.price, detail.quantity);
              detail.amount = totalFee;
            }
          }
@@ -2533,9 +2615,10 @@
          //   this.rbDetails[i].taxedamount = taxFee.toFixed(2);
          // }
          allSum += totalFee;
          detailsArr.push(totalFee);
        }
      }
      const allSum = moneyRound(moneySum(detailsArr));
      // this.form.amountrequested = allSum.toFixed(2);
      // this.$forceUpdate();
    },
@@ -3238,7 +3321,9 @@
  //生命周期 - 挂载完成(可以访问DOM元素)
  mounted() {
    window.addEventListener("beforeunload", e => this.beforeunloadHandler(e));
    // 存住同一个引用,否则 removeEventListener 传新箭头函数无法真正移除,会泄漏监听器
    this._beforeUnloadHandler = e => this.beforeunloadHandler(e);
    window.addEventListener("beforeunload", this._beforeUnloadHandler);
    this.getUserList();
    let apiaccountselectform = this.accountselectform;
    let apiform = this.form;
@@ -3254,7 +3339,10 @@
  updated() { }, //生命周期 - 更新之后
  beforeDestroy() { }, //生命周期 - 销毁之前
  destroyed() {
    window.removeEventListener("beforeunload", e => this.beforeunloadFn(e));
    if (this._beforeUnloadHandler) {
      window.removeEventListener("beforeunload", this._beforeUnloadHandler);
      this._beforeUnloadHandler = null;
    }
  }, //生命周期 - 销毁完成
  activated() { } //如果页面有keep-alive缓存功能,这个函数会触发
};