fuliqi
2024-11-29 7adbf0551f6a6b307e66cdd6537ab45fc5a2bf11
src/views/projectEngineering/projectLibrary/component/investmentFunds.vue
@@ -205,45 +205,45 @@
      type: Boolean,
      default: false,
      required: true
    }
    },
  },
  data() {
    return {
      projectForm: {},
      investmentFundsForm: {
        id: '',
        projectId: '',
        totalInvestment: '',
        principal: '',
        governmentInvestmentTotal: '',
        centralInvestmentTotal: '',
        centralBudgetInvestment: '',
        centralFiscalInvestment: '',
        centralSpecialBondInvestment: '',
        centralSpecialFundInvestment: '',
        provincialInvestmentTotal: '',
        provincialBudgetInvestment: '',
        provincialFiscalInvestment: '',
        provincialSpecialFundInvestment: '',
        cityInvestmentTotal: '',
        cityBudgetInvestment: '',
        cityFiscalInvestment: '',
        citySpecialFundInvestment: '',
        countyInvestmentTotal: '',
        countyBudgetInvestment: '',
        countyFiscalInvestment: '',
        countySpecialFundInvestment: '',
        domesticLoanTotal: '',
        bankLoan: '',
        foreignInvestmentTotal: '',
        enterpriseSelfRaisedTotal: '',
        otherInvestmentTotal: ''
        // id: '',
        // projectId: '',
        // totalInvestment: '',
        // principal: '',
        // governmentInvestmentTotal: '',
        // centralInvestmentTotal: '',
        // centralBudgetInvestment: '',
        // centralFiscalInvestment: '',
        // centralSpecialBondInvestment: '',
        // centralSpecialFundInvestment: '',
        // provincialInvestmentTotal: '',
        // provincialBudgetInvestment: '',
        // provincialFiscalInvestment: '',
        // provincialSpecialFundInvestment: '',
        // cityInvestmentTotal: '',
        // cityBudgetInvestment: '',
        // cityFiscalInvestment: '',
        // citySpecialFundInvestment: '',
        // countyInvestmentTotal: '',
        // countyBudgetInvestment: '',
        // countyFiscalInvestment: '',
        // countySpecialFundInvestment: '',
        // domesticLoanTotal: '',
        // bankLoan: '',
        // foreignInvestmentTotal: '',
        // enterpriseSelfRaisedTotal: '',
        // otherInvestmentTotal: ''
      }
    };
  },
  methods: {
    getInvestmentFunds() {
      getProjectInvestmentFundingById(this.investmentFundsForm.projectId ).then(res => {
      getProjectInvestmentFundingById(this.$route.query.projectId).then(res => {
        this.investmentFundsForm = res.data;
      });
    },
@@ -252,7 +252,7 @@
        this.$message.error("请先保存投资管理基本信息")
      } else {
        this.investmentFundsForm.projectId = this.projectForm.id;
        if (this.investmentFundsForm.id != null) {
        if (this.investmentFundsForm.id) {
          editProjectInvestmentFunding(this.investmentFundsForm).then(response => {
            this.$modal.msgSuccess("修改成功");
            //跳转到下个组件
@@ -270,9 +270,8 @@
    },
  },
  mounted() {
    this.investmentFundsForm.projectId = this.$route.query.projectId;
    const investmentFundsForm = Cookies.get("investmentFundsForm");
    const projectForm = Cookies.get("projectForm");
    const investmentFundsForm = localStorage.getItem("investmentFundsForm");
    const projectForm = localStorage.getItem("projectForm");
    const parsedInvestmentFundsForm = investmentFundsForm ? JSON.parse(investmentFundsForm) : null;
    const parsedProjectForm = projectForm ? JSON.parse(projectForm) : null;
@@ -283,12 +282,12 @@
      this.projectForm = parsedProjectForm
    }
    // 如果路由存在id且没有缓存,视为编辑或查看,调用api
    if (this.investmentFundsForm.projectId && !parsedInvestmentFundsForm) {
    if (this.$route.query.projectId&& !parsedInvestmentFundsForm) {
      this.getInvestmentFunds();
    }
  },
  beforeDestroy() {
    Cookies.set("investmentFundsForm", JSON.stringify(this.investmentFundsForm));
    if(Object.keys(this.investmentFundsForm).length !==0) localStorage.setItem("investmentFundsForm", JSON.stringify(this.investmentFundsForm));
  },
}
</script>