From 7870c2d4fd6da5269a87f53d584a36628fd8ef12 Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期二, 05 九月 2023 16:56:58 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.150:10101/r/CanadaMes

---
 CanadaMes-ui/src/layout/tag.vue |  138 +++++++++++++++++----------------------------
 1 files changed, 53 insertions(+), 85 deletions(-)

diff --git a/CanadaMes-ui/src/layout/tag.vue b/CanadaMes-ui/src/layout/tag.vue
index 246ce7c..ccf38fd 100644
--- a/CanadaMes-ui/src/layout/tag.vue
+++ b/CanadaMes-ui/src/layout/tag.vue
@@ -1,91 +1,59 @@
 <template>
-    <div class="_tag">
-      <el-scrollbar style="margin-right: 6px;">
-        <div class="left">
-          <el-tag
-            v-for="tag in tagsList"
-            :key="tag.title"
-            :closable="!tag.hideclose"
-            :type="isActive(tag)"
-            @close="removeTag(tag)"
-            @click="handleTagClick(tag)"
-          >
-            <router-link :to="tag.path" class="tag-title">{{ tag.title }}</router-link>
-          </el-tag>
-        </div>
-      </el-scrollbar>
-  
-      <el-dropdown @command="handleCloseBtn" class="_dropdown">
-        <el-button type="primary" size="small">
-          鏍囩閫夐」
-          <i class="el-icon-arrow-down el-icon--right"></i>
-        </el-button>
-        <el-dropdown-menu slot="dropdown">
-          <el-dropdown-item command="closeOther">鍏抽棴鍏跺畠</el-dropdown-item>
-          <el-dropdown-item command="closeAll">鍏抽棴鎵�鏈�</el-dropdown-item>
-        </el-dropdown-menu>
-      </el-dropdown>
+  <div class="tagContainer">
+    <div v-for="(tag, index) in tags" :key="index" class="tagItem">
+      {{ tag }}
+      <span class="closeBtn" @click="removeTag(index)">x</span>
     </div>
-  </template>
-  
-  <script>
-  import { mapState, mapMutations } from "vuex";
-  
-  export default {
-    computed: {
-      ...mapState("tags", ["tagsList"]),
-      activeTag() {
-        return this.tagsList.find(tag => tag.path === this.$route.fullPath);
-      }
-    },
-    methods: {
-      ...mapMutations("tags", ["removeTag"]),
-      handleCloseBtn(command) {
-        if (command === "closeOther") {
-          const activeTag = this.activeTag;
-          if (!activeTag || activeTag.hideclose) return;
-          this.$store.commit("tags/removeOtherTags", activeTag);
-        } else if (command === "closeAll") {
-          this.$store.commit("tags/removeAllTags");
-          this.$router.push({ name: "sadmasMain" });
-        }
-      },
-      isActive(tag) {
-        return tag.path === this.$route.fullPath ? "" : "info";
-      },
-      handleTagClick(tag) {
-        this.$router.push(tag.path);
-      }
-    },
-    watch: {
-      $route(newValue) {
-        const isExist = this.tagsList.some(item => item.path === newValue.fullPath);
-        if (!isExist) {
-          this.$store.commit("tags/addTag", {
-            title: newValue.meta.title || "",
-            path: newValue.fullPath,
-            hideclose: newValue.meta.hideclose || false
-          });
-        }
+  </div>
+</template>
+
+<script>
+import { mapState, mapMutations } from 'vuex';
+
+export default {
+  computed: {
+    ...mapState('tags', { // 杩欓噷娣诲姞浜� 'tags' 妯″潡鐨勫懡鍚嶇┖闂村墠缂�
+      tags: state => state.tags.tags
+    })
+  },
+  methods: {
+    ...mapMutations('tag', ['removeTag']),
+    saveNavState(activePath) {
+    window.sessionStorage.setItem('activePath', activePath);
+    
+    const menuItem = this.menuList.find(item => item.menuLists.some(menu => menu.router === activePath));
+    if (menuItem) {
+      const submenuItem = menuItem.menuLists.find(menu => menu.router === activePath);
+      if (submenuItem) {
+        const tag = submenuItem.name;
+        this.addTag(tag); // 娣诲姞鏍囩鍒� Vuex Store
       }
     }
-  };
-  </script>
-  
-  <style scoped>
-  ._tag {
-    display: flex;
-    align-items: center;
-    padding: 10px;
   }
-  
-  .left {
-    display: flex;
-    flex-wrap: wrap;
   }
-  
-  .tag-title {
-    cursor: pointer;
-  }
-  </style>
-  
\ No newline at end of file
+}
+</script>
+
+<style scoped>
+.tagContainer {
+  display: flex;
+  flex-wrap: wrap;
+  margin-bottom: 10px;
+}
+
+.tagItem {
+  background-color: #eee;
+  border-radius: 4px;
+  padding: 4px 8px;
+  margin-right: 8px;
+  margin-bottom: 8px;
+  display: flex;
+  align-items: center;
+}
+
+.closeBtn {
+  margin-left: 4px;
+  color: red;
+  cursor: pointer;
+}
+</style>

--
Gitblit v1.8.0