| | |
| | | <el-col :span="20"> |
| | | <el-form-item label="符合行业政策:" label-width="180px" prop="industryPolicy" style="width: 100%"> |
| | | <div style="display: flex"> |
| | | <file-upload v-model="policyInfoForm.fileList" |
| | | <file-upload v-model="fileList" |
| | | :fileType="accept" |
| | | :isShowTip="false"/> |
| | | <div v-if="policyInfoForm.fileList.length === 0" style="color: #a9afbc; margin-left: 10px"> |
| | | <div v-if="fileList.length === 0" style="color: #a9afbc; margin-left: 10px"> |
| | | 支持上传PDF格式文件 |
| | | </div> |
| | | </div> |
| | |
| | | |
| | | <script> |
| | | |
| | | import Cookies from "js-cookie"; |
| | | import { |
| | | addProjectInvestmentPolicyCompliance, |
| | | editProjectInvestmentPolicyCompliance, |
| | |
| | | type: Boolean, |
| | | default: false, |
| | | required: true |
| | | } |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | policyInfoForm: { |
| | | id: '', |
| | | projectId: '', |
| | | fileList: [], |
| | | belongsToIndustryAdjustmentDirectory: null, |
| | | belongsToWesternEncouragedDirectory: null, |
| | | notBannedOrControlledProject: true, |
| | | informationIsTrue: true, |
| | | specialPlanningCompliance: '', |
| | | energyCheck: null, |
| | | annualEnergyConsumption: '', |
| | | annualElectricityConsumption: '', |
| | | noOnlyCheckType: null, |
| | | remarks: '' |
| | | // id: '', |
| | | // projectId: '', |
| | | // fileList: [], |
| | | // belongsToIndustryAdjustmentDirectory: null, |
| | | // belongsToWesternEncouragedDirectory: null, |
| | | // notBannedOrControlledProject: true, |
| | | // informationIsTrue: true, |
| | | // specialPlanningCompliance: '', |
| | | // energyCheck: null, |
| | | // annualEnergyConsumption: '', |
| | | // annualElectricityConsumption: '', |
| | | // noOnlyCheckType: null, |
| | | // remarks: '' |
| | | }, |
| | | fileList: [], |
| | | accept: ['pdf'], |
| | | rules: { |
| | | industrialPolicyProhibition: [{required: true, message: '请选择', trigger: 'change'}], |
| | |
| | | }; |
| | | }, |
| | | mounted() { |
| | | this.policyInfoForm.projectId = this.$route.query.projectId; |
| | | const policyInfoForm = Cookies.get("policyInfoForm"); |
| | | const projectForm = Cookies.get("projectForm"); |
| | | const policyInfoForm = localStorage.getItem("policyInfoForm"); |
| | | const projectForm = localStorage.getItem("projectForm"); |
| | | |
| | | const parsedPolicyInfoForm = policyInfoForm ? JSON.parse(policyInfoForm) : null; |
| | | const parsedProjectForm = projectForm ? JSON.parse(projectForm) : null; |
| | | if (parsedPolicyInfoForm) { |
| | | this.policyInfoForm = parsedPolicyInfoForm |
| | | if(this.policyInfoForm.fileList) this.fileList = this.policyInfoForm.fileList |
| | | } |
| | | if (parsedProjectForm) { |
| | | this.projectForm = parsedProjectForm |
| | | } |
| | | // 如果路由存在id且没有缓存,视为编辑或查看,调用api |
| | | if (this.policyInfoForm.projectId && !parsedPolicyInfoForm) { |
| | | if (this.$route.query.projectId && !parsedPolicyInfoForm) { |
| | | this.getProjectInvestmentPolicyCompliance(); |
| | | } else { |
| | | this.policyInfoForm.informationIsTrue= true; |
| | | this.policyInfoForm.notBannedOrControlledProject = true; |
| | | } |
| | | }, |
| | | beforeDestroy() { |
| | | Cookies.set("policyInfoForm", JSON.stringify(this.policyInfoForm)); |
| | | if(Object.keys(this.policyInfoForm).length !==0) localStorage.setItem("policyInfoForm", JSON.stringify(this.policyInfoForm)); |
| | | }, |
| | | methods: { |
| | | getProjectInvestmentPolicyCompliance() { |
| | | getProjectInvestmentPolicyComplianceById(this.policyInfoForm.projectId).then(res => { |
| | | getProjectInvestmentPolicyComplianceById(this.$route.query.projectId).then(res => { |
| | | this.policyInfoForm = res.data; |
| | | if(!this.policyInfoForm.fileList) { |
| | | this.policyInfoForm.fileList = [] |
| | | } |
| | | this.policyInfoForm.notBannedOrControlledProject =true |
| | | this.policyInfoForm.informationIsTrue =true |
| | | this.policyInfoForm.notBannedOrControlledProject = true |
| | | this.policyInfoForm.informationIsTrue = true |
| | | this.fileList =this.policyInfoForm.fileList |
| | | }); |
| | | }, |
| | | submit() { |
| | |
| | | this.$refs["policyInfoFormRef"].validate(valid => { |
| | | if (valid) { |
| | | this.policyInfoForm.projectId = this.projectForm.id; |
| | | if (this.policyInfoForm.id != null) { |
| | | this.policyInfoForm.fileList = this.fileList |
| | | if (this.policyInfoForm.id) { |
| | | editProjectInvestmentPolicyCompliance(this.policyInfoForm).then(response => { |
| | | this.$modal.msgSuccess("修改成功"); |
| | | //跳转到下个组件 |