From ee5553f438eadb34a3261b718145e9e7f8a27580 Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期五, 29 十一月 2024 14:43:44 +0800 Subject: [PATCH] 项目库导出之导出目标列表内容 --- src/views/projectEngineering/projectLibrary/component/InvestInfo.vue | 83 +++++++++++++++++++++++------------------ 1 files changed, 46 insertions(+), 37 deletions(-) diff --git a/src/views/projectEngineering/projectLibrary/component/InvestInfo.vue b/src/views/projectEngineering/projectLibrary/component/InvestInfo.vue index d792807..d1f5d7f 100644 --- a/src/views/projectEngineering/projectLibrary/component/InvestInfo.vue +++ b/src/views/projectEngineering/projectLibrary/component/InvestInfo.vue @@ -11,7 +11,7 @@ style="width: 100%" > <el-option v-for="item in dict.type.sys_cross_domain" :key="item.value" :label="item.label" - :value="item.value"/> + :value="parseInt(item.value)"/> </el-select> </el-form-item> </el-col> @@ -46,7 +46,7 @@ style="width: 100%" > <el-option v-for="item in dict.type.sys_whether_project" :key="item.value" :label="item.label" - :value="item.value"/> + :value="parseInt(item.value)"/> </el-select> </el-form-item> </el-col> @@ -137,7 +137,7 @@ style="width: 100%" > <el-option v-for="item in dict.type.sys_whether_project" :key="item.value" :label="item.label" - :value="item.value"/> + :value="parseInt(item.value)"/> </el-select> </el-form-item> </el-col> @@ -164,7 +164,6 @@ </template> <script> -import Cookies from "js-cookie"; import { addProjectInvestmentInfo, editProjectInvestmentInfo, @@ -179,28 +178,28 @@ type: Boolean, default: false, required: true - } + }, }, data() { return { projectForm: {}, investmentForm: { - id: '', - beCrossRegion: '', - constructionLocation: '', - detailedAddress: '', - beCompensationProject: '', - compensationReason: '', - plannedStartDate: '', - expectedCompletionDate: '', - nationalIndustryClassification: '', - industryClassification: '', - projectNature: '', - projectAttribute: '', - useEarth: '', - contentScale: '', - code: '', - projectId: '' + // id: '', + // beCrossRegion: '', + // constructionLocation: '', + // detailedAddress: '', + // beCompensationProject: '', + // compensationReason: '', + // plannedStartDate: '', + // expectedCompletionDate: '', + // nationalIndustryClassification: '', + // industryClassification: '', + // projectNature: '', + // projectAttribute: '', + // useEarth: '', + // contentScale: '', + // code: '', + // projectId: '', }, plannedStartDate: '', expectedCompletionDate: '', @@ -214,33 +213,43 @@ }, mounted() { // 浠嶤ookies涓幏鍙栫紦瀛樻暟鎹� - const investmentForm = Cookies.get("investmentForm"); - const projectForm = Cookies.get("projectForm"); + const investmentForm = localStorage.getItem("investmentForm"); + const projectForm = localStorage.getItem("projectForm"); // 灏濊瘯瑙f瀽JSON鏁版嵁 const parsedInvestmentForm = investmentForm ? JSON.parse(investmentForm) : null; const parsedProjectForm = projectForm ? JSON.parse(projectForm) : null; - + console.log(parsedInvestmentForm) // 璁剧疆investment鍜宲rojectForm瀵硅薄 - this.investmentForm = parsedInvestmentForm || {}; - this.projectForm = parsedProjectForm || {}; - - // 濡傛灉projectForm瀛樺湪id涓旀病鏈夌紦瀛橈紝鍒欒皟鐢╝pi - if (this.projectForm.id && !investmentForm) { - this.getInvestment(); + if(parsedInvestmentForm) { + this.investmentForm = parsedInvestmentForm; } - this.investmentForm.constructionLocation = this.projectForm.area; - this.investmentForm.detailedAddress = this.projectForm.projectAddress; - this.investmentForm.plannedStartDate = this.projectForm.planStartTime; - this.investmentForm.expectedCompletionDate = this.projectForm.planCompleteTime; + if(parsedProjectForm) { + this.projectForm = parsedProjectForm; + } + // 濡傛灉璺敱瀛樺湪id涓旀病鏈夌紦瀛橈紝瑙嗕负缂栬緫鎴栨煡鐪嬶紝璋冪敤api + if (this.$route.query.projectId && !investmentForm) { + this.getInvestment(); + }else { + this.investmentForm.constructionLocation = this.projectForm.area; + this.investmentForm.detailedAddress = this.projectForm.projectAddress; + this.investmentForm.plannedStartDate = this.projectForm.planStartTime; + this.investmentForm.expectedCompletionDate = this.projectForm.planCompleteTime; + } }, beforeDestroy() { - Cookies.set("investmentForm", JSON.stringify(this.investmentForm)); + if(Object.keys(this.investmentForm).length !==0) localStorage.setItem("investmentForm", JSON.stringify(this.investmentForm)); }, methods: { getInvestment() { - getProjectInvestmentInfoById(this.investmentForm.id).then(res => { + getProjectInvestmentInfoById(this.$route.query.projectId).then(res => { this.investmentForm = res.data; + this.$nextTick(() => { + this.investmentForm.constructionLocation = this.projectForm.area; + this.investmentForm.detailedAddress = this.projectForm.projectAddress; + this.investmentForm.plannedStartDate = this.projectForm.planStartTime; + this.investmentForm.expectedCompletionDate = this.projectForm.planCompleteTime; + }) }); }, submit() { @@ -248,7 +257,7 @@ this.$message.error("璇峰厛淇濆瓨鎶曡祫绠$悊鍩烘湰淇℃伅") } else { this.investmentForm.projectId = this.projectForm.id; - if (this.investmentForm.id != null) { + if (this.investmentForm.id) { editProjectInvestmentInfo(this.investmentForm).then(response => { this.$modal.msgSuccess("淇敼鎴愬姛"); //璺宠浆鍒颁笅涓粍浠� -- Gitblit v1.8.0