| | |
| | | <el-col :span="20"> |
| | | <el-form-item label="附件:" label-width="100px" prop="appendix" style="width: 100%"> |
| | | <div style="display: flex;gap: 10px"> |
| | | <file-upload v-model="documentsInfoForm.fileList" |
| | | <file-upload v-model="fileList" |
| | | :fileType="accept" |
| | | :isShowTip="false"/> |
| | | <div v-if="documentsInfoForm.fileList.length === 0" style="color: #a9afbc">支持上传PDF格式文件</div> |
| | | <div v-if="fileList.length === 0" style="color: #a9afbc">支持上传PDF格式文件</div> |
| | | </div> |
| | | </el-form-item> |
| | | </el-col> |
| | |
| | | |
| | | <script> |
| | | |
| | | import { |
| | | addProjectInvestmentFunding, |
| | | editProjectInvestmentFunding, |
| | | getProjectInvestmentFundingById |
| | | } from "@/api/projectEngineering/projectInvestmentFunding"; |
| | | import Cookies from "js-cookie"; |
| | | import {addDocumentInfo, getDocumentInfoById} from "@/api/projectEngineering/projectInfo"; |
| | | |
| | | export default { |
| | |
| | | data() { |
| | | return { |
| | | documentsInfoForm: { |
| | | fileList: [], |
| | | projectId: '' |
| | | // fileList: [], |
| | | // projectId: '' |
| | | }, |
| | | fileList: [], |
| | | projectForm: {}, |
| | | accept: ['pdf'], |
| | | }; |
| | | }, |
| | | methods: { |
| | | getDocumentsInfo() { |
| | | getDocumentInfoById(this.documentsInfoForm.projectId).then(res => { |
| | | getDocumentInfoById(this.$route.query.projectId).then(res => { |
| | | this.documentsInfoForm = res.data; |
| | | if(!this.documentsInfoForm.fileList) { |
| | | this.documentsInfoForm.fileList = [] |
| | | } |
| | | this.fileList = this.documentsInfoForm.fileList |
| | | }); |
| | | }, |
| | | submit() { |
| | |
| | | this.$message.error("请先保存投资管理基本信息") |
| | | } else { |
| | | this.documentsInfoForm.projectId = this.projectForm.id; |
| | | this.documentsInfoForm.fileList = this.fileList |
| | | addDocumentInfo(this.documentsInfoForm).then(response => { |
| | | this.$modal.msgSuccess("提交成功"); |
| | | }); |
| | |
| | | }, |
| | | }, |
| | | mounted() { |
| | | this.documentsInfoForm.projectId = this.$route.query.projectId; |
| | | const documentsInfoForm = Cookies.get("documentsInfoForm"); |
| | | const projectForm = Cookies.get("projectForm"); |
| | | const documentsInfoForm = localStorage.getItem("documentsInfoForm"); |
| | | const projectForm = localStorage.getItem("projectForm"); |
| | | |
| | | const parsedDocumentsInfoForm = documentsInfoForm ? JSON.parse(documentsInfoForm) : null; |
| | | const parsedProjectForm = projectForm ? JSON.parse(projectForm) : null; |
| | | if (parsedDocumentsInfoForm) { |
| | | this.documentsInfoForm = parsedDocumentsInfoForm |
| | | if(this.documentsInfoForm.fileList) this.fileList = this.documentsInfoForm.fileList |
| | | } |
| | | if (parsedProjectForm) { |
| | | this.projectForm = parsedProjectForm |
| | | } |
| | | // 如果路由存在id且没有缓存,视为编辑或查看,调用api |
| | | if (this.documentsInfoForm.projectId && !parsedDocumentsInfoForm) { |
| | | if (this.$route.query.projectId && !parsedDocumentsInfoForm) { |
| | | this.getDocumentsInfo(); |
| | | } |
| | | }, |
| | | beforeDestroy() { |
| | | Cookies.set("documentsInfoForm", JSON.stringify(this.documentsInfoForm)); |
| | | if(Object.keys(this.documentsInfoForm).length !==0) localStorage.setItem("documentsInfoForm", JSON.stringify(this.documentsInfoForm)); |
| | | }, |
| | | |
| | | }; |