<template>
|
<div class="basic-info">
|
<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="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="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="investmentForm.constructionLocation"
|
clearable
|
disabled
|
placeholder="请选择"
|
style="width: 100%"
|
>
|
<el-option v-for="item in dict.type.sys_administrative_divisions" :key="item.value" :label="item.label"
|
:value="item.value"/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="建设详细地址" label-width="120px" prop="fundsType" style="width: 100%">
|
<el-input v-model.trim="investmentForm.detailedAddress" class="item" clearable disabled 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="projectType" style="width: 100%">
|
<el-select
|
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="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="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="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="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="investmentForm.nationalIndustryClassification"
|
clearable
|
placeholder="请选择"
|
style="width: 100%"
|
>
|
<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>
|
</el-col>
|
</el-row>
|
<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="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="investmentForm.projectNature"
|
clearable
|
placeholder="请选择"
|
style="width: 100%"
|
>
|
<el-option v-for="item in dict.type.sys_industry_belong" :key="item.value" :label="item.label"
|
:value="item.value"/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
<el-col :span="6">
|
<el-form-item label="项目属性" label-width="120px" prop="putUnder" style="width: 100%">
|
<el-select
|
v-model="investmentForm.projectAttribute"
|
clearable
|
placeholder="请选择"
|
style="width: 100%"
|
>
|
<el-option v-for="item in dict.type.sys_project_attributes" :key="item.value" :label="item.label"
|
:value="item.value"/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="20">
|
<el-col :span="18">
|
<el-form-item label="是否使用土地" label-width="120px" prop="approvalType" style="width: 100%">
|
<el-select
|
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="parseInt(item.value)"/>
|
</el-select>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
<el-row :gutter="20">
|
<el-col :span="18">
|
<el-form-item class="item" label="主要建设内容及规模" label-width="120px" prop="content">
|
<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="建管平台代码" label-width="120px" prop="content">
|
<el-input v-model.trim="investmentForm.code" class="item" clearable maxlength="255" placeholder="请输入"
|
type="textarea"/>
|
</el-form-item>
|
</el-col>
|
</el-row>
|
</el-form>
|
</div>
|
</template>
|
|
<script>
|
import {
|
addProjectInvestmentInfo,
|
editProjectInvestmentInfo,
|
getProjectInvestmentInfoById
|
} from "@/api/projectEngineering/projectInvestmentInfo";
|
|
export default {
|
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 {
|
projectForm: {},
|
investmentForm: {
|
// id: '',
|
// beCrossRegion: '',
|
// constructionLocation: '',
|
// detailedAddress: '',
|
// beCompensationProject: '',
|
// compensationReason: '',
|
// plannedStartDate: '',
|
// expectedCompletionDate: '',
|
// nationalIndustryClassification: '',
|
// industryClassification: '',
|
// projectNature: '',
|
// projectAttribute: '',
|
// useEarth: '',
|
// contentScale: '',
|
// code: '',
|
// projectId: '',
|
},
|
plannedStartDate: '',
|
expectedCompletionDate: '',
|
sys_cross_domain: [],
|
sys_industry_classification: [],
|
sys_industry_belong: [],
|
sys_project_attributes: [],
|
sys_whether_project: [],
|
sys_administrative_divisions: []
|
};
|
},
|
mounted() {
|
// 从Cookies中获取缓存数据
|
const investmentForm = localStorage.getItem("investmentForm");
|
const projectForm = localStorage.getItem("projectForm");
|
|
// 尝试解析JSON数据
|
const parsedInvestmentForm = investmentForm ? JSON.parse(investmentForm) : null;
|
const parsedProjectForm = projectForm ? JSON.parse(projectForm) : null;
|
// 设置investment和projectForm对象
|
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;
|
}
|
|
this.investmentForm.projectId = this.projectForm.id;
|
},
|
beforeDestroy() {
|
if(Object.keys(this.investmentForm).length !==0) localStorage.setItem("investmentForm", JSON.stringify(this.investmentForm));
|
},
|
methods: {
|
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;
|
})
|
});
|
},
|
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);
|
});
|
}
|
}
|
},
|
},
|
watch: {
|
investmentForm: {
|
deep: true,
|
handler(newVal) {
|
this.$emit('investInfoForm', newVal)
|
}
|
}
|
}
|
|
};
|
</script>
|
|
<style lang="scss" scoped>
|
.item {
|
width: 100%;
|
}
|
|
.input-row {
|
display: flex;
|
width: 100%;
|
|
.input-item {
|
width: 100%;
|
}
|
}
|
|
.map-btn {
|
width: 32px;
|
height: 32px;
|
background: #c6d6ff;
|
border: 1px solid #3369ff;
|
display: flex;
|
justify-content: center;
|
align-items: center;
|
cursor: pointer;
|
|
img {
|
width: 20px;
|
}
|
}
|
</style>
|