From a4d7993d0b44faffe2e548250a9d2bc27c77e521 Mon Sep 17 00:00:00 2001
From: xiejun <xj@2023>
Date: 星期三, 19 七月 2023 12:27:46 +0800
Subject: [PATCH] 集成获取分类接口(包含编码规则码段码值信息)

---
 Source/UBCS-WEB/dist/src/cache.js |   45 +++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/Source/UBCS-WEB/dist/src/cache.js b/Source/UBCS-WEB/dist/src/cache.js
new file mode 100644
index 0000000..fdd723d
--- /dev/null
+++ b/Source/UBCS-WEB/dist/src/cache.js
@@ -0,0 +1,45 @@
+import Vue from 'vue'
+import store from './store';
+Vue.mixin({
+  beforeRouteEnter: function (to, from, next) {
+    next(() => {
+      let avueView = document.getElementById('avue-view');
+      if (avueView && to.meta.savedPosition) {
+        avueView.scrollTop = to.meta.savedPosition
+      }
+    })
+  },
+  beforeRouteLeave: function (to, from, next) {
+    let avueView = document.getElementById('avue-view');
+    if (from && from.meta.keepAlive) {
+      if (avueView) {
+        from.meta.savedPosition = avueView.scrollTop
+      }
+      const result = this.$route.meta.keepAlive === true && store.state.tags.tagList.some(ele => {
+        return ele.value === this.$route.fullPath;
+      });
+      if (this.$vnode && !result) {
+        from.meta.savedPosition = 0
+        if (this.$vnode.parent && this.$vnode.parent.componentInstance && this.$vnode.parent.componentInstance.cache) {
+          if (this.$vnode.componentOptions) {
+            let key = this.$vnode.key == null
+              ? this.$vnode.componentOptions.Ctor.cid + (this.$vnode.componentOptions.tag ? `::${this.$vnode.componentOptions.tag}` : '')
+              : this.$vnode.key;
+            let cache = this.$vnode.parent.componentInstance.cache;
+            let keys = this.$vnode.parent.componentInstance.keys;
+            if (cache[key]) {
+              if (keys.length) {
+                let index = keys.indexOf(key);
+                if (index > -1) {
+                  keys.splice(index, 1);
+                }
+              }
+              delete cache[key];
+            }
+          }
+        }
+      }
+    }
+    next();
+  },
+});

--
Gitblit v1.9.3