From b1c351f8a0d16008524d4f17bb1948f836f5a7b0 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期四, 28 十一月 2024 17:02:47 +0800
Subject: [PATCH] 项目库增改

---
 src/views/projectEngineering/projectLibrary/component/investmentFunds.vue |   12 
 src/views/projectEngineering/projectLibrary/index.vue                     |    4 
 src/views/projectEngineering/projectLibrary/component/PolicyInfo.vue      |  151 ++++++++++++++-------
 src/api/projectEngineering/projectInfo.js                                 |   15 ++
 src/views/projectEngineering/projectLibrary/component/legalPerson.vue     |   97 ++++++++++---
 src/views/projectEngineering/projectLibrary/projectDetails.vue            |    4 
 src/components/FileUpload/index.vue                                       |    2 
 src/views/projectEngineering/projectLibrary/component/DocumentsInfo.vue   |   82 +++++++---
 8 files changed, 253 insertions(+), 114 deletions(-)

diff --git a/src/api/projectEngineering/projectInfo.js b/src/api/projectEngineering/projectInfo.js
index 8829fc2..1afcc70 100644
--- a/src/api/projectEngineering/projectInfo.js
+++ b/src/api/projectEngineering/projectInfo.js
@@ -17,6 +17,13 @@
   })
 }
 
+// 鏌ヨ鐩稿叧鏂囦欢
+export function getDocumentInfoById(id) {
+  return request({
+    url: '/project/info/document/' + id,
+    method: 'get'
+  })
+}
 // 鏂板椤圭洰绠$悊鍩虹淇℃伅
 export function addProject(data) {
   return request({
@@ -25,6 +32,14 @@
     data: data
   })
 }
+// 鏂板鐩稿叧鏂囦欢
+export function addDocumentInfo(data) {
+  return request({
+    url: '/project/info/document',
+    method: 'post',
+    data: data
+  })
+}
 
 // 淇敼椤圭洰绠$悊鍩虹淇℃伅
 export function updateProject(data) {
diff --git a/src/components/FileUpload/index.vue b/src/components/FileUpload/index.vue
index 6ae8059..2cb9b1b 100644
--- a/src/components/FileUpload/index.vue
+++ b/src/components/FileUpload/index.vue
@@ -56,7 +56,7 @@
     // 澶у皬闄愬埗(MB)
     fileSize: {
       type: Number,
-      default: 5,
+      default: 20,
     },
     // 鏂囦欢绫诲瀷, 渚嬪['png', 'jpg', 'jpeg']
     fileType: {
diff --git a/src/views/projectEngineering/projectLibrary/component/DocumentsInfo.vue b/src/views/projectEngineering/projectLibrary/component/DocumentsInfo.vue
index fd71b70..de37951 100644
--- a/src/views/projectEngineering/projectLibrary/component/DocumentsInfo.vue
+++ b/src/views/projectEngineering/projectLibrary/component/DocumentsInfo.vue
@@ -1,14 +1,14 @@
 <template>
   <div class="policy-info">
-    <el-form ref="demoFormRef" :disabled="disabled" :model="fileIdList" class="dialog_form">
+    <el-form ref="demoFormRef" :disabled="disabled" :model="documentsInfoForm" class="dialog_form">
       <el-row :gutter="0">
         <el-col :span="20">
           <el-form-item label="闄勪欢:" label-width="100px" prop="appendix" style="width: 100%">
             <div style="display: flex;gap: 10px">
-              <file-upload v-model="documentsInfoList"
+              <file-upload v-model="documentsInfoForm.fileList"
                            :fileType="accept"
                            :isShowTip="false"/>
-              <div v-if="documentsInfoList.length === 0" style="color: #a9afbc">鏀寔涓婁紶PDF鏍煎紡鏂囦欢</div>
+              <div v-if="documentsInfoForm.fileList.length === 0" style="color: #a9afbc">鏀寔涓婁紶PDF鏍煎紡鏂囦欢</div>
             </div>
           </el-form-item>
         </el-col>
@@ -18,6 +18,14 @@
 </template>
 
 <script>
+
+import {
+  addProjectInvestmentFunding,
+  editProjectInvestmentFunding,
+  getProjectInvestmentFundingById
+} from "@/api/projectEngineering/projectInvestmentFunding";
+import Cookies from "js-cookie";
+import {addDocumentInfo, getDocumentInfoById} from "@/api/projectEngineering/projectInfo";
 
 export default {
   props: {
@@ -29,36 +37,56 @@
   },
   data() {
     return {
-      fileIdList: [],
-      documentsInfoList: [],
-      accept: ['pdf', 'docx', 'xlsx', 'jpg','jpeg'],
+      documentsInfoForm: {
+        fileList: [],
+        projectId: ''
+      },
+      projectForm: {},
+      accept: ['pdf'],
     };
   },
-  watch: {
-    // 鐩戝惉 documentsInfoList 鐨勫彉鍖栵紝骞舵洿鏂� fileIdList
-    documentsInfoList(newVal) {
-      this.fileIdList = newVal.map(item => item.fileId);
+  methods: {
+    getDocumentsInfo() {
+      getDocumentInfoById(this.documentsInfoForm.projectId).then(res => {
+        this.documentsInfoForm = res.data;
+        if(!this.documentsInfoForm.fileList) {
+          this.documentsInfoForm.fileList = []
+        }
+      });
+    },
+    submit() {
+      if (!this.projectForm.id) {
+        this.$message.error("璇峰厛淇濆瓨鎶曡祫绠$悊鍩烘湰淇℃伅")
+      } else {
+        this.documentsInfoForm.projectId = this.projectForm.id;
+        addDocumentInfo(this.documentsInfoForm).then(response => {
+          this.$modal.msgSuccess("鎻愪氦鎴愬姛");
+        });
+      }
+    },
+  },
+  mounted() {
+    this.documentsInfoForm.projectId = this.$route.query.projectId;
+    const documentsInfoForm = Cookies.get("documentsInfoForm");
+    const projectForm = Cookies.get("projectForm");
+
+    const parsedDocumentsInfoForm = documentsInfoForm ? JSON.parse(documentsInfoForm) : null;
+    const parsedProjectForm = projectForm ? JSON.parse(projectForm) : null;
+    if (parsedDocumentsInfoForm) {
+      this.documentsInfoForm = parsedDocumentsInfoForm
+    }
+    if (parsedProjectForm) {
+      this.projectForm = parsedProjectForm
+    }
+    // 濡傛灉璺敱瀛樺湪id涓旀病鏈夌紦瀛�,瑙嗕负缂栬緫鎴栨煡鐪嬶紝璋冪敤api
+    if (this.documentsInfoForm.projectId && !parsedDocumentsInfoForm) {
+      this.getDocumentsInfo();
     }
   },
-  methods: {
-    submit() {
-      console.log("鏂囦欢submit")
-    },
-    handleRemove(file) {
-      if (file) {
-        this.fileIdList = this.documentsInfoList.map(item => item.fileId);
-        localStorage.setItem('fileIdList', JSON.stringify(file));
-      }
-    },
-    handleAdd(file) {
-      if (file && file.length > 0) {
-        localStorage.setItem('fileIdList', JSON.stringify(file));
-      }
-    }
+  beforeDestroy() {
+    Cookies.set("documentsInfoForm", JSON.stringify(this.documentsInfoForm));
   },
 
-  mounted() {
-  }
 };
 </script>
 
diff --git a/src/views/projectEngineering/projectLibrary/component/PolicyInfo.vue b/src/views/projectEngineering/projectLibrary/component/PolicyInfo.vue
index 2aa6cf7..815c2dc 100644
--- a/src/views/projectEngineering/projectLibrary/component/PolicyInfo.vue
+++ b/src/views/projectEngineering/projectLibrary/component/PolicyInfo.vue
@@ -1,30 +1,31 @@
 <template>
   <div class="policy-info">
     <el-form
-      ref="demoFormRef"
+      ref="policyInfoFormRef"
       :disabled="disabled"
-      :model="investmentProjectPolicyComplianceDTO"
+      :model="policyInfoForm"
       :rules="rules"
     >
       <el-row :gutter="0">
         <el-col :span="20">
           <el-form-item label="绗﹀悎琛屼笟鏀跨瓥:" label-width="180px" prop="industryPolicy" style="width: 100%">
             <div style="display: flex">
-              <file-upload v-model="fileList"
+              <file-upload v-model="policyInfoForm.fileList"
                            :fileType="accept"
                            :isShowTip="false"/>
-              <div v-if="fileList.length === 0" style="color: #a9afbc; margin-left: 10px">
-                鏀寔涓嬭浇PDF鏍煎紡鏂囦欢
+              <div v-if="policyInfoForm.fileList.length === 0" style="color: #a9afbc; margin-left: 10px">
+                鏀寔涓婁紶PDF鏍煎紡鏂囦欢
               </div>
             </div>
           </el-form-item>
         </el-col>
 
         <el-col :span="20">
-          <el-form-item class="custom-form-item" label=" " label-position="right" label-width="180px" style="width: 100%; margin-top: -20px">
+          <el-form-item class="custom-form-item" label=" " label-position="right" label-width="180px"
+                        style="width: 100%; margin-top: -20px">
             <div class="input-row policy-items">
-              <el-radio-group v-model="investmentProjectPolicyComplianceDTO.belongsToIndustryAdjustmentDirectory" class="radio-item">
-                <el-radio size="large" style="margin-bottom: 25px" :label="true">灞炰簬銆婁骇涓氱粨鏋勮皟鏁存寚瀵肩洰褰曘�嬩笅鐨勯」鐩� </el-radio>
+              <el-radio-group v-model="policyInfoForm.belongsToIndustryAdjustmentDirectory" class="radio-item">
+                <el-radio size="large" style="margin-bottom: 25px" :label="true">灞炰簬銆婁骇涓氱粨鏋勮皟鏁存寚瀵肩洰褰曘�嬩笅鐨勯」鐩�</el-radio>
                 <el-radio size="large" :label="false">灞炰簬鏈垪鍏ャ�婁骇涓氱粨鏋勮皟鏁存寚瀵肩洰褰曘�嬬殑鍏佽绫婚」鐩�</el-radio>
               </el-radio-group>
             </div>
@@ -32,10 +33,11 @@
         </el-col>
 
         <el-col :span="20">
-          <el-form-item class="custom-form-item" label=" " label-width="180px" style="width: 100%; margin-top: -20px; height: 50px">
+          <el-form-item class="custom-form-item" label=" " label-width="180px"
+                        style="width: 100%; margin-top: -20px; height: 50px">
             <div class="input-row policy-items">
               <el-checkbox
-                v-model="investmentProjectPolicyComplianceDTO.belongsToWesternEncouragedDirectory"
+                v-model="policyInfoForm.belongsToWesternEncouragedDirectory"
                 label="灞炰簬銆婅タ閮ㄥ湴鍖洪紦鍔辩被浜т笟鐩綍銆嬬殑椤圭洰"
                 size="large"
                 style="margin-right: 70px"
@@ -44,10 +46,11 @@
           </el-form-item>
         </el-col>
         <el-col :span="20">
-          <el-form-item class="custom-form-item" label=" " label-width="180px" style="width: 100%; margin-top: -20px; height: 30px">
+          <el-form-item class="custom-form-item" label=" " label-width="180px"
+                        style="width: 100%; margin-top: -20px; height: 30px">
             <div class="input-row policy-items" style="height: 52px">
               <el-checkbox
-                v-model="investmentProjectPolicyComplianceDTO.notBannedOrControlledProject"
+                v-model="policyInfoForm.notBannedOrControlledProject"
                 disabled
                 label="涓嶅睘浜庝骇涓氭斂绛栫姝㈡姇璧勫缓璁炬垨瀹炶鏍稿噯銆佸鎵圭鐞嗙殑椤圭洰"
                 size="large"
@@ -58,11 +61,12 @@
           </el-form-item>
         </el-col>
         <el-col :span="20">
-          <el-form-item class="custom-form-item" label="濉姤淇℃伅鐪熷疄" label-width="180px" style="width: 100%; margin-top: 20px">
+          <el-form-item class="custom-form-item" label="濉姤淇℃伅鐪熷疄" label-width="180px"
+                        style="width: 100%; margin-top: 20px">
             <div class="policy-items">
               <div style="color: #a9afbc">澶囨鑰呮壙璇�:</div>
               <el-checkbox
-                v-model="investmentProjectPolicyComplianceDTO.informationIsTrue"
+                v-model="policyInfoForm.informationIsTrue"
                 disabled
                 label="鎵�鎻愪緵鐨勫妗堜俊鎭槸鐪熷疄銆佸噯纭�佸畬鏁村拰鏈夋晥鐨�,鏃犻殣鐬掋�佽櫄鍋囧拰閲嶅ぇ閫犳紡涔嬪锛屽澶囨椤圭洰淇℃伅鐨勭湡瀹炴�ц礋璐�"
                 size="large"
@@ -76,7 +80,7 @@
           <el-form-item label="涓撻」瑙勫垝绗﹀悎鎯呭喌:" label-width="180px" prop="specialPlanningCompliance" style="width: 100%">
             <div class="input-row">
               <el-input
-                v-model.trim="investmentProjectPolicyComplianceDTO.specialPlanningCompliance"
+                v-model.trim="policyInfoForm.specialPlanningCompliance"
                 class="input-item"
                 maxlength="200"
                 placeholder="璇疯緭鍏�"
@@ -88,20 +92,23 @@
         <el-col :span="20">
           <el-form-item label="椤圭洰鑳借�楁儏鍐�:" label-width="180px" prop="projectEnergyConsumption" style="width: 100%">
             <div class="policy-items" style="height: 320px">
-              <div  style="line-height: 20px;color: #a9afbc">
+              <div style="line-height: 20px;color: #a9afbc">
                 骞寸患鍚堣兘婧愭秷璐归噺涓嶆弧1000鍚ㄦ爣鍑嗙叅锛屼笖骞寸數鍔涙秷鑰楅噺涓嶆弧500涓囧崈鐡︽椂鐨勫浘瀹氳祫浜ф姇璧勯」鐩�佷互鍙婄敤鑳藉伐鑹虹畝鍗曘�佽妭鑳芥綔鍔涘皬鐨勮涓�(鎸夌収鍥藉鍙戞敼瑕佹寚瀹氬苟鍏竷鐨勫叿浣撹涓氱洰褰�)鐨勫洜瀹氳祫浜ф姇璧勯」鐩簲鎸夌収鐩稿叧鑺傝兘鏍囧噯銆佽鑼冨缓璁撅紝涓嶅啀鍗曠嫭杩涜鑺傝兘瀹℃煡銆�
               </div>
               <div style="display: flex;width: 100%;">
-                <el-radio-group v-model="investmentProjectPolicyComplianceDTO.energyCheck" style="display: flex;flex-direction: column;margin-top: 10px">
-                  <el-radio size="large" style="margin-bottom: 20px" :label="true"> 闇�杩涜鑺傝兘瀹℃煡鐨勯」鐩紝涓嶅湪濉姤銆婇」鐩兘婧愭秷璐规儏鍐佃〃銆� </el-radio>
-                  <el-radio size="large" style="margin-bottom: 10px" :label="false"> 涓嶅崟鐙繘琛岃妭鑳藉鏌ョ殑椤圭洰锛岄渶濉姤銆婇」鐩兘婧愭秷璐规儏鍐佃〃銆� </el-radio>
+                <el-radio-group v-model="policyInfoForm.energyCheck"
+                                style="display: flex;flex-direction: column;margin-top: 10px">
+                  <el-radio size="large" style="margin-bottom: 20px" :label="true"> 闇�杩涜鑺傝兘瀹℃煡鐨勯」鐩紝涓嶅湪濉姤銆婇」鐩兘婧愭秷璐规儏鍐佃〃銆�
+                  </el-radio>
+                  <el-radio size="large" style="margin-bottom: 10px" :label="false"> 涓嶅崟鐙繘琛岃妭鑳藉鏌ョ殑椤圭洰锛岄渶濉姤銆婇」鐩兘婧愭秷璐规儏鍐佃〃銆�
+                  </el-radio>
                 </el-radio-group>
               </div>
               <div style="display: flex;gap: 2px">
                 <div style="width: 160px">1.椤圭洰骞寸患鍚堣兘婧愭秷璐归噺:</div>
                 <el-input
                   style="width: 300px"
-                  v-model.trim="investmentProjectPolicyComplianceDTO.annualEnergyConsumption"
+                  v-model.trim="policyInfoForm.annualEnergyConsumption"
                   maxlength="255"
                   placeholder="璇疯緭鍏�"
                 ></el-input>
@@ -111,7 +118,7 @@
                 <div style="width: 160px">2.椤圭洰骞寸數鍔涙秷鑰楅噺:</div>
                 <el-input
                   style="width: 300px"
-                  v-model.trim="investmentProjectPolicyComplianceDTO.annualElectricityConsumption"
+                  v-model.trim="policyInfoForm.annualElectricityConsumption"
                   maxlength="255"
                   placeholder="璇疯緭鍏�"
                 ></el-input>
@@ -119,7 +126,7 @@
               </div>
               <div style="line-height: 20px;color: #a9afbc;margin-top: 5px">涓嶅啀鍗曠嫭杩涜鑺傝兘瀹℃煡鐨勭被鍨嬪涓�:</div>
               <div class="input-row">
-                <el-radio-group v-model="investmentProjectPolicyComplianceDTO.noOnlyCheckType" class="radio-item">
+                <el-radio-group v-model="policyInfoForm.noOnlyCheckType" class="radio-item">
                   <el-radio size="large" :label="1">
                     骞寸患鍚堣兘婧愭秷璐归噺涓嶆弧1000鍚ㄦ爣鍑嗙叅涓斿勾鐢靛姏娑堣垂閲忎笉婊�500涓囧崈鐡︽椂鐨勫浐瀹氳祫浜ф姇璧勯」鐩�
                   </el-radio>
@@ -135,7 +142,7 @@
           <el-form-item label="澶囨敞:" label-width="180px" prop="remark" style="width: 100%">
             <div class="input-row">
               <el-input
-                v-model.trim="investmentProjectPolicyComplianceDTO.remark"
+                v-model.trim="policyInfoForm.remarks"
                 class="item"
                 clearable
                 maxlength="255"
@@ -152,6 +159,13 @@
 
 <script>
 
+import Cookies from "js-cookie";
+import {
+  addProjectInvestmentPolicyCompliance,
+  editProjectInvestmentPolicyCompliance,
+  getProjectInvestmentPolicyComplianceById
+} from "@/api/projectEngineering/projectInvestmentPolicyCompliance";
+
 export default {
   name: 'PolicyComplianceForm',
   props: {
@@ -163,10 +177,12 @@
   },
   data() {
     return {
-      investmentProjectPolicyComplianceDTO: {
-        fileIdList: [],
+      policyInfoForm: {
+        id: '',
+        projectId: '',
+        fileList: [],
         belongsToIndustryAdjustmentDirectory: null,
-        belongsToWesternEncouragedDirectory: false,
+        belongsToWesternEncouragedDirectory: null,
         notBannedOrControlledProject: true,
         informationIsTrue: true,
         specialPlanningCompliance: '',
@@ -174,42 +190,73 @@
         annualEnergyConsumption: '',
         annualElectricityConsumption: '',
         noOnlyCheckType: null,
-        remark: ''
+        remarks: ''
       },
-      fileList: [],
       accept: ['pdf'],
       rules: {
-        industrialPolicyProhibition: [{ required: true, message: '璇烽�夋嫨', trigger: 'change' }],
-        reportedInformation: [{ required: true, message: '璇烽�夋嫨', trigger: 'change' }]
+        industrialPolicyProhibition: [{required: true, message: '璇烽�夋嫨', trigger: 'change'}],
+        reportedInformation: [{required: true, message: '璇烽�夋嫨', trigger: 'change'}]
       }
     };
   },
-  watch: {
-    fileList: {
-      deep: true,
-      handler(newFileList) {
-        if (newFileList) {
-          this.investmentProjectPolicyComplianceDTO.fileIdList = newFileList.map(item => item.fileId);
+  mounted() {
+    this.policyInfoForm.projectId = this.$route.query.projectId;
+    const policyInfoForm = Cookies.get("policyInfoForm");
+    const projectForm = Cookies.get("projectForm");
+
+    const parsedPolicyInfoForm = policyInfoForm ? JSON.parse(policyInfoForm) : null;
+    const parsedProjectForm = projectForm ? JSON.parse(projectForm) : null;
+    if (parsedPolicyInfoForm) {
+      this.policyInfoForm = parsedPolicyInfoForm
+    }
+    if (parsedProjectForm) {
+      this.projectForm = parsedProjectForm
+    }
+    // 濡傛灉璺敱瀛樺湪id涓旀病鏈夌紦瀛�,瑙嗕负缂栬緫鎴栨煡鐪嬶紝璋冪敤api
+    if (this.policyInfoForm.projectId && !parsedPolicyInfoForm) {
+      this.getProjectInvestmentPolicyCompliance();
+    }
+  },
+  beforeDestroy() {
+    Cookies.set("policyInfoForm", JSON.stringify(this.policyInfoForm));
+  },
+  methods: {
+    getProjectInvestmentPolicyCompliance() {
+      getProjectInvestmentPolicyComplianceById(this.policyInfoForm.projectId).then(res => {
+        this.policyInfoForm = res.data;
+        if(!this.policyInfoForm.fileList) {
+          this.policyInfoForm.fileList = []
         }
+        this.policyInfoForm.notBannedOrControlledProject =true
+        this.policyInfoForm.informationIsTrue =true
+      });
+    },
+    submit() {
+      if (!this.projectForm.id) {
+        this.$message.error("璇峰厛淇濆瓨鎶曡祫绠$悊鍩烘湰淇℃伅")
+      } else {
+        this.$refs["policyInfoFormRef"].validate(valid => {
+          if (valid) {
+            this.policyInfoForm.projectId = this.projectForm.id;
+            if (this.policyInfoForm.id != null) {
+              editProjectInvestmentPolicyCompliance(this.policyInfoForm).then(response => {
+                this.$modal.msgSuccess("淇敼鎴愬姛");
+                //璺宠浆鍒颁笅涓粍浠�
+                this.$emit('toNext', 5);
+              });
+            } else {
+              addProjectInvestmentPolicyCompliance(this.policyInfoForm).then(response => {
+                this.$modal.msgSuccess("鏂板鎴愬姛");
+                this.policyInfoForm.id = response.data
+                //璺宠浆鍒颁笅涓粍浠�
+                this.$emit('toNext', 5);
+              });
+            }
+          }
+        });
       }
     }
   },
-  methods: {
-    submit() {
-      console.log("鏀跨瓥submit")
-    },
-    handleRemove(file) {
-      if (file) {
-        this.investmentProjectPolicyComplianceDTO.fileIdList = this.fileList.map(item => item.fileId);
-        localStorage.setItem('fileList', JSON.stringify(file));
-      }
-    },
-    handleAdd(file) {
-      if (file) {
-        localStorage.setItem('fileList', JSON.stringify(file));
-      }
-    }
-  }
 };
 </script>
 
diff --git a/src/views/projectEngineering/projectLibrary/component/investmentFunds.vue b/src/views/projectEngineering/projectLibrary/component/investmentFunds.vue
index 9896aa8..6149bb8 100644
--- a/src/views/projectEngineering/projectLibrary/component/investmentFunds.vue
+++ b/src/views/projectEngineering/projectLibrary/component/investmentFunds.vue
@@ -243,7 +243,7 @@
   },
   methods: {
     getInvestmentFunds() {
-      getProjectInvestmentFundingById(this.investmentForm.projectId ).then(res => {
+      getProjectInvestmentFundingById(this.investmentFundsForm.projectId ).then(res => {
         this.investmentFundsForm = res.data;
       });
     },
@@ -270,20 +270,20 @@
     },
   },
   mounted() {
-    this.investmentFundsForm.id = this.$route.query.projectId;
+    this.investmentFundsForm.projectId = this.$route.query.projectId;
     const investmentFundsForm = Cookies.get("investmentFundsForm");
     const projectForm = Cookies.get("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){
       this.projectForm = parsedProjectForm
     }
     // 濡傛灉璺敱瀛樺湪id涓旀病鏈夌紦瀛�,瑙嗕负缂栬緫鎴栨煡鐪嬶紝璋冪敤api
-    if (this.investmentFundsForm.projectId && !parsedInvestmentForm) {
+    if (this.investmentFundsForm.projectId && !parsedInvestmentFundsForm) {
       this.getInvestmentFunds();
     }
   },
diff --git a/src/views/projectEngineering/projectLibrary/component/legalPerson.vue b/src/views/projectEngineering/projectLibrary/component/legalPerson.vue
index 0f2cc67..219626f 100644
--- a/src/views/projectEngineering/projectLibrary/component/legalPerson.vue
+++ b/src/views/projectEngineering/projectLibrary/component/legalPerson.vue
@@ -1,21 +1,21 @@
 <template>
   <div class="basic-info">
-    <el-form ref="demoFormRef" :disabled="disabled" :model="legalPerson" class="dialog_form">
+    <el-form ref="demoFormRef" :disabled="disabled" :model="legalPersonForm" class="dialog_form">
       <el-row :gutter="20">
         <el-col :span="6">
           <el-form-item label="椤圭洰鎬绘姇棰�" label-width="120px" prop="investmentType" style="width: 100%">
-            <el-input v-model="legalPerson.totalInvestment" class="item" clearable maxlength="255" placeholder="璇疯緭鍏�" />
+            <el-input v-model="legalPersonForm.totalInvestment" class="item" clearable maxlength="255" placeholder="璇疯緭鍏�" />
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="椤圭洰鍗曚綅" label-width="120px" prop="investmentType" style="width: 100%">
-            <el-input v-model="legalPerson.projectUnit" class="item" clearable maxlength="255" placeholder="璇疯緭鍏�" />
+            <el-input v-model="legalPersonForm.projectUnit" class="item" clearable maxlength="255" placeholder="璇疯緭鍏�" />
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="椤圭洰鍗曚綅绫诲瀷" label-width="120px" prop="projectType" style="width: 100%">
             <el-select
-              v-model="legalPerson.projectUnitType"
+              v-model="legalPersonForm.projectUnitType"
               clearable
               placeholder="璇烽�夋嫨"
               style="width: 100%"
@@ -30,7 +30,7 @@
         <el-col :span="6">
           <el-form-item label="鐧昏娉ㄥ唽绫诲瀷" label-width="120px" prop="projectType" style="width: 100%">
             <el-select
-              v-model="legalPerson.registrationType"
+              v-model="legalPersonForm.registrationType"
               clearable
               placeholder="璇烽�夋嫨"
               style="width: 100%"
@@ -43,7 +43,7 @@
         <el-col :span="6">
           <el-form-item label="鎺ц偂鎯呭喌" label-width="120px" prop="projectType" style="width: 100%">
             <el-select
-              v-model="legalPerson.holdingSituation"
+              v-model="legalPersonForm.holdingSituation"
               clearable
               placeholder="璇烽�夋嫨"
               style="width: 100%"
@@ -56,7 +56,7 @@
         <el-col :span="6">
           <el-form-item label="璇佺収绫诲瀷" label-width="120px" prop="projectstatus" style="width: 100%">
             <el-select
-              v-model="legalPerson.certificateType"
+              v-model="legalPersonForm.certificateType"
               clearable
               placeholder="璇烽�夋嫨"
               style="width: 100%"
@@ -70,75 +70,75 @@
       <el-row :gutter="20">
         <el-col :span="6">
           <el-form-item label="璇佷欢鍙风爜" label-width="120px" prop="investmentType" style="width: 100%">
-            <el-input v-model.trim="legalPerson.certificateNumber" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" />
+            <el-input v-model.trim="legalPersonForm.certificateNumber" class="item" clearable  maxlength="255" placeholder="璇疯緭鍏�" />
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="娉ㄥ唽鍦板潃" label-width="120px" prop="investmentType" style="width: 100%">
-            <el-input v-model.trim="legalPerson.registeredAddress" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" />
+            <el-input v-model.trim="legalPersonForm.registeredAddress" class="item" clearable  maxlength="255" placeholder="璇疯緭鍏�" />
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="娉ㄥ唽璧勯噾" label-width="120px" prop="projectType" style="width: 100%">
-            <el-input v-model.trim="legalPerson.registeredCapital" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" />
+            <el-input v-model.trim="legalPersonForm.registeredCapital" class="item" clearable  maxlength="255" placeholder="璇疯緭鍏�" />
           </el-form-item>
         </el-col>
       </el-row>
       <el-row :gutter="20">
         <el-col :span="6">
           <el-form-item label="娉曚汉浠h〃" label-width="120px" prop="investmentType" style="width: 100%">
-            <el-input v-model.trim="legalPerson.legal_representative" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" />
+            <el-input v-model.trim="legalPersonForm.legalRepresentative" class="item" clearable  maxlength="255" placeholder="璇疯緭鍏�" />
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="鍥哄畾鐢佃瘽" label-width="120px" prop="investmentType" style="width: 100%">
-            <el-input v-model.trim="legalPerson.fixedPhone" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" />
+            <el-input v-model.trim="legalPersonForm.fixedPhone" class="item" clearable  maxlength="255" placeholder="璇疯緭鍏�" />
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="娉曚汉韬唤璇佸彿" label-width="120px" prop="projectType" style="width: 100%">
-            <el-input v-model.trim="legalPerson.legalPersonIdcard" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" />
+            <el-input v-model.trim="legalPersonForm.legalPersonIdcard" class="item" clearable  maxlength="255" placeholder="璇疯緭鍏�" />
           </el-form-item>
         </el-col>
       </el-row>
       <el-row :gutter="20">
         <el-col :span="6">
           <el-form-item label="椤圭洰鑱旂郴浜�" label-width="120px" prop="investmentType" style="width: 100%">
-            <el-input v-model.trim="legalPerson.projectContactPerson" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" />
+            <el-input v-model.trim="legalPersonForm.projectContactPerson" class="item" clearable  maxlength="255" placeholder="璇疯緭鍏�" />
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="绉诲姩鐢佃瘽" label-width="120px" prop="investmentType" style="width: 100%">
-            <el-input v-model.trim="legalPerson.phone" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" />
+            <el-input v-model.trim="legalPersonForm.phone" class="item" clearable  maxlength="255" placeholder="璇疯緭鍏�" />
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="鑱旂郴浜鸿韩浠借瘉鍙�" label-width="120px" prop="projectType" style="width: 100%">
-            <el-input v-model.trim="legalPerson.contactIdcard" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" />
+            <el-input v-model.trim="legalPersonForm.contactIdcard" class="item" clearable  maxlength="255" placeholder="璇疯緭鍏�" />
           </el-form-item>
         </el-col>
       </el-row>
       <el-row :gutter="20">
         <el-col :span="6">
           <el-form-item label="寰俊鍙�" label-width="120px" prop="investmentType" style="width: 100%">
-            <el-input v-model.trim="legalPerson.wechat" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" />
+            <el-input v-model.trim="legalPersonForm.wechat" class="item" clearable  maxlength="255" placeholder="璇疯緭鍏�" />
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="鑱旂郴浜洪�氳鍦板潃" label-width="120px" prop="investmentType" style="width: 100%">
-            <el-input v-model.trim="legalPerson.contactAddress" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" />
+            <el-input v-model.trim="legalPersonForm.contactAddress" class="item" clearable  maxlength="255" placeholder="璇疯緭鍏�" />
           </el-form-item>
         </el-col>
         <el-col :span="6">
           <el-form-item label="閭斂缂栫爜" label-width="120px" prop="projectType" style="width: 100%">
-            <el-input v-model.trim="legalPerson.postCode" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" />
+            <el-input v-model.trim="legalPersonForm.postCode" class="item" clearable  maxlength="255" placeholder="璇疯緭鍏�" />
           </el-form-item>
         </el-col>
       </el-row>
       <el-row :gutter="20">
         <el-col :span="6">
           <el-form-item label="鐢靛瓙閭" label-width="120px" prop="investmentType" style="width: 100%">
-            <el-input v-model="legalPerson.email" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" />
+            <el-input v-model="legalPersonForm.email" class="item" clearable  maxlength="255" placeholder="璇疯緭鍏�" />
           </el-form-item>
         </el-col>
       </el-row>
@@ -147,6 +147,13 @@
 </template>
 
 <script>
+
+import Cookies from "js-cookie";
+import {
+  addProjectUnitRegistrationInfo,
+  editProjectUnitRegistrationInfo,
+  getProjectUnitRegistrationInfoById
+} from "@/api/projectEngineering/projectUnitRegistrationInfo";
 
 export default {
   dicts: ['sys_unit_type','sys_registration_type','sys_holding_situation','sys_license_type'],
@@ -160,7 +167,8 @@
   },
   data() {
     return {
-      legalPerson: {
+      legalPersonForm: {
+        id: '',
         totalInvestment: '',
         projectUnit: '',
         projectUnitType: '',
@@ -171,7 +179,7 @@
         registeredAddress: '',
         registeredCapital: '',
         projectId: '',
-        legal_representative: '',
+        legalRepresentative: '',
         fixedPhone: '',
         legalPersonIdcard: '',
         projectContactPerson: '',
@@ -184,12 +192,53 @@
       },
     }
   },
-  created() {
+  mounted() {
+    this.legalPersonForm.projectId = this.$route.query.projectId;
+    const legalPersonForm = Cookies.get("legalPersonForm");
+    const projectForm = Cookies.get("projectForm");
 
+    const parsedLegalPersonForm = legalPersonForm ? JSON.parse(legalPersonForm) : null;
+    const parsedProjectForm = projectForm ? JSON.parse(projectForm) : null;
+    if (parsedLegalPersonForm) {
+      this.legalPersonForm = parsedLegalPersonForm
+    }
+    if (parsedProjectForm){
+      this.projectForm = parsedProjectForm
+    }
+    // 濡傛灉璺敱瀛樺湪id涓旀病鏈夌紦瀛�,瑙嗕负缂栬緫鎴栨煡鐪嬶紝璋冪敤api
+    if (this.legalPersonForm.projectId && !parsedLegalPersonForm) {
+      this.getProjectUnitRegistrationInfo();
+    }
+  },
+  beforeDestroy() {
+    Cookies.set("legalPersonForm", JSON.stringify(this.legalPersonForm));
   },
   methods: {
+    getProjectUnitRegistrationInfo() {
+      getProjectUnitRegistrationInfoById(this.legalPersonForm.projectId ).then(res => {
+        this.legalPersonForm = res.data;
+      });
+    },
     submit() {
-      console.log("娉曚汉submit")
+      if (!this.projectForm.id) {
+        this.$message.error("璇峰厛淇濆瓨鎶曡祫绠$悊鍩烘湰淇℃伅")
+      } else {
+        this.legalPersonForm.projectId = this.projectForm.id;
+        if (this.legalPersonForm.id != null) {
+          editProjectUnitRegistrationInfo(this.legalPersonForm).then(response => {
+            this.$modal.msgSuccess("淇敼鎴愬姛");
+            //璺宠浆鍒颁笅涓粍浠�
+            this.$emit('toNext', 4);
+          });
+        } else {
+          addProjectUnitRegistrationInfo(this.legalPersonForm).then(response => {
+            this.$modal.msgSuccess("鏂板鎴愬姛");
+            this.legalPersonForm.id = response.data
+            //璺宠浆鍒颁笅涓粍浠�
+            this.$emit('toNext', 4);
+          });
+        }
+      }
     },
   }
 }
diff --git a/src/views/projectEngineering/projectLibrary/index.vue b/src/views/projectEngineering/projectLibrary/index.vue
index 8a6c287..f2db159 100644
--- a/src/views/projectEngineering/projectLibrary/index.vue
+++ b/src/views/projectEngineering/projectLibrary/index.vue
@@ -385,6 +385,10 @@
     removeCookie() {
       Cookies.remove("projectForm")
       Cookies.remove("investmentForm")
+      Cookies.remove("investmentFundsForm")
+      Cookies.remove("legalPersonForm")
+      Cookies.remove("policyInfoForm")
+      Cookies.remove("documentsInfoForm")
     },
     // 閲嶇疆鎺掑簭鐨勬柟娉�
     handleResetSort() {
diff --git a/src/views/projectEngineering/projectLibrary/projectDetails.vue b/src/views/projectEngineering/projectLibrary/projectDetails.vue
index b486d1c..59ca747 100644
--- a/src/views/projectEngineering/projectLibrary/projectDetails.vue
+++ b/src/views/projectEngineering/projectLibrary/projectDetails.vue
@@ -95,10 +95,6 @@
       this.$refs.childRef.reset();
     },
   },
-  created() {
-    console.log("sss")
-  },
-
 };
 </script>
 

--
Gitblit v1.8.0