From bff05c941230c57f0a1ed8d0e3c4f9c7b2b8af13 Mon Sep 17 00:00:00 2001
From: MrShi <1878285526@qq.com>
Date: 星期二, 11 十一月 2025 16:40:14 +0800
Subject: [PATCH] 优化

---
 admin/src/views/business/internalCompany.vue |    4 ++--
 admin/src/components/common/CommonHeader.vue |    8 ++++----
 admin/src/main.js                            |   15 ++++++++++++---
 admin/src/store/index.js                     |    9 ++++++++-
 4 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/admin/src/components/common/CommonHeader.vue b/admin/src/components/common/CommonHeader.vue
index 7b28a6b..ad3345e 100644
--- a/admin/src/components/common/CommonHeader.vue
+++ b/admin/src/components/common/CommonHeader.vue
@@ -66,7 +66,6 @@
     return {
       title: process.env.VUE_APP_TITLE,
       headerNavData: {},
-      currentIndex: 0,
       visible: {
         // 淇敼瀵嗙爜
         changePwd: false
@@ -99,7 +98,7 @@
     }
   },
   computed: {
-    ...mapState(['menuData', 'userInfo', 'topMenuList'])
+    ...mapState(['menuData', 'userInfo', 'topMenuList', 'currentIndex'])
     // title () {
     //   return this.$route.meta.title
     // }
@@ -126,7 +125,7 @@
     }
   },
   methods: {
-    ...mapMutations(['setUserInfo', 'switchCollapseMenu', 'clearUserInfo', 'setTopMenuCurrent']),
+    ...mapMutations(['setUserInfo', 'switchCollapseMenu', 'clearUserInfo', 'setTopMenuCurrent', 'setCurrentIndex']),
     // 淇敼瀵嗙爜
     changePwd () {
       this.visible.changePwd = true
@@ -165,8 +164,9 @@
       }
     },
     getHeaderNav (item,index) {
-      this.currentIndex = index
+      this.setCurrentIndex(index)
       if(item.linkType === 0){
+        console.log('setTopMenuCurrent')
         this.setTopMenuCurrent(item)
       }else{
         if (item.url && item.url === 'goHKAF' && item.params != null) {
diff --git a/admin/src/main.js b/admin/src/main.js
index a0eb2fd..dc697c7 100644
--- a/admin/src/main.js
+++ b/admin/src/main.js
@@ -55,7 +55,7 @@
     }
   },
   methods: {
-    ...mapMutations(['switchCollapseMenu', 'setHomePage', 'setTopMenuCurrent', 'setTopMenuCurrent','cleartagsview']),
+    ...mapMutations(['switchCollapseMenu', 'setCurrentIndex', 'setHomePage', 'setTopMenuCurrent', 'setTopMenuCurrent','cleartagsview']),
     // 鍒濆鍖栨湰鍦伴厤缃�
     initLocalConfig () {
       // 鑿滃崟鐘舵�侀厤缃�
@@ -95,7 +95,14 @@
               tlist.push(...item.children)
             }
           })
-          this.setTopMenuCurrent(topCurrent)
+          if (this.$route.query && this.$route.query.menuparams) {
+            let menu = topList.filter(item => item.params === this.$route.query.menuparams)
+            this.setTopMenuCurrent(menu[0])
+            this.setCurrentIndex(topList.findIndex(obj => obj.params === this.$route.query.menuparams))
+          } else {
+            this.setTopMenuCurrent(topCurrent)
+            this.setCurrentIndex(0)
+          }
           // console.log(topList)
           // var menus = []
           // topList.forEach(item => {
@@ -120,7 +127,9 @@
             redirect: this.homePage.url
           })
           // 璺敱鍔犺浇瀹屾垚鍚庯紝濡傛灉璁块棶鐨勬槸/锛岃烦杞嚦鍔ㄦ�佽瘑鍒殑棣栭〉
-          if (this.$route.path === '/') {
+          if (this.$route.query && this.$route.query.menuparams) {
+            this.$router.push(topList.filter(item => item.params === this.$route.query.menuparams)[0].homeUrl)
+          } else if (this.$route.path === '/') {
             this.$router.push(this.homePage.url)
           }
         })
diff --git a/admin/src/store/index.js b/admin/src/store/index.js
index eae17b4..65559a6 100644
--- a/admin/src/store/index.js
+++ b/admin/src/store/index.js
@@ -28,10 +28,17 @@
   // tags鏁扮粍
   tags: [],
   // tagsview鏍囩鏄剧ず闅愯棌
-  isCollapse: false
+  isCollapse: false,
+  // 椤堕儴鑿滃崟绱㈠紩
+  currentIndex: 0
 }
 
 const mutations = {
+  // 璁剧疆椤堕儴鑿滃崟绱㈠紩
+  setCurrentIndex(state, index) {
+    console.log('璁剧疆椤堕儴鑿滃崟绱㈠紩', index)
+    state.currentIndex = index
+  },
   // 鍒囨崲鑿滃崟鐘舵��
   switchCollapseMenu (state, value) {
     if (value != null) {
diff --git a/admin/src/views/business/internalCompany.vue b/admin/src/views/business/internalCompany.vue
index 6bfea48..e97dbb9 100644
--- a/admin/src/views/business/internalCompany.vue
+++ b/admin/src/views/business/internalCompany.vue
@@ -17,8 +17,8 @@
     <!-- 琛ㄦ牸鍜屽垎椤� -->
     <template v-slot:table-wrap>
       <ul class="toolbar" v-permissions="['business:company:create', 'business:company:sync']">
-        <li><el-button type="primary" v-permissions="['business:company:create']"
-            @click="$refs.OperaInternalCompanyWindow.open('鏂板缓缁勭粐', null, null)">鏂板缓</el-button></li>
+<!--        <li><el-button type="primary" v-permissions="['business:company:create']"-->
+<!--            @click="$refs.OperaInternalCompanyWindow.open('鏂板缓缁勭粐', null, null)">鏂板缓</el-button></li>-->
         <li><el-button @click="sort('top')" :loading="sorting" icon="el-icon-sort-up"
             v-permissions="['business:company:sort']">涓婄Щ</el-button></li>
         <li><el-button @click="sort('bottom')" :loading="sorting" icon="el-icon-sort-down"

--
Gitblit v1.9.3