From 0ead7315c0e6076aded0dac7a6ff0b89c632287b Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期四, 28 十一月 2024 01:32:41 +0800 Subject: [PATCH] 项目基本信息、投资基本信息 --- src/views/projectEngineering/projectLibrary/component/BasicInfo.vue | 166 +++++++++++++++++++++++++++++++++++------------------- 1 files changed, 107 insertions(+), 59 deletions(-) diff --git a/src/views/projectEngineering/projectLibrary/component/BasicInfo.vue b/src/views/projectEngineering/projectLibrary/component/BasicInfo.vue index 54d9aca..cd4835a 100644 --- a/src/views/projectEngineering/projectLibrary/component/BasicInfo.vue +++ b/src/views/projectEngineering/projectLibrary/component/BasicInfo.vue @@ -1,6 +1,6 @@ <template> <div class="basic-info"> - <el-form ref="demoFormRef" :disabled="disabled" :model="projectForm" :rules="rules" class="dialog_form"> + <el-form ref="projectForm" :disabled="disabled" :model="projectForm" :rules="rules" class="dialog_form"> <el-row :gutter="20"> <el-col :span="6"> <el-form-item class="item" label="椤圭洰鍚嶇О" label-width="100px" prop="projectName"> @@ -102,8 +102,12 @@ style="width: 100%" collapse-tags @change="changeDepartment"> - <el-option v-for="item in dict.type.sys_competent_department" :key="item.value" :label="item.label" - :value="item.value"/> + <el-option + v-for ="item in approvalList" + :key="item.id" + :value="item.id" + :label="item.value" + /> </el-select> </el-form-item> </el-col> @@ -152,7 +156,7 @@ </el-form-item> </el-col> <el-col :span="6"> - <el-form-item label="鎸夌洰褰�" label-width="100px" style="width: 100%"> + <el-form-item label="鎶曡祫绫诲埆" label-width="100px" style="width: 100%"> <el-input v-model="largeCategory" clearable disabled placeholder="璇烽�夋嫨澶х被" style="width: 49%" /> <el-input v-model="subclass" clearable disabled placeholder="璇烽�夋嫨灏忕被" style="width: 49%;margin-left: 2%" /> </el-form-item> @@ -174,17 +178,30 @@ <el-row :gutter="20"> <el-col :span="6"> <el-form-item label="绔嬮」鏃堕棿" label-width="100px" prop="setTime" style="width: 100%"> - <el-date-picker v-model="setTime" placeholder="閫夋嫨鏃堕棿" style="width: 100%" type="date" @change="chaneApproval" /> + <el-date-picker v-model="projectForm.createProjectTime" + placeholder="閫夋嫨鏃堕棿" + 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="100px" style="width: 100%"> - <el-date-picker v-model="planStartTime" placeholder="閫夋嫨鏃堕棿" style="width: 100%" type="date" @change="chaneStartWork" /> + <el-date-picker v-model="projectForm.planStartTime " + placeholder="閫夋嫨鏃堕棿" + style="width: 100%" + type="date" + @change="chaneStartWork" + value-format="yyyy-MM-dd HH:mm:ss"/> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="璁″垝绔e伐鏃堕棿" label-width="100px" style="width: 100%"> - <el-date-picker v-model="planCompleteTime" placeholder="閫夋嫨鏃堕棿" style="width: 100%" type="date" @change="chaneCompleted" /> + <el-date-picker v-model="projectForm.planCompleteTime " + placeholder="閫夋嫨鏃堕棿" + style="width: 100%" + type="date" + value-format="yyyy-MM-dd HH:mm:ss"/> </el-form-item> </el-col> </el-row> @@ -201,7 +218,11 @@ </el-col> <el-col :span="6"> <el-form-item label="涓爣鏃堕棿" label-width="100px" style="width: 100%"> - <el-date-picker v-model="winTime" placeholder="閫夋嫨鏃堕棿" style="width: 100%" type="date" @change="chaneWinTime" /> + <el-date-picker v-model="projectForm.winTime" + placeholder="閫夋嫨鏃堕棿" + style="width: 100%" + type="date" + value-format="yyyy-MM-dd HH:mm:ss"/> </el-form-item> </el-col> </el-row> @@ -230,7 +251,7 @@ <el-col :span="18"> <el-form-item label="椤圭洰鍦板潃:" label-width="100px" prop="medicalAddr" style="width: 100%"> <div class="input-row"> - <el-input v-model.trim="projectForm.address" class="input-item" disabled maxlength="255" placeholder="璇疯緭鍏�"></el-input> + <el-input v-model.trim="projectForm.projectAddress" class="input-item" disabled maxlength="255" placeholder="璇疯緭鍏�"></el-input> <div v-if="!disabled" class="map-btn" @click="dialogMap = true"> <img alt="" src="@/assets/images/positionl.png" /> </div> @@ -241,7 +262,7 @@ <el-row :gutter="0"> <el-col :span="18"> <el-form-item label="瀹℃壒璁″垝涔�:" label-width="100px" prop="medicalAddr" style="width: 100%"> - <file-upload v-model="projectList" + <file-upload v-model="projectForm.fileList" :fileType="accept" :isShowTip="false"/> </el-form-item> @@ -271,7 +292,9 @@ // import { usePlanLibrary } from '@/hooks/detailsInformation'; // import { getList } from '@/api/engineeringLibrary/index'; // import RemoteSelect from '@/components/RemoteSelect/index.vue'; -import { formatDate } from '@/utils'; +import Cookies from "js-cookie"; +import { addProject, getProject, updateProject, getProjectCode } from '@/api/projectEngineering/projectInfo'; +import {approvalList} from "@/api/system/dept"; export default { dicts: ['sys_funding_type', 'sys_investment_type', 'sys_project_type', 'sys_project_status','sys_competent_department' @@ -290,6 +313,7 @@ data() { return { projectForm: { + id: '', projectName: '', projectCode: '', projectType: '', @@ -315,7 +339,7 @@ winTime: '', winUnit: '', winAmount: '', - address: '', + projectAddress: '', engineeringIdList: [], content: '', contact: '', @@ -323,19 +347,18 @@ planStartTime: '', planCompleteTime: '', projectContactPerson: '', - fileIdList: [], - sysOssVos: [], + fileList: [], engineeringInfos: [], year: '', yearInvestAmount: '', competentDepartmentList: [], managementCentralizationList: [] }, + approvalList: [], setTime: '', planStartTime: '', planCompleteTime: '', winTime: '', - projectList: [], dialogMap: false, page: 1, loading: false, @@ -354,41 +377,84 @@ computed: { dialogMapList () { return [{ - addr: this.projectForm.address, + addr: this.projectForm.projectAddress, name: '鍒涘缓' }]; }, }, created() { - this.handleLoadMore(1); + const projectForm = Cookies.get("projectForm"); + if (projectForm) { + this.projectForm = JSON.parse(projectForm); + } else { + //鍒濆鍖栦富绠¢儴闂ㄤ笅鎷夋 + this.getApprovalList(); + if(this.$route.query.projectId) { + this.projectForm.id = this.$route.query.projectId; + } + // 鍦ㄧ粍浠跺垱寤烘椂鑾峰彇椤圭洰淇℃伅锛屽鏋� projectId 瀛樺湪 + if (this.projectForm.id) { + this.getProjectInfo(this.projectForm.id); + } else { + this.getProjectCodeApi(); + } + // this.handleLoadMore(1); + } + }, + beforeDestroy() { + Cookies.set("projectForm",JSON.stringify(this.projectForm)); }, methods: { + getProjectInfo(id) { + getProject(id).then(res => { + this.projectForm = res.data; + }); + }, + getApprovalList() { + approvalList().then(res => { + this.approvalList = res.data; + }); + }, + submit() { + this.$refs["projectForm"].validate(valid => { + if (valid) { + if (this.projectForm.id != null) { + updateProject(this.projectForm).then(response => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + //璺宠浆鍒颁笅涓粍浠� + this.$emit('toNext', 1); + }); + } else { + addProject(this.projectForm).then(response => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.projectForm.id = response.data + //璺宠浆鍒颁笅涓粍浠� + this.$emit('toNext', 1); + }); + } + } + }); + }, + getProjectCodeApi() { + getProjectCode().then(res => { + this.projectForm.projectCode = res.data; + }); + }, changeDepartment(val) { if (!val.length) { this.largeCategory = ''; return; } - const labels = this.sysDepartment.filter(item => val.includes(item.value)).map(item => item.label); + const labels = this.approvalList.filter(item => val.includes(item.id)).map(item => item.value); this.largeCategory = labels.join(','); }, changePutUnder(val) { - // 鍚� changeDepartment 鏂规硶 - }, - chaneApproval(val) { - if (!val) return; - this.projectForm.setTime = formatDate(val); - }, - chaneCompleted(val) { - if (!val) return; - this.projectForm.planCompleteTime = formatDate(val); - }, - chaneWinTime(val) { - if (!val) return; - this.projectForm.winTime = formatDate(val); - }, - chaneStartWork(val) { - if (!val) return; - this.projectForm.planStartTime = formatDate(val); + if (!val.length) { + this.subclass = ''; + return; + } + const labels = this.dict.type.sys_centralized_management.filter(item => val.includes(item.value)).map(item => item.label); + this.subclass = labels.join(','); }, async loadDataList(newPage) { try { @@ -424,29 +490,19 @@ if (lon && lat && addr) { this.projectForm.longitude = lon; this.projectForm.latitude = lat; - this.projectForm.address = addr; + this.projectForm.projectAddress = addr; this.$message.success('鑾峰彇鍦板潃鎴愬姛'); this.dialogMap = false; } else { this.$message.error('鑾峰彇鍧愭爣澶辫触'); } }, - handleRemove(file) { - if (file) { - this.projectForm.fileIdList = this.projectList.map(item => item.fileId); - localStorage.setItem('projectList', JSON.stringify(file)); - } - }, - handleAdd(file) { - if (file) { - localStorage.setItem('projectList', JSON.stringify(file)); - } - } + }, watch: { 'projectForm.managementCentralizationList'(val) { if (val) { - const labels = this.sysCentralizedManagement + const labels = this.dict.type.sys_centralized_management .filter(item => val.includes(item.value)) .map(item => item.label); this.subclass = labels.join(','); @@ -454,20 +510,12 @@ }, 'projectForm.competentDepartmentList'(val) { if (val) { - const labels = this.sysDepartment - .filter(item => val.includes(item.value)) - .map(item => item.label); + const labels = this.approvalList + .filter(item => val.includes(item.id)) + .map(item => item.value); this.largeCategory = labels.join(','); } }, - projectList: { - handler(val) { - if (val) { - this.projectForm.fileIdList = val.map(item => item.fileId); - } - }, - deep: true - } } }; </script> -- Gitblit v1.8.0