11
WXL
2023-09-01 82e5c3fbbc8f15767e22b5dd698c704002ef1652
11
已修改1个文件
117 ■■■■ 文件已修改
src/views/project/fund/applyDetail/index.vue 117 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/project/fund/applyDetail/index.vue
@@ -1206,8 +1206,39 @@
      atpresent: "",
      Savereminder: false, //提醒保存弹框
      Reminderquantity: 0, //提醒数量
      totalquantity: 0 //总数量
      totalquantity: 0, //总数量
      Modifyornot: 0 //是否修改
    };
  },
  // vue路由控制页面关闭提示
  beforeRouteLeave(to, from, next) {
    if (
      JSON.stringify(this.form) == sessionStorage.getItem("apiform") &&
      JSON.stringify(this.rbDetails) == sessionStorage.getItem("apifunddetail")
    ) {
      console.log("cg1");
      sessionStorage.removeItem("apiform");
      sessionStorage.removeItem("apifunddetail");
      //就是上面的状态 如果是true , 则不询问是否保存, 当然这个方法比较笨, 大家可以使用更优雅的方式
      next();
    } else {
      console.log("cg2");
      this.$confirm("离开页面 , 更新数据将不做保存, 请确认已经保存", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
        .then(() => {
          sessionStorage.removeItem("apiform");
          sessionStorage.removeItem("apifunddetail");
          this.$router.go(-1);
          next();
        })
        .catch(() => {
          // alert("router")
        });
    }
  },
  //监听属性 类似于data概念
  computed: {},
@@ -1215,6 +1246,25 @@
  watch: {},
  //方法集合
  methods: {
    // 浏览器页面关闭或刷新提示
    beforeunloadHandler(e) {
      if (
        (JSON.stringify(this.form) == sessionStorage.getItem("apiform") &&
          JSON.stringify(this.rbDetails) ==
            sessionStorage.getItem("apifunddetail")) ||
        !sessionStorage.getItem("apifunddetail")
      ) {
        console.log(cg);
      } else {
        this._beforeUnload_time = new Date().getTime();
        e = e || window.event;
        if (e) {
          e.returnValue = "关闭提示";
        }
        return "关闭提示";
      }
    },
    // 表单重置
    reset() {
      this.form = {
@@ -1266,16 +1316,14 @@
    },
    // 获取请求头
    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);
        // console.log(this.Networkheader);
      } else {
        const index = string.indexOf("8032");
        this.Networkheader = string.slice(0, index + 4); // 截取8032及其前部字符
        console.log(this.Networkheader);
      }
    },
    /** 通过参数获取业务类型 */
@@ -1360,6 +1408,10 @@
      getFund(this.curId).then(response => {
        this.form = response.data;
        sessionStorage.removeItem("apiform");
        sessionStorage.setItem("apiform", JSON.stringify(this.form));
        // this.form.recordstate =-1;
        // this.form.recordstatus = response.data.recordstatus + "";
        //附件处理
@@ -1368,6 +1420,7 @@
        //明细处理
        getownFundDetail(this.curId).then(res => {
          this.rbDetails = res.data;
          if (this.rbDetails.length > 0) {
            for (let m = 0; m < this.rbDetails.length; m++) {
              this.rbDetails[m].itemlist = [];
@@ -1393,6 +1446,12 @@
              //   });
              // });
            }
            console.log("yeil");
            sessionStorage.removeItem("apifunddetail");
            sessionStorage.setItem(
              "apifunddetail",
              JSON.stringify(this.rbDetails)
            );
          } else {
            this.addRow(0);
          }
@@ -1407,6 +1466,10 @@
      getFund(this.curId).then(response => {
        this.form = response.data;
        sessionStorage.removeItem("apiform");
        sessionStorage.setItem("apiform", JSON.stringify(this.form));
        console.log("response.data", response.data);
        //附件处理
        // this.fileList = this.form.annexbankcard ? this.form.annexbankcard.split(",").map(item => ({ url: item, name: item })) : []
@@ -1450,6 +1513,10 @@
      getFund(this.curId).then(response => {
        this.form = response.data;
        sessionStorage.removeItem("apiform");
        sessionStorage.setItem("apiform", JSON.stringify(this.form));
        //附件处理
        // this.fileList = this.form.annexbankcard ? this.form.annexbankcard.split(",").map(item => ({ url: item, name: item })) : []
@@ -1637,7 +1704,7 @@
            }
            this.rbDetails[i] = tempDetail;
            /*
            //计算个税
            //计算个税
            //if (isNaN(parseFloat(tempDetail.taxedamount)))
            //获取参数
            this.taxParam.beneficiaryNo = tempDetail.beneficiaryno;
@@ -1651,13 +1718,13 @@
                  tempDetail.taxamount = res.data;
                  tempDetail.taxedamount = tempDetail.amount - tempDetail.taxamount;
                  this.rbDetails[k] = tempDetail;
                  this.totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
                  this.totalAmount += parseFloat(tempDetail.amount);
                }
              });
            }
            // 计算税前、税费、税后金额
            if (tempDetail.amount == undefined || tempDetail.amount == null || tempDetail.amount == 0 || tempDetail.amount == '') {
              //获取参数
@@ -1667,7 +1734,7 @@
                  tempDetail.taxamount = res.data.nowTax;
                  tempDetail.amount = parseFloat(res.data.nowTaxBeforeMoney);
                  this.rbDetails[k] = tempDetail;
                  this.totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
                  this.totalAmount += parseFloat(tempDetail.amount);
                }
@@ -1766,6 +1833,11 @@
              this.$modal.msgError("申请单保存失败:" + response.msg);
            }
          });
          sessionStorage.setItem(
            "apifunddetail",
            JSON.stringify(this.rbDetails)
          );
          sessionStorage.setItem("apiform", JSON.stringify(this.form));
          //关闭窗口
          this.loading = false;
@@ -2253,7 +2325,7 @@
            }
            this.rbDetails[i] = tempDetail;
            /*
            //计算个税
            //计算个税
            //if (isNaN(parseFloat(tempDetail.taxedamount)))
            //获取参数
            this.taxParam.beneficiaryNo = tempDetail.beneficiaryno;
@@ -2267,13 +2339,13 @@
                  tempDetail.taxamount = res.data;
                  tempDetail.taxedamount = tempDetail.amount - tempDetail.taxamount;
                  this.rbDetails[k] = tempDetail;
                  this.totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
                  this.totalAmount += parseFloat(tempDetail.amount);
                }
              });
            }
            // 计算税前、税费、税后金额
            if (tempDetail.amount == undefined || tempDetail.amount == null || tempDetail.amount == 0 || tempDetail.amount == '') {
              //获取参数
@@ -2283,7 +2355,7 @@
                  tempDetail.taxamount = res.data.nowTax;
                  tempDetail.amount = parseFloat(res.data.nowTaxBeforeMoney);
                  this.rbDetails[k] = tempDetail;
                  this.totalAfterTaxAmount += parseFloat(tempDetail.taxedamount);
                  this.totalAmount += parseFloat(tempDetail.amount);
                }
@@ -2378,6 +2450,11 @@
          addorupdateFund(this.form).then(response => {
            if (response.code === 200) {
              this.$modal.msgSuccess("申请单保存成功!");
              this.Getnetworkheader();
              this.getroute();
              this.getExternalList();
              this.getUserList();
              this.getUserProfile();
            } else {
              this.$modal.msgError("申请单保存失败:" + response.msg);
            }
@@ -2637,7 +2714,8 @@
        this.form.filename = file.raw.name;
        this.$modal.msgSuccess(response.msg);
        this.fileListto.push({ name: file.name, url: response.fileName });
        // this.fileListto.push({ name: file.name, url: response.fileName });
        this.fileListto.push({ name: file.name, url: response.url });
        this.rbDetails[this.atpresent].annexfilesList = this.fileListto;
      } else {
        console.log(response.msg);
@@ -2650,7 +2728,8 @@
      this.pdfVisible = true;
      if (this.rbDetails[index].annexfilesList) {
        this.fileListto = this.rbDetails[index].annexfilesList;
        this.pdfimg = this.Networkheader + "/prod-api" + this.fileListto[0].url;
        // this.pdfimg = this.Networkheader + "/prod-api" + this.fileListto[0].url;
        this.pdfimg = this.fileListto[0].url;
        this.pdfimgsrcList = [];
        this.pdfimgsrcList.push(this.pdfimg);
        console.log(this.pdfimg);
@@ -2844,14 +2923,22 @@
  //生命周期 - 挂载完成(可以访问DOM元素)
  mounted() {
    window.addEventListener("beforeunload", e => this.beforeunloadHandler(e));
    this.getUserList();
    this.getUserProfile();
    let apifunddetailForm = this.funddetailForm;
    let apiform = this.form;
    console.log(apiform);
    console.log(apifunddetailForm);
    // this.getFeeUnitList();
  },
  beforeCreate() {}, //生命周期 - 创建之前
  beforeMount() {}, //生命周期 - 挂载之前
  beforeUpdate() {}, //生命周期 - 更新之前
  beforeUpdate() {
    console.log("beforeUpdate");
  }, //生命周期 - 更新之前
  updated() {}, //生命周期 - 更新之后
  beforeDestroy() {}, //生命周期 - 销毁之前
  destroyed() {}, //生命周期 - 销毁完成