From 6cf7ea7aa09553b9fe148f94ec6158dbb2b2c9bc Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期二, 08 四月 2025 18:22:19 +0800 Subject: [PATCH] v-show --- src/views/projectEngineering/projectLibrary/component/legalPerson.vue | 236 ++++++++++++++++++++++++++++++++++++++++++++++------------- 1 files changed, 184 insertions(+), 52 deletions(-) diff --git a/src/views/projectEngineering/projectLibrary/component/legalPerson.vue b/src/views/projectEngineering/projectLibrary/component/legalPerson.vue index 0f2cc67..72aa0c8 100644 --- a/src/views/projectEngineering/projectLibrary/component/legalPerson.vue +++ b/src/views/projectEngineering/projectLibrary/component/legalPerson.vue @@ -1,21 +1,42 @@ <template> <div class="basic-info"> - <el-form ref="demoFormRef" :disabled="disabled" :model="legalPerson" class="dialog_form"> + <el-form ref="demoFormRef" :disabled="disabled" :model="legalPersonForm" class="dialog_form"> <el-row :gutter="20"> - <el-col :span="6"> - <el-form-item label="椤圭洰鎬绘姇棰�" label-width="120px" prop="investmentType" style="width: 100%"> - <el-input v-model="legalPerson.totalInvestment" class="item" clearable maxlength="255" placeholder="璇疯緭鍏�" /> +<!-- <el-col :span="6">--> +<!-- <el-form-item label="椤圭洰鎬绘姇棰�" label-width="120px" prop="investmentType" style="width: 100%">--> +<!-- <el-input v-model="legalPersonForm.totalInvestment" class="item" clearable maxlength="255" style="width: 90%"--> +<!-- placeholder="璇疯緭鍏�"/>--> +<!-- <span class="money">涓囧厓</span>--> +<!-- </el-form-item>--> +<!-- </el-col>--> + <el-col :span="12"> + <el-form-item label="椤圭洰鍗曚綅" label-width="120px" prop="investmentType" + > + <el-select + v-model="legalPersonForm.projectUnit" + filterable + placeholder="璇烽�夋嫨鎴栬緭鍏�" + style="width: 100%;" + @change="handleSelectChange" + remote + :remote-method="handleBlur" + > + <el-option + v-for="item in options" + :key="item.id" + :label="item.projectUnit" + :value="item.id" + > + </el-option> + </el-select> </el-form-item> </el-col> - <el-col :span="6"> - <el-form-item label="椤圭洰鍗曚綅" label-width="120px" prop="investmentType" style="width: 100%"> - <el-input v-model="legalPerson.projectUnit" class="item" clearable maxlength="255" placeholder="璇疯緭鍏�" /> - </el-form-item> - </el-col> + + <el-col :span="6"> <el-form-item label="椤圭洰鍗曚綅绫诲瀷" label-width="120px" prop="projectType" style="width: 100%"> <el-select - v-model="legalPerson.projectUnitType" + v-model="legalPersonForm.projectUnitType" clearable placeholder="璇烽�夋嫨" style="width: 100%" @@ -30,7 +51,7 @@ <el-col :span="6"> <el-form-item label="鐧昏娉ㄥ唽绫诲瀷" label-width="120px" prop="projectType" style="width: 100%"> <el-select - v-model="legalPerson.registrationType" + v-model="legalPersonForm.registrationType" clearable placeholder="璇烽�夋嫨" style="width: 100%" @@ -43,7 +64,7 @@ <el-col :span="6"> <el-form-item label="鎺ц偂鎯呭喌" label-width="120px" prop="projectType" style="width: 100%"> <el-select - v-model="legalPerson.holdingSituation" + v-model="legalPersonForm.holdingSituation" clearable placeholder="璇烽�夋嫨" style="width: 100%" @@ -56,7 +77,7 @@ <el-col :span="6"> <el-form-item label="璇佺収绫诲瀷" label-width="120px" prop="projectstatus" style="width: 100%"> <el-select - v-model="legalPerson.certificateType" + v-model="legalPersonForm.certificateType" clearable placeholder="璇烽�夋嫨" style="width: 100%" @@ -70,75 +91,84 @@ <el-row :gutter="20"> <el-col :span="6"> <el-form-item label="璇佷欢鍙风爜" label-width="120px" prop="investmentType" style="width: 100%"> - <el-input v-model.trim="legalPerson.certificateNumber" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" /> + <el-input v-model.trim="legalPersonForm.certificateNumber" class="item" clearable maxlength="255" + placeholder="璇疯緭鍏�"/> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="娉ㄥ唽鍦板潃" label-width="120px" prop="investmentType" style="width: 100%"> - <el-input v-model.trim="legalPerson.registeredAddress" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" /> + <el-input v-model.trim="legalPersonForm.registeredAddress" class="item" clearable maxlength="255" + placeholder="璇疯緭鍏�"/> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="娉ㄥ唽璧勯噾" label-width="120px" prop="projectType" style="width: 100%"> - <el-input v-model.trim="legalPerson.registeredCapital" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" /> + <el-input v-model.trim="legalPersonForm.registeredCapital" 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="娉曚汉浠h〃" label-width="120px" prop="investmentType" style="width: 100%"> - <el-input v-model.trim="legalPerson.legal_representative" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" /> + <el-input v-model.trim="legalPersonForm.legalRepresentative" class="item" clearable maxlength="255" + placeholder="璇疯緭鍏�"/> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="鍥哄畾鐢佃瘽" label-width="120px" prop="investmentType" style="width: 100%"> - <el-input v-model.trim="legalPerson.fixedPhone" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" /> + <el-input v-model.trim="legalPersonForm.fixedPhone" class="item" clearable maxlength="255" + placeholder="璇疯緭鍏�"/> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="娉曚汉韬唤璇佸彿" label-width="120px" prop="projectType" style="width: 100%"> - <el-input v-model.trim="legalPerson.legalPersonIdcard" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" /> + <el-input v-model.trim="legalPersonForm.legalPersonIdcard" 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="investmentType" style="width: 100%"> - <el-input v-model.trim="legalPerson.projectContactPerson" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" /> + <el-input v-model.trim="legalPersonForm.projectContactPerson" class="item" clearable maxlength="255" + placeholder="璇疯緭鍏�"/> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="绉诲姩鐢佃瘽" label-width="120px" prop="investmentType" style="width: 100%"> - <el-input v-model.trim="legalPerson.phone" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" /> + <el-input v-model.trim="legalPersonForm.phone" class="item" clearable maxlength="255" placeholder="璇疯緭鍏�"/> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="鑱旂郴浜鸿韩浠借瘉鍙�" label-width="120px" prop="projectType" style="width: 100%"> - <el-input v-model.trim="legalPerson.contactIdcard" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" /> + <el-input v-model.trim="legalPersonForm.contactIdcard" 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="investmentType" style="width: 100%"> - <el-input v-model.trim="legalPerson.wechat" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" /> + <el-input v-model.trim="legalPersonForm.wechat" class="item" clearable maxlength="255" placeholder="璇疯緭鍏�"/> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="鑱旂郴浜洪�氳鍦板潃" label-width="120px" prop="investmentType" style="width: 100%"> - <el-input v-model.trim="legalPerson.contactAddress" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" /> + <el-input v-model.trim="legalPersonForm.contactAddress" class="item" clearable maxlength="255" + placeholder="璇疯緭鍏�"/> </el-form-item> </el-col> <el-col :span="6"> <el-form-item label="閭斂缂栫爜" label-width="120px" prop="projectType" style="width: 100%"> - <el-input v-model.trim="legalPerson.postCode" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" /> + <el-input v-model.trim="legalPersonForm.postCode" 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="investmentType" style="width: 100%"> - <el-input v-model="legalPerson.email" class="item" clearable disabled maxlength="255" placeholder="璇疯緭鍏�" /> + <el-input v-model="legalPersonForm.email" class="item" clearable maxlength="255" placeholder="璇疯緭鍏�"/> </el-form-item> </el-col> </el-row> @@ -148,49 +178,147 @@ <script> +import Cookies from "js-cookie"; +import { + addProjectUnitRegistrationInfo, + editProjectUnitRegistrationInfo, + getProjectUnitRegistrationInfoById, + getUnitRegistrationInfoByName +} from "@/api/projectEngineering/projectUnitRegistrationInfo"; + export default { - dicts: ['sys_unit_type','sys_registration_type','sys_holding_situation','sys_license_type'], + dicts: ['sys_unit_type', 'sys_registration_type', 'sys_holding_situation', 'sys_license_type'], name: 'LegalPersonForm', props: { disabled: { type: Boolean, default: false, required: true - } + }, }, data() { return { - legalPerson: { - totalInvestment: '', + //椤圭洰鍗曚綅閫夋嫨妗� + selectProjectUnit:'', + projectForm: {}, + //鍗曚綅娉曚汉淇℃伅 + options:[], + legalPersonForm: { + // id: '', + // totalInvestment: '', projectUnit: '', - projectUnitType: '', - registrationType: '', - holdingSituation: '', - certificateType: '', - certificateNumber: '', - registeredAddress: '', - registeredCapital: '', - projectId: '', - legal_representative: '', - fixedPhone: '', - legalPersonIdcard: '', - projectContactPerson: '', - phone: '', - contactIdcard: '', - wechat: '', - contactAddress: '', - postCode: '', - email: '' + // projectUnitType: '', + // registrationType: '', + // holdingSituation: '', + // certificateType: '', + // certificateNumber: '', + // registeredAddress: '', + // registeredCapital: '', + // projectId: '', + // legalRepresentative: '', + // fixedPhone: '', + // legalPersonIdcard: '', + // projectContactPerson: '', + // phone: '', + // contactIdcard: '', + // wechat: '', + // contactAddress: '', + // postCode: '', + // email: '' }, } }, - created() { + mounted() { + const legalPersonForm = localStorage.getItem("legalPersonForm"); + const projectForm = localStorage.getItem("projectForm"); + + const parsedLegalPersonForm = legalPersonForm ? JSON.parse(legalPersonForm) : null; + const parsedProjectForm = projectForm ? JSON.parse(projectForm) : null; + if (parsedLegalPersonForm) { + this.legalPersonForm = parsedLegalPersonForm + } + if (parsedProjectForm) { + this.projectForm = parsedProjectForm + } + // 濡傛灉璺敱瀛樺湪id涓旀病鏈夌紦瀛�,瑙嗕负缂栬緫鎴栨煡鐪嬶紝璋冪敤api + if (this.$route.query.projectId && !parsedLegalPersonForm) { + this.getProjectUnitRegistrationInfo(); + } + + this.legalPersonForm.projectId = this.projectForm.id; }, + beforeDestroy() { + if(Object.keys(this.legalPersonForm).length !==0) localStorage.setItem("legalPersonForm", JSON.stringify(this.legalPersonForm)); + }, methods: { - submit() { - console.log("娉曚汉submit") + + handleSelectChange(row) { + if (this.options !== null) { + this.options.forEach(item => { + if (item.id === row) { + this.legalPersonForm = item; + this.legalPersonForm.id = null; + } + }) + } + }, + //椤圭洰鍗曚綅杈撳叆鏃惰Е鍙� + handleBlur(query){ + + this.legalPersonForm.projectUnit = query; + if (this.legalPersonForm.projectUnit !== null && this.legalPersonForm.projectUnit !== '' && this.legalPersonForm.projectUnit !== undefined){ + getUnitRegistrationInfoByName(this.legalPersonForm).then(res =>{ + this.options = res.data; + }) + } + }, + getProjectUnitRegistrationInfo() { + getProjectUnitRegistrationInfoById(this.$route.query.projectId).then(res => { + this.legalPersonForm = res.data; + }); + }, + submit() { + if (!this.projectForm.id) { + this.$message.error("璇峰厛淇濆瓨鎶曡祫绠$悊鍩烘湰淇℃伅") + } else { + this.legalPersonForm.projectId = this.projectForm.id; + if (this.legalPersonForm.id) { + editProjectUnitRegistrationInfo(this.legalPersonForm).then(response => { + this.$modal.msgSuccess("淇敼鎴愬姛"); + //璺宠浆鍒颁笅涓粍浠� + this.$emit('toNext', 4); + }); + } else { + addProjectUnitRegistrationInfo(this.legalPersonForm).then(response => { + this.$modal.msgSuccess("鏂板鎴愬姛"); + this.legalPersonForm.id = response.data + //璺宠浆鍒颁笅涓粍浠� + this.$emit('toNext', 4); + }); + } + } + }, + }, + watch: { + 'legalPersonForm.projectUnit':{ + deep:true, + handler(newVal) { + if (newVal === null || newVal === ''){ + this.options = null; + } + } + }, + legalPersonForm: { + deep: true, + handler(newVal) { + this.$emit('legalPersonForm', newVal) + } + }, + + + } } </script> @@ -208,7 +336,11 @@ width: 100%; } } - +.money { + font-size: 12px; + margin-left: 2px; + color: #909399; +} .map-btn { width: 32px; height: 32px; -- Gitblit v1.8.0