From b87174cde67aaa8420ea492af9b79fcc9a692036 Mon Sep 17 00:00:00 2001
From: luohairen <3399054449@qq.com>
Date: 星期二, 10 十二月 2024 18:11:05 +0800
Subject: [PATCH] bug
---
src/views/projectEngineering/projectLibrary/component/InvestInfo.vue | 226 ++++++++++++++++++++++++++++++--------------------------
1 files changed, 120 insertions(+), 106 deletions(-)
diff --git a/src/views/projectEngineering/projectLibrary/component/InvestInfo.vue b/src/views/projectEngineering/projectLibrary/component/InvestInfo.vue
index ef82734..d1f5d7f 100644
--- a/src/views/projectEngineering/projectLibrary/component/InvestInfo.vue
+++ b/src/views/projectEngineering/projectLibrary/component/InvestInfo.vue
@@ -1,25 +1,26 @@
<template>
<div class="basic-info">
- <el-form ref="demoFormRef" :disabled="disabled" :model="investment" class="dialog_form">
+ <el-form ref="demoFormRef" :disabled="disabled" :model="investmentForm" class="dialog_form">
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="寤鸿鍦扮偣鏄惁璺ㄥ煙" label-width="120px" prop="fundsType" style="width: 100%">
<el-select
- v-model="investment.beCrossRegion"
+ v-model="investmentForm.beCrossRegion"
clearable
placeholder="璇烽�夋嫨"
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>
<el-col :span="6">
<el-form-item label="椤圭洰寤鸿鍦扮偣" label-width="120px" prop="investmentType" style="width: 100%">
<el-select
- v-model="investment.constructionLocation"
+ v-model="investmentForm.constructionLocation"
clearable
+ disabled
placeholder="璇烽�夋嫨"
style="width: 100%"
>
@@ -30,7 +31,8 @@
</el-col>
<el-col :span="6">
<el-form-item label="寤鸿璇︾粏鍦板潃" label-width="120px" prop="fundsType" style="width: 100%">
- <el-input v-model.trim="investment.detailedAddress" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" />
+ <el-input v-model.trim="investmentForm.detailedAddress" class="item" clearable disabled maxlength="255"
+ placeholder="璇疯緭鍏�"/>
</el-form-item>
</el-col>
</el-row>
@@ -38,44 +40,54 @@
<el-col :span="6">
<el-form-item label="鏄惁鏄ˉ鐮侀」鐩�" label-width="120px" prop="projectType" style="width: 100%">
<el-select
- v-model="investment.beCompensationProject"
+ v-model="investmentForm.beCompensationProject"
clearable
placeholder="璇烽�夋嫨"
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>
<el-col :span="12">
<el-form-item label="琛ョ爜鍘熷洜" label-width="120px" prop="projectstatus" style="width: 100%">
- <el-input v-model.trim="investment.compensationReason" class="item" clearable maxlength="255" placeholder="璇疯緭鍏�" />
+ <el-input v-model.trim="investmentForm.compensationReason" 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="plannedStartDate" style="width: 100%">
- <!-- <el-date-picker v-model="plannedStartDate" placeholder="閫夋嫨鏃堕棿" style="width: 100%" type="date" @change="chaneStartWork" />-->
- <el-input v-model.trim="plannedStartDate" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" />
+ <el-date-picker v-model="investmentForm.plannedStartDate"
+ placeholder="閫夋嫨鏃堕棿"
+ style="width: 100%"
+ disabled
+ type="date"
+ value-format="yyyy-MM-dd HH:mm:ss"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="鎷熷缓鎴愭椂闂�" label-width="120px" prop="expectedCompletionDate" style="width: 100%">
- <!-- <el-date-picker v-model="expectedCompletionDate" placeholder="閫夋嫨鏃堕棿" style="width: 100%" type="date" @change="chaneCompleted" />-->
- <el-input v-model.trim="expectedCompletionDate" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" />
+ <el-date-picker
+ v-model="investmentForm.expectedCompletionDate"
+ placeholder="閫夋嫨鏃堕棿"
+ disabled
+ style="width: 100%"
+ type="date"
+ value-format="yyyy-MM-dd HH:mm:ss"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="鍥介檯琛屼笟鍒嗙被" label-width="120px" prop="engineering" style="width: 100%">
<el-select
- v-model="investment.nationalIndustryClassification"
+ v-model="investmentForm.nationalIndustryClassification"
clearable
placeholder="璇烽�夋嫨"
style="width: 100%"
>
- <el-option v-for="item in dict.type.sys_whether_project" :key="item.value" :label="item.label"
+ <el-option v-for="item in dict.type.sys_industry_classification" :key="item.value" :label="item.label"
:value="item.value"/>
</el-select>
</el-form-item>
@@ -84,13 +96,14 @@
<el-row :gutter="20">
<el-col :span="6">
<el-form-item label="鎵�灞炶涓氬垎绫�" label-width="120px" prop="department" style="width: 100%">
- <el-input v-model.trim="investment.industryClassification" class="item" clearable maxlength="255" placeholder="璇疯緭鍏�" />
+ <el-input v-model.trim="investmentForm.industryClassification" class="item" clearable maxlength="255"
+ placeholder="璇疯緭鍏�"/>
</el-form-item>
</el-col>
<el-col :span="6">
<el-form-item label="椤圭洰寤烘垚鎬ц川" label-width="120px" prop="design" style="width: 100%">
<el-select
- v-model="investment.projectNature"
+ v-model="investmentForm.projectNature"
clearable
placeholder="璇烽�夋嫨"
style="width: 100%"
@@ -103,7 +116,7 @@
<el-col :span="6">
<el-form-item label="椤圭洰灞炴��" label-width="120px" prop="putUnder" style="width: 100%">
<el-select
- v-model="investment.projectAttribute"
+ v-model="investmentForm.projectAttribute"
clearable
placeholder="璇烽�夋嫨"
style="width: 100%"
@@ -118,13 +131,13 @@
<el-col :span="18">
<el-form-item label="鏄惁浣跨敤鍦熷湴" label-width="120px" prop="approvalType" style="width: 100%">
<el-select
- v-model="investment.useEarth"
+ v-model="investmentForm.useEarth"
clearable
placeholder="璇烽�夋嫨"
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>
@@ -132,14 +145,17 @@
<el-row :gutter="20">
<el-col :span="18">
<el-form-item class="item" label="涓昏寤鸿鍐呭鍙婅妯�" label-width="120px" prop="content">
- <el-input v-model.trim="investment.contentScale" class="item" clearable maxlength="255" placeholder="璇疯緭鍏�" type="textarea" />
+ <el-input v-model.trim="investmentForm.contentScale" class="item" clearable maxlength="255"
+ placeholder="璇疯緭鍏�"
+ type="textarea"/>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="18">
<el-form-item class="item" label="寤虹骞冲彴浠g爜" label-width="120px" prop="content">
- <el-input v-model.trim="investment.code" class="item" clearable maxlength="255" placeholder="璇疯緭鍏�" type="textarea" />
+ <el-input v-model.trim="investmentForm.code" class="item" clearable maxlength="255" placeholder="璇疯緭鍏�"
+ type="textarea"/>
</el-form-item>
</el-col>
</el-row>
@@ -148,79 +164,42 @@
</template>
<script>
-import { formatDate } from '@/utils';
+import {
+ addProjectInvestmentInfo,
+ editProjectInvestmentInfo,
+ getProjectInvestmentInfoById
+} from "@/api/projectEngineering/projectInvestmentInfo";
export default {
- dicts: ['sys_cross_domain','sys_administrative_divisions','sys_whether_project','sys_industry_belong'
- ,'sys_project_attributes'],
+ dicts: ['sys_cross_domain', 'sys_industry_classification', 'sys_administrative_divisions', 'sys_whether_project', 'sys_industry_belong', 'sys_project_attributes'],
name: 'InvestmentForm',
props: {
disabled: {
type: Boolean,
default: false,
required: true
- }
+ },
},
data() {
return {
- investment: {
- beCrossRegion: '',
- constructionLocation: '',
- detailedAddress: '',
- beCompensationProject: '',
- compensationReason: '',
- plannedStartDate: '',
- expectedCompletionDate: '',
- nationalIndustryClassification: '',
- industryClassification: '',
- projectNature: '',
- projectAttribute: '',
- useEarth: '',
- contentScale: '',
- code: '',
- projectId: ''
- },
- projectForm: {
- projectName: '',
- projectCode: '',
- projectType: '',
- projectStatus: '1',
- fundType: '',
- investType: '',
- importanceType: '',
- projectPhase: '鍌ㄥ瑙勫垝闃舵',
- tag: '',
- competentDepartment: '',
- projectLocation: '',
- longitude: '',
- latitude: '',
- managementCentralization: '',
- projectApplicationPhase: '',
- projectApprovalType: '',
- investmentCatalogue: '',
- approvalPlan: '',
- isSetProject: '',
- setTime: '',
- assignmentStatus: '',
- area: '',
- winTime: '',
- winUnit: '',
- winAmount: '',
- address: '',
- engineeringIdList: [],
- content: '',
- contact: '',
- projectOwnerUnit: '',
- planStartTime: '',
- planCompleteTime: '',
- projectContactPerson: '',
- fileIdList: [],
- sysOssVos: [],
- engineeringInfos: [],
- year: '',
- yearInvestAmount: '',
- competentDepartmentList: [],
- managementCentralizationList: []
+ projectForm: {},
+ investmentForm: {
+ // id: '',
+ // beCrossRegion: '',
+ // constructionLocation: '',
+ // detailedAddress: '',
+ // beCompensationProject: '',
+ // compensationReason: '',
+ // plannedStartDate: '',
+ // expectedCompletionDate: '',
+ // nationalIndustryClassification: '',
+ // industryClassification: '',
+ // projectNature: '',
+ // projectAttribute: '',
+ // useEarth: '',
+ // contentScale: '',
+ // code: '',
+ // projectId: '',
},
plannedStartDate: '',
expectedCompletionDate: '',
@@ -233,34 +212,69 @@
};
},
mounted() {
- this.updateFormData();
+ // 浠嶤ookies涓幏鍙栫紦瀛樻暟鎹�
+ 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瀵硅薄
+ if(parsedInvestmentForm) {
+ this.investmentForm = parsedInvestmentForm;
+ }
+ 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() {
+ if(Object.keys(this.investmentForm).length !==0) localStorage.setItem("investmentForm", JSON.stringify(this.investmentForm));
},
methods: {
- chaneCompleted(val) {
- if (!val) return;
- this.investment.expectedCompletionDate = formatDate(val);
+ getInvestment() {
+ 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;
+ })
+ });
},
- chaneStartWork(val) {
- if (!val) return;
- this.investment.plannedStartDate = formatDate(val);
+ submit() {
+ if (!this.projectForm.id) {
+ this.$message.error("璇峰厛淇濆瓨鎶曡祫绠$悊鍩烘湰淇℃伅")
+ } else {
+ this.investmentForm.projectId = this.projectForm.id;
+ if (this.investmentForm.id) {
+ editProjectInvestmentInfo(this.investmentForm).then(response => {
+ this.$modal.msgSuccess("淇敼鎴愬姛");
+ //璺宠浆鍒颁笅涓粍浠�
+ this.$emit('toNext', 2);
+ });
+ } else {
+ addProjectInvestmentInfo(this.investmentForm).then(response => {
+ this.$modal.msgSuccess("鏂板鎴愬姛");
+ this.investmentForm.id = response.data
+ //璺宠浆鍒颁笅涓粍浠�
+ this.$emit('toNext', 2);
+ });
+ }
+ }
},
- updateFormData() {
- if(this.projectForm) {
- this.plannedStartDate = this.projectForm.planStartTime.slice(0, 10);
- this.expectedCompletionDate = this.projectForm.planCompleteTime.slice(0, 10);
- this.investment.constructionLocation = this.projectForm.area;
- this.investment.detailedAddress = this.projectForm.address;
- }
- }
- },
- watch: {
- projectForm: {
- deep: true,
- handler() {
- this.updateFormData();
- }
- }
}
+
};
</script>
--
Gitblit v1.8.0