From acf78f6ef785df7f5fa15d1ee0fc62c0bbbe74f6 Mon Sep 17 00:00:00 2001 From: luohairen <3399054449@qq.com> Date: 星期五, 29 十一月 2024 02:37:42 +0800 Subject: [PATCH] 项目计划审批 --- src/views/projectEngineering/projectLibrary/component/DocumentsInfo.vue | 75 ++++++++++++++++++++++++++----------- 1 files changed, 53 insertions(+), 22 deletions(-) diff --git a/src/views/projectEngineering/projectLibrary/component/DocumentsInfo.vue b/src/views/projectEngineering/projectLibrary/component/DocumentsInfo.vue index f599c38..de37951 100644 --- a/src/views/projectEngineering/projectLibrary/component/DocumentsInfo.vue +++ b/src/views/projectEngineering/projectLibrary/component/DocumentsInfo.vue @@ -1,14 +1,14 @@ <template> <div class="policy-info"> - <el-form ref="demoFormRef" :disabled="disabled" :model="fileIdList" class="dialog_form"> + <el-form ref="demoFormRef" :disabled="disabled" :model="documentsInfoForm" class="dialog_form"> <el-row :gutter="0"> <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="documentsInfoList" + <file-upload v-model="documentsInfoForm.fileList" :fileType="accept" :isShowTip="false"/> - <div v-if="documentsInfoList.length === 0" style="color: #a9afbc">鏀寔涓婁紶PDF鏍煎紡鏂囦欢</div> + <div v-if="documentsInfoForm.fileList.length === 0" style="color: #a9afbc">鏀寔涓婁紶PDF鏍煎紡鏂囦欢</div> </div> </el-form-item> </el-col> @@ -18,6 +18,14 @@ </template> <script> + +import { + addProjectInvestmentFunding, + editProjectInvestmentFunding, + getProjectInvestmentFundingById +} from "@/api/projectEngineering/projectInvestmentFunding"; +import Cookies from "js-cookie"; +import {addDocumentInfo, getDocumentInfoById} from "@/api/projectEngineering/projectInfo"; export default { props: { @@ -29,33 +37,56 @@ }, data() { return { - fileIdList: [], - documentsInfoList: [], - accept: ['pdf', 'docx', 'xlsx', 'jpg','jpeg'], + documentsInfoForm: { + fileList: [], + projectId: '' + }, + projectForm: {}, + accept: ['pdf'], }; }, - watch: { - // 鐩戝惉 documentsInfoList 鐨勫彉鍖栵紝骞舵洿鏂� fileIdList - documentsInfoList(newVal) { - this.fileIdList = newVal.map(item => item.fileId); - } - }, methods: { - handleRemove(file) { - if (file) { - this.fileIdList = this.documentsInfoList.map(item => item.fileId); - localStorage.setItem('fileIdList', JSON.stringify(file)); + getDocumentsInfo() { + getDocumentInfoById(this.documentsInfoForm.projectId).then(res => { + this.documentsInfoForm = res.data; + if(!this.documentsInfoForm.fileList) { + this.documentsInfoForm.fileList = [] + } + }); + }, + submit() { + if (!this.projectForm.id) { + this.$message.error("璇峰厛淇濆瓨鎶曡祫绠$悊鍩烘湰淇℃伅") + } else { + this.documentsInfoForm.projectId = this.projectForm.id; + addDocumentInfo(this.documentsInfoForm).then(response => { + this.$modal.msgSuccess("鎻愪氦鎴愬姛"); + }); } }, - handleAdd(file) { - if (file && file.length > 0) { - localStorage.setItem('fileIdList', JSON.stringify(file)); - } + }, + mounted() { + this.documentsInfoForm.projectId = this.$route.query.projectId; + const documentsInfoForm = Cookies.get("documentsInfoForm"); + const projectForm = Cookies.get("projectForm"); + + const parsedDocumentsInfoForm = documentsInfoForm ? JSON.parse(documentsInfoForm) : null; + const parsedProjectForm = projectForm ? JSON.parse(projectForm) : null; + if (parsedDocumentsInfoForm) { + this.documentsInfoForm = parsedDocumentsInfoForm + } + if (parsedProjectForm) { + this.projectForm = parsedProjectForm + } + // 濡傛灉璺敱瀛樺湪id涓旀病鏈夌紦瀛�,瑙嗕负缂栬緫鎴栨煡鐪嬶紝璋冪敤api + if (this.documentsInfoForm.projectId && !parsedDocumentsInfoForm) { + this.getDocumentsInfo(); } }, + beforeDestroy() { + Cookies.set("documentsInfoForm", JSON.stringify(this.documentsInfoForm)); + }, - mounted() { - } }; </script> -- Gitblit v1.8.0