Explorar o código

修复首页始终清空添加清空方法

wolyshaw %!s(int64=4) %!d(string=hai) anos
pai
achega
f7840db14b
Modificáronse 2 ficheiros con 49 adicións e 4 borrados
  1. 45 3
      src/layout/components/TagsView.vue
  2. 4 1
      src/views/main/baseinfo/index.vue

+ 45 - 3
src/layout/components/TagsView.vue

@@ -10,7 +10,7 @@
         :key="index"
         @contextmenu.prevent.native="openMenu(tag, $event)"
       >
-        {{ generateTitle(tag.title) }}
+        <span :title="generateTitle(tag.title)" class="item" @click="changeTag(tag)">{{ generateTitle(tag.title) }}</span>
         <!-- v-if="index == Array.from(visitedViews).length -1" -->
         <span
           class="el-icon-close icon"
@@ -35,7 +35,7 @@
 import ScrollPane from "@/components/ScrollPane";
 import { generateTitle } from "@/utils/i18n";
 import { Searchs } from "@/helpers";
-
+let activeKey = ''
 export default {
   name: "TagsView",
   components: { ScrollPane },
@@ -44,6 +44,8 @@ export default {
       visible: false,
       top: 0,
       left: 0,
+      activeKey: null,
+      activeTag: null,
       selectedTag: {},
     };
   },
@@ -58,6 +60,22 @@ export default {
     $route() {
       this.addViewTags();
       this.moveToCurrentTag();
+      if (!activeKey) {
+        const s = new Searchs()
+        const keys = [this.$route.path]
+        for (const key in s.searchs) {
+          if (Object.hasOwnProperty.call(s.searchs, key)) {
+            const item = s.searchs[key];
+            if (item.bind === this.$route.path) {
+              keys.push(key)
+            }
+          }
+        }
+        for (const item of keys) {
+          s.removeByKey(item)
+        }
+      }
+      activeKey = ''
     },
     visible(value) {
       if (value) {
@@ -158,6 +176,23 @@ export default {
     closeMenu() {
       this.visible = false;
     },
+    changeTag(tag) {
+      activeKey = this.getSearchsByRealPath(tag)
+    },
+    getSearchsByRealPath(tag) {
+      const searchs = new Searchs()
+      let keyName = ''
+      for (const key in searchs.searchs) {
+        if (Object.hasOwnProperty.call(searchs.searchs, key)) {
+          const item = searchs.searchs[key];
+          if (tag.path === key || item.bind === tag.path) {
+            keyName = item.bind || tag.path
+          }
+        }
+      }
+      // this.activeKey = keyName
+      return keyName
+    },
     async refresh(view) {
       await this.reloads();
     },
@@ -174,6 +209,7 @@ export default {
     box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 0 3px 0 rgba(0, 0, 0, 0.04);
     .tags-view-item {
       min-width: 120px;
+      display: inline-flex;
       .icon {
         font-size: 20px;
         position: relative;
@@ -182,7 +218,7 @@ export default {
         margin-right: 5px;
       }
       border-radius: 5px 5px 0 0;
-      display: inline-block;
+      // display: inline-block;
       position: relative;
       height: 30px;
       line-height: 30px;
@@ -242,6 +278,12 @@ export default {
 //reset element css of el-icon-close
 .tags-view-wrapper {
   .tags-view-item {
+    .item{
+      flex: 1;
+      text-overflow: ellipsis;
+      overflow: hidden;
+      display: inline-block;
+    }
     .el-icon-close {
       width: 16px;
       height: 16px;

+ 4 - 1
src/views/main/baseinfo/index.vue

@@ -131,8 +131,11 @@ export default {
       return !Object.keys(this.dataInfo).length
     }
   },
+  created() {
+    this.$set(this.search, 'dates', getInitDate())
+  },
   mounted () {
-    this.reset()
+    this.FetchDetail()
     this.$store.dispatch('setBranchs')
   },
   methods: {