From 7adbf0551f6a6b307e66cdd6537ab45fc5a2bf11 Mon Sep 17 00:00:00 2001 From: fuliqi <fuliqi@qq.com> Date: 星期五, 29 十一月 2024 04:00:10 +0800 Subject: [PATCH] bug修复和页面查询 --- src/views/projectEngineering/projectLibrary/component/BasicInfo.vue | 97 +++++++++++++++++++++++++++--------------------- 1 files changed, 54 insertions(+), 43 deletions(-) diff --git a/src/views/projectEngineering/projectLibrary/component/BasicInfo.vue b/src/views/projectEngineering/projectLibrary/component/BasicInfo.vue index 1319e34..cd47875 100644 --- a/src/views/projectEngineering/projectLibrary/component/BasicInfo.vue +++ b/src/views/projectEngineering/projectLibrary/component/BasicInfo.vue @@ -107,7 +107,7 @@ placeholder="璇烽�夋嫨" style="width: 100%" collapse-tags - @change="changeDepartment"> + > <el-option v-for="item in approvalList" :key="item.id" @@ -139,7 +139,6 @@ placeholder="璇烽�夋嫨" style="width: 100%" collapse-tags - @change="changePutUnder" > <el-option v-for="item in dict.type.sys_centralized_management" :key="item.value" :label="item.label" :value="item.value"/> @@ -316,7 +315,11 @@ disabled: { type: Boolean, default: false - } + }, + isShow: { + type: Boolean, + required: true, + }, }, data() { return { @@ -360,8 +363,10 @@ year: '', yearInvestAmount: '', competentDepartmentList: [], - managementCentralizationList: [] + managementCentralizationList: [], }, + subclass: '', + largeCategory: '', approvalList: [], setTime: '', planStartTime: '', @@ -373,8 +378,6 @@ hasMore: true, selectOptions: [], accept: ['pdf', 'docx', 'xlsx', 'jpg', 'jpeg'], - largeCategory: '', - subclass: '', mapCreateInfo: {}, demoFormRef: null, rules: { @@ -392,28 +395,32 @@ }, mounted() { this.projectForm.id = this.$route.query.projectId; - const projectForm = Cookies.get("projectForm"); + const projectForm = localStorage.getItem("projectForm"); + //鍒濆鍖栦富绠¢儴闂ㄤ笅鎷夋 + this.getApprovalList(); if (projectForm) { this.projectForm = JSON.parse(projectForm); + this.$emit('updateIsShow', true); } else { - //鍒濆鍖栦富绠¢儴闂ㄤ笅鎷夋 - this.getApprovalList(); + this.projectForm.id = this.$route.query.projectId; // 鍦ㄧ粍浠跺垱寤烘椂鑾峰彇椤圭洰淇℃伅锛屽鏋� projectId 瀛樺湪 if (this.projectForm.id) { this.getProjectInfo(this.projectForm.id); } else { this.getProjectCodeApi(); + this.$emit('updateIsShow', true); } // this.handleLoadMore(1); } }, beforeDestroy() { - Cookies.set("projectForm", JSON.stringify(this.projectForm)); + localStorage.setItem("projectForm", JSON.stringify(this.projectForm)); }, methods: { getProjectInfo(id) { getProject(id).then(res => { this.projectForm = res.data; + this.$emit('updateIsShow', true); }); }, getApprovalList() { @@ -424,7 +431,7 @@ submit() { this.$refs["projectForm"].validate(valid => { if (valid) { - if (this.projectForm.id != null) { + if (this.projectForm.id) { updateProject(this.projectForm).then(response => { this.$modal.msgSuccess("淇敼鎴愬姛"); //璺宠浆鍒颁笅涓粍浠� @@ -446,22 +453,23 @@ this.projectForm.projectCode = res.data; }); }, - changeDepartment(val) { - if (!val.length) { - this.largeCategory = ''; - return; - } - const labels = this.approvalList.filter(item => val.includes(item.id)).map(item => item.value); - this.largeCategory = labels.join(','); - }, - changePutUnder(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(','); - }, + // changeDepartment(val) { + // console.log("瑙﹀彂浜嬩欢" + val + this.approvalList) + // if (!val.length) { + // this.largeCategory = ''; + // return; + // } + // const labels = this.approvalList.filter(item => val.includes(item.id)).map(item => item.value); + // this.largeCategory = labels.join(','); + // }, + // changePutUnder(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 { this.loading = true; @@ -506,22 +514,25 @@ }, watch: { - 'projectForm.managementCentralizationList'(val) { - if (val) { - const labels = this.dict.type.sys_centralized_management - .filter(item => val.includes(item.value)) - .map(item => item.label); - this.subclass = labels.join(','); - } - }, - 'projectForm.competentDepartmentList'(val) { - if (val) { - const labels = this.approvalList - .filter(item => val.includes(item.id)) - .map(item => item.value); - this.largeCategory = labels.join(','); - } - }, + 'projectForm': { + handler(newVal, oldVal) { + setTimeout(() => { + if (newVal.managementCentralizationList) { + const labels = this.dict.type.sys_centralized_management + .filter(item => newVal.managementCentralizationList.includes(item.value)) + .map(item => item.label); + this.subclass = labels.join(','); + } + if (newVal.competentDepartmentList) { + const labels = this.approvalList + .filter(item => newVal.competentDepartmentList.includes(item.id)) + .map(item => item.value); + this.largeCategory = labels.join(','); + } + }, 1000); + }, + deep: true + } } }; </script> -- Gitblit v1.8.0