From e57e645d24a89adb3391be16f6948b292183fa04 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期二, 11 二月 2025 14:02:07 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 src/views/projectEngineering/projectLibrary/component/investmentFunds.vue |   88 ++++++++++++++++++++++++-------------------
 1 files changed, 49 insertions(+), 39 deletions(-)

diff --git a/src/views/projectEngineering/projectLibrary/component/investmentFunds.vue b/src/views/projectEngineering/projectLibrary/component/investmentFunds.vue
index 9896aa8..e506821 100644
--- a/src/views/projectEngineering/projectLibrary/component/investmentFunds.vue
+++ b/src/views/projectEngineering/projectLibrary/component/investmentFunds.vue
@@ -197,6 +197,7 @@
   editProjectInvestmentFunding,
   getProjectInvestmentFundingById
 } from "@/api/projectEngineering/projectInvestmentFunding";
+import {editProject} from "@/api/projectEngineering/projectInfo";
 
 export default {
   name: 'InvestmentFundsForm',
@@ -205,45 +206,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.investmentForm.projectId ).then(res => {
+      getProjectInvestmentFundingById(this.$route.query.projectId).then(res => {
         this.investmentFundsForm = res.data;
       });
     },
@@ -252,7 +253,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,26 +271,35 @@
     },
   },
   mounted() {
-    this.investmentFundsForm.id = 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 parsedInvestmentForm = investmentFundsForm ? JSON.parse(investmentFundsForm) : null;
+    const parsedInvestmentFundsForm = investmentFundsForm ? JSON.parse(investmentFundsForm) : null;
     const parsedProjectForm = projectForm ? JSON.parse(projectForm) : null;
-    if (parsedInvestmentForm) {
-      this.investmentFundsForm = parsedInvestmentForm
+    if (parsedInvestmentFundsForm) {
+      this.investmentFundsForm = parsedInvestmentFundsForm
     }
-    if (parsedProjectForm){
+    if (parsedProjectForm) {
       this.projectForm = parsedProjectForm
     }
     // 濡傛灉璺敱瀛樺湪id涓旀病鏈夌紦瀛�,瑙嗕负缂栬緫鎴栨煡鐪嬶紝璋冪敤api
-    if (this.investmentFundsForm.projectId && !parsedInvestmentForm) {
+    if (this.$route.query.projectId&& !parsedInvestmentFundsForm) {
       this.getInvestmentFunds();
     }
+
+    this.investmentFundsForm.projectId = this.projectForm.id;
   },
   beforeDestroy() {
-    Cookies.set("investmentFundsForm", JSON.stringify(this.investmentFundsForm));
+    if(Object.keys(this.investmentFundsForm).length !==0) localStorage.setItem("investmentFundsForm", JSON.stringify(this.investmentFundsForm));
   },
+  watch: {
+    investmentFundsForm: {
+      deep: true,
+      handler(newVal) {
+        this.$emit('investmentFundsForm', newVal)
+      }
+    }
+  }
 }
 </script>
 

--
Gitblit v1.8.0