From cf2faab021222e1e345e8098da38f2c24ea8b504 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期四, 28 十一月 2024 06:07:40 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- src/views/projectEngineering/projectLibrary/component/InvestInfo.vue | 194 ++++++++++++++++++++++++++---------------------- 1 files changed, 104 insertions(+), 90 deletions(-) diff --git a/src/views/projectEngineering/projectLibrary/component/InvestInfo.vue b/src/views/projectEngineering/projectLibrary/component/InvestInfo.vue index 7b22b12..beda437 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,10 +164,15 @@ </template> <script> -import { formatDate } from '@/utils'; +import Cookies from "js-cookie"; +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: { @@ -162,7 +183,9 @@ }, data() { return { - investment: { + projectForm: {}, + investmentForm: { + id: '', beCrossRegion: '', constructionLocation: '', detailedAddress: '', @@ -177,49 +200,7 @@ 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: [] + projectId: '', }, plannedStartDate: '', expectedCompletionDate: '', @@ -232,34 +213,67 @@ }; }, mounted() { - this.updateFormData(); + this.investmentForm.projectId = this.$route.query.projectId + // 浠嶤ookies涓幏鍙栫紦瀛樻暟鎹� + const investmentForm = Cookies.get("investmentForm"); + const projectForm = Cookies.get("projectForm"); + + // 灏濊瘯瑙f瀽JSON鏁版嵁 + const parsedInvestmentForm = investmentForm ? JSON.parse(investmentForm) : null; + const parsedProjectForm = projectForm ? JSON.parse(projectForm) : null; + + // 璁剧疆investment鍜宲rojectForm瀵硅薄 + if(parsedInvestmentForm) { + this.investmentForm = parsedInvestmentForm; + } + if(parsedProjectForm) { + this.projectForm = parsedProjectForm; + } + // 濡傛灉璺敱瀛樺湪id涓旀病鏈夌紦瀛橈紝瑙嗕负缂栬緫鎴栨煡鐪嬶紝璋冪敤api + if (this.investmentForm.projectId && !investmentForm) { + this.getInvestment(); + } + 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)); }, methods: { - chaneCompleted(val) { - if (!val) return; - this.investment.expectedCompletionDate = formatDate(val); + getInvestment() { + getProjectInvestmentInfoById(this.investmentForm.projectId ).then(res => { + this.investmentForm = res.data; + 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 != null) { + 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