From 1ee06ad14e5b42aca4f23918965c37662b5f03f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E7=8E=89=E7=90=A6?= <7507756+jiang_yuqi@user.noreply.gitee.com> Date: Sat, 21 Jun 2025 16:01:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/header.vue | 46 ++++++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 18 deletions(-) diff --git a/src/components/header.vue b/src/components/header.vue index b0c46da..83339c0 100644 --- a/src/components/header.vue +++ b/src/components/header.vue @@ -266,7 +266,6 @@ export default { let _dept = { id: res.rows[0].deptId, text: res.rows[0].deptName }; this.$root.dept = _dept; let _project = { id: res.rows[0].id, text: res.rows[0].projectName }; - this.$root.project = _project; this.$root.hasInitHeader = true; this.$root._prjIds = res.rows[0].id; let _projects = []; @@ -546,24 +545,35 @@ export default { cb(); } }, - setScreenLiSel2(item, init) { - if (item) { - this.showSel2 = false; - if (!init || !this.dept2) { - localStorage.setItem("data2", JSON.stringify(item)) - this.localStorage2 = JSON.parse(localStorage.getItem("data2")) - //this.$emit('itemdata', item); - this.dept2 = item.text; - } - this.$root.project = this.localStorage2; - //this.$bus.$emit("projectChange", this.localStorage2); - } else { - localStorage.removeItem("data2"); - this.localStorage2 = {}; - this.showSel2 = false; - this.dept2 = ''; + setScreenLiSel2(proItem, init) { + if(proItem && proItem.id){ + this.$root.projects.forEach(item => { + if (item.id == proItem.id) { + this.$root.project = item; + localStorage.setItem("data2", JSON.stringify(proItem)); + this.localStorage2 = proItem; + this.dept2 = proItem.text; + this.$bus.$emit("projectChange",proItem); + } + }); } - this.$bus.$emit("projectChange",this.localStorage2); + // if (item) { + // this.showSel2 = false; + // if (!init || !this.dept2) { + // localStorage.setItem("data2", JSON.stringify(item)) + // this.localStorage2 = JSON.parse(localStorage.getItem("data2")) + // //this.$emit('itemdata', item); + // //this.dept2 = item.text; + // } + // this.$root.project = this.localStorage2; + // //this.$bus.$emit("projectChange", this.localStorage2); + // } else { + // localStorage.removeItem("data2"); + // this.localStorage2 = {}; + // this.showSel2 = false; + // this.dept2 = ''; + // } + //this.$bus.$emit("projectChange",this.localStorage2); }, //时间方法