Przeglądaj źródła

数据建模回显问题/tag标签的缓存和关闭后路由切换问题

lph 1 rok temu
rodzic
commit
56775bf1a1

+ 2 - 0
ruoyi-ui/package.json

@@ -41,6 +41,7 @@
     "@riophae/vue-treeselect": "0.4.0",
     "ant-design-vue": "^1.7.8",
     "axios": "0.24.0",
+    "circular-json": "^0.5.9",
     "clipboard": "2.0.8",
     "core-js": "3.25.3",
     "echarts": "5.4.0",
@@ -71,6 +72,7 @@
     "vue-router": "3.4.9",
     "vuedraggable": "2.24.3",
     "vuex": "3.6.0",
+    "vuex-persistedstate": "^4.1.0",
     "webpack": "^4.46.0"
   },
   "devDependencies": {

+ 135 - 99
ruoyi-ui/src/layout/components/TagsView/index.vue

@@ -1,36 +1,60 @@
 <template>
   <div id="tags-view-container" class="tags-view-container">
-    <scroll-pane ref="scrollPane" class="tags-view-wrapper" @scroll="handleScroll">
+    <scroll-pane
+      ref="scrollPane"
+      class="tags-view-wrapper"
+      @scroll="handleScroll"
+    >
       <router-link
         v-for="tag in visitedViews"
         ref="tag"
         :key="tag.path"
-        :class="isActive(tag)?'active':''"
+        :class="isActive(tag) ? 'active' : ''"
         :to="{ path: tag.path, query: tag.query, fullPath: tag.fullPath }"
         tag="span"
         class="tags-view-item"
         :style="activeStyle(tag)"
-        @click.middle.native="!isAffix(tag)?closeSelectedTag(tag):''"
-        @contextmenu.prevent.native="openMenu(tag,$event)"
+        @click.middle.native="!isAffix(tag) ? closeSelectedTag(tag) : ''"
+        @contextmenu.prevent.native="openMenu(tag, $event)"
       >
         {{ tag.title }}
-        <span v-if="!isAffix(tag)" class="el-icon-close" @click.prevent.stop="closeSelectedTag(tag)" />
+        <span
+          v-if="!isAffix(tag)"
+          class="el-icon-close"
+          @click.prevent.stop="closeSelectedTag(tag)"
+        />
       </router-link>
     </scroll-pane>
-    <ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu">
-      <li @click="refreshSelectedTag(selectedTag)"><i class="el-icon-refresh-right"></i> 刷新页面</li>
-      <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)"><i class="el-icon-close"></i> 关闭当前</li>
-      <li @click="closeOthersTags"><i class="el-icon-circle-close"></i> 关闭其他</li>
-      <li v-if="!isFirstView()" @click="closeLeftTags"><i class="el-icon-back"></i> 关闭左侧</li>
-      <li v-if="!isLastView()" @click="closeRightTags"><i class="el-icon-right"></i> 关闭右侧</li>
-      <li @click="closeAllTags(selectedTag)"><i class="el-icon-circle-close"></i> 全部关闭</li>
+    <ul
+      v-show="visible"
+      :style="{ left: left + 'px', top: top + 'px' }"
+      class="contextmenu"
+    >
+      <li @click="refreshSelectedTag(selectedTag)">
+        <i class="el-icon-refresh-right"></i> 刷新页面
+      </li>
+      <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">
+        <i class="el-icon-close"></i> 关闭当前
+      </li>
+      <li @click="closeOthersTags">
+        <i class="el-icon-circle-close"></i> 关闭其他
+      </li>
+      <li v-if="!isFirstView()" @click="closeLeftTags">
+        <i class="el-icon-back"></i> 关闭左侧
+      </li>
+      <li v-if="!isLastView()" @click="closeRightTags">
+        <i class="el-icon-right"></i> 关闭右侧
+      </li>
+      <li @click="closeAllTags(selectedTag)">
+        <i class="el-icon-circle-close"></i> 全部关闭
+      </li>
     </ul>
   </div>
 </template>
 
 <script>
-import ScrollPane from './ScrollPane'
-import path from 'path'
+import ScrollPane from "./ScrollPane";
+import path from "path";
 
 export default {
   components: { ScrollPane },
@@ -40,212 +64,224 @@ export default {
       top: 0,
       left: 0,
       selectedTag: {},
-      affixTags: []
-    }
+      affixTags: [],
+    };
   },
   computed: {
     visitedViews() {
-      return this.$store.state.tagsView.visitedViews
+      return this.$store.state.tagsView.visitedViews;
     },
     routes() {
-      return this.$store.state.permission.routes
+      return this.$store.state.permission.routes;
     },
     theme() {
       return this.$store.state.settings.theme;
-    }
+    },
   },
   watch: {
     $route() {
-      this.addTags()
-      this.moveToCurrentTag()
+      this.addTags();
+      this.moveToCurrentTag();
     },
     visible(value) {
       if (value) {
-        document.body.addEventListener('click', this.closeMenu)
+        document.body.addEventListener("click", this.closeMenu);
       } else {
-        document.body.removeEventListener('click', this.closeMenu)
+        document.body.removeEventListener("click", this.closeMenu);
       }
-    }
+    },
   },
   mounted() {
-    this.initTags()
-    this.addTags()
+    this.initTags();
+    this.addTags();
   },
   methods: {
     isActive(route) {
-      return route.path === this.$route.path
+      return route.path === this.$route.path;
     },
     activeStyle(tag) {
       if (!this.isActive(tag)) return {};
       return {
         "background-color": this.theme,
-        "border-color": this.theme
+        "border-color": this.theme,
       };
     },
     isAffix(tag) {
-      return tag.meta && tag.meta.affix
+      return tag.meta && tag.meta.affix;
     },
     isFirstView() {
       try {
-        return this.selectedTag.fullPath === '/index' || this.selectedTag.fullPath === this.visitedViews[1].fullPath
+        return (
+          this.selectedTag.fullPath === "/index" ||
+          this.selectedTag.fullPath === this.visitedViews[1].fullPath
+        );
       } catch (err) {
-        return false
+        return false;
       }
     },
     isLastView() {
       try {
-        return this.selectedTag.fullPath === this.visitedViews[this.visitedViews.length - 1].fullPath
+        return (
+          this.selectedTag.fullPath ===
+          this.visitedViews[this.visitedViews.length - 1].fullPath
+        );
       } catch (err) {
-        return false
+        return false;
       }
     },
-    filterAffixTags(routes, basePath = '/') {
-      let tags = []
-      routes.forEach(route => {
+    filterAffixTags(routes, basePath = "/") {
+      let tags = [];
+      routes.forEach((route) => {
         if (route.meta && route.meta.affix) {
-          const tagPath = path.resolve(basePath, route.path)
+          const tagPath = path.resolve(basePath, route.path);
           tags.push({
             fullPath: tagPath,
             path: tagPath,
             name: route.name,
-            meta: { ...route.meta }
-          })
+            meta: { ...route.meta },
+          });
         }
         if (route.children) {
-          const tempTags = this.filterAffixTags(route.children, route.path)
+          const tempTags = this.filterAffixTags(route.children, route.path);
           if (tempTags.length >= 1) {
-            tags = [...tags, ...tempTags]
+            tags = [...tags, ...tempTags];
           }
         }
-      })
-      return tags
+      });
+      return tags;
     },
     initTags() {
-      const affixTags = this.affixTags = this.filterAffixTags(this.routes)
+      const affixTags = (this.affixTags = this.filterAffixTags(this.routes));
       for (const tag of affixTags) {
         // Must have tag name
         if (tag.name) {
-          this.$store.dispatch('tagsView/addVisitedView', tag)
+          this.$store.dispatch("tagsView/addVisitedView", tag);
         }
       }
     },
     addTags() {
-      const { name } = this.$route
+      const { name } = this.$route;
       if (name) {
-        this.$store.dispatch('tagsView/addView', this.$route)
+        this.$store.dispatch("tagsView/addView", this.$route);
         if (this.$route.meta.link) {
-          this.$store.dispatch('tagsView/addIframeView', this.$route)
+          this.$store.dispatch("tagsView/addIframeView", this.$route);
         }
       }
-      return false
+      return false;
     },
     moveToCurrentTag() {
-      const tags = this.$refs.tag
+      const tags = this.$refs.tag;
       this.$nextTick(() => {
         for (const tag of tags) {
           if (tag.to.path === this.$route.path) {
-            this.$refs.scrollPane.moveToTarget(tag)
+            this.$refs.scrollPane.moveToTarget(tag);
             // when query is different then update
             if (tag.to.fullPath !== this.$route.fullPath) {
-              this.$store.dispatch('tagsView/updateVisitedView', this.$route)
+              this.$store.dispatch("tagsView/updateVisitedView", this.$route);
             }
-            break
+            break;
           }
         }
-      })
+      });
     },
     refreshSelectedTag(view) {
       this.$tab.refreshPage(view);
       if (this.$route.meta.link) {
-        this.$store.dispatch('tagsView/delIframeView', this.$route)
+        this.$store.dispatch("tagsView/delIframeView", this.$route);
       }
     },
     closeSelectedTag(view) {
       this.$tab.closePage(view).then(({ visitedViews }) => {
         if (this.isActive(view)) {
-          this.toLastView(visitedViews, view)
+          this.toLastView(visitedViews, view);
         }
-      })
+      });
     },
     closeRightTags() {
-      this.$tab.closeRightPage(this.selectedTag).then(visitedViews => {
-        if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {
-          this.toLastView(visitedViews)
+      this.$tab.closeRightPage(this.selectedTag).then((visitedViews) => {
+        if (!visitedViews.find((i) => i.fullPath === this.$route.fullPath)) {
+          this.toLastView(visitedViews);
         }
-      })
+      });
     },
     closeLeftTags() {
-      this.$tab.closeLeftPage(this.selectedTag).then(visitedViews => {
-        if (!visitedViews.find(i => i.fullPath === this.$route.fullPath)) {
-          this.toLastView(visitedViews)
+      this.$tab.closeLeftPage(this.selectedTag).then((visitedViews) => {
+        if (!visitedViews.find((i) => i.fullPath === this.$route.fullPath)) {
+          this.toLastView(visitedViews);
         }
-      })
+      });
     },
     closeOthersTags() {
-      this.$router.push(this.selectedTag.fullPath).catch(()=>{});
+      this.$router.push(this.selectedTag.fullPath).catch(() => {});
       this.$tab.closeOtherPage(this.selectedTag).then(() => {
-        this.moveToCurrentTag()
-      })
+        this.moveToCurrentTag();
+      });
     },
     closeAllTags(view) {
       this.$tab.closeAllPage().then(({ visitedViews }) => {
-        if (this.affixTags.some(tag => tag.path === this.$route.path)) {
-          return
+        if (this.affixTags.some((tag) => tag.path === this.$route.path)) {
+          return;
         }
-        this.toLastView(visitedViews, view)
-      })
+        this.toLastView(visitedViews, view);
+      });
     },
     toLastView(visitedViews, view) {
-      const latestView = visitedViews.slice(-1)[0]
+      const latestView = visitedViews.slice(-1)[0];
+      console.log("latestView", latestView);
       if (latestView) {
-        this.$router.push(latestView.fullPath)
+        if (latestView.fullPath) {
+          this.$router.push(latestView.fullPath);
+        } else {
+          this.$router.push({
+            path: latestView.path,
+            query: latestView.query,
+          });
+        }
       } else {
         // now the default is to redirect to the home page if there is no tags-view,
         // you can adjust it according to your needs.
-        if (view.name === 'Dashboard') {
+        if (view.name === "Dashboard") {
           // to reload home page
-          this.$router.replace({ path: '/redirect' + view.fullPath })
+          this.$router.replace({ path: "/redirect" + view.fullPath });
         } else {
-          this.$router.push('/')
+          this.$router.push("/");
         }
       }
     },
     openMenu(tag, e) {
-      const menuMinWidth = 105
-      const offsetLeft = this.$el.getBoundingClientRect().left // container margin left
-      const offsetWidth = this.$el.offsetWidth // container width
-      const maxLeft = offsetWidth - menuMinWidth // left boundary
-      const left = e.clientX - offsetLeft + 15 // 15: margin right
+      const menuMinWidth = 105;
+      const offsetLeft = this.$el.getBoundingClientRect().left; // container margin left
+      const offsetWidth = this.$el.offsetWidth; // container width
+      const maxLeft = offsetWidth - menuMinWidth; // left boundary
+      const left = e.clientX - offsetLeft + 15; // 15: margin right
 
       if (left > maxLeft) {
-        this.left = maxLeft
+        this.left = maxLeft;
       } else {
-        this.left = left
+        this.left = left;
       }
 
-      this.top = e.clientY
-      this.visible = true
-      this.selectedTag = tag
+      this.top = e.clientY;
+      this.visible = true;
+      this.selectedTag = tag;
     },
     closeMenu() {
-      this.visible = false
+      this.visible = false;
     },
     handleScroll() {
-      this.closeMenu()
-    }
-  }
-}
+      this.closeMenu();
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
-
-
 .tags-view-container {
   height: 34px;
   width: 100%;
   background: #fff;
   border-bottom: 1px solid #d8dce5;
-  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, .12), 0 0 3px 0 rgba(0, 0, 0, .04);
+  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 0 3px 0 rgba(0, 0, 0, 0.04);
   .tags-view-wrapper {
     .tags-view-item {
       display: inline-block;
@@ -271,7 +307,7 @@ export default {
         color: #fff;
         border-color: #42b983;
         &::before {
-          content: '';
+          content: "";
           background: #fff;
           display: inline-block;
           width: 8px;
@@ -294,7 +330,7 @@ export default {
     font-size: 12px;
     font-weight: 400;
     color: #333;
-    box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, .3);
+    box-shadow: 2px 2px 3px 0 rgba(0, 0, 0, 0.3);
     li {
       margin: 0;
       padding: 7px 16px;
@@ -317,10 +353,10 @@ export default {
       vertical-align: 2px;
       border-radius: 50%;
       text-align: center;
-      transition: all .3s cubic-bezier(.645, .045, .355, 1);
+      transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
       transform-origin: 100% 50%;
       &:before {
-        transform: scale(.6);
+        transform: scale(0.6);
         display: inline-block;
         vertical-align: -3px;
       }

+ 37 - 40
ruoyi-ui/src/layout/index.vue

@@ -1,8 +1,7 @@
 <template>
   <div class="combarr">
     <div class="combar">
-      <div class="bar">
-      </div>
+      <div class="bar"></div>
       <el-row>
         <el-col :span="12">
           <span>
@@ -10,29 +9,29 @@
           </span>
         </el-col>
         <el-col :span="4" :offset="8">
-            <el-dropdown
-              class="avatar-container right-menu-item hover-effect"
-              trigger="click"
-            >
-              <div class="avatar-wrapper">
-                <img :src="avatar" class="user-avatar" />
-                <span style="">
-                  <button class="jianbiase">{{userName || '默认用户'}}</button>
-                </span>
-                <i class="el-icon-caret-bottom" />
-              </div>
-              <el-dropdown-menu slot="dropdown" style="margin-top: -20px;">
-                <router-link to="/user/profile">
-                  <el-dropdown-item>个人中心</el-dropdown-item>
-                </router-link>
-                <el-dropdown-item @click.native="setting = true">
-                  <span>布局设置</span>
-                </el-dropdown-item>
-                <el-dropdown-item divided @click.native="logout">
-                  <span>退出登录</span>
-                </el-dropdown-item>
-              </el-dropdown-menu>
-            </el-dropdown>
+          <el-dropdown
+            class="avatar-container right-menu-item hover-effect"
+            trigger="click"
+          >
+            <div class="avatar-wrapper">
+              <img :src="avatar" class="user-avatar" />
+              <span style="">
+                <button class="jianbiase">{{ userName || "默认用户" }}</button>
+              </span>
+              <i class="el-icon-caret-bottom" />
+            </div>
+            <el-dropdown-menu slot="dropdown" style="margin-top: -20px">
+              <router-link to="/user/profile">
+                <el-dropdown-item>个人中心</el-dropdown-item>
+              </router-link>
+              <el-dropdown-item @click.native="setting = true">
+                <span>布局设置</span>
+              </el-dropdown-item>
+              <el-dropdown-item divided @click.native="logout">
+                <span>退出登录</span>
+              </el-dropdown-item>
+            </el-dropdown-menu>
+          </el-dropdown>
         </el-col>
       </el-row>
     </div>
@@ -50,7 +49,7 @@
       <sidebar
         v-if="!sidebar.hide"
         class="sidebar-container"
-        style="background-color: #222653;"
+        style="background-color: #222653"
       />
       <div
         :class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }"
@@ -89,14 +88,14 @@ export default {
   },
   data() {
     return {
-      userName: '默认用户',
+      userName: "默认用户",
     };
   },
   mixins: [ResizeMixin],
   computed: {
     ...mapState({
       theme: (state) => state.settings.theme,
-      sideTheme: (state) => state.settings.sideTheme, 
+      sideTheme: (state) => state.settings.sideTheme,
       sidebar: (state) => state.app.sidebar,
       device: (state) => state.app.device,
       needTagsView: (state) => state.settings.tagsView,
@@ -145,12 +144,10 @@ export default {
     },
   },
   mounted() {
-    var user = sessionStorage.getItem('sessionObj')
+    var user = sessionStorage.getItem("sessionObj");
     var user = JSON.parse(user);
-    this.userName = JSON.parse(user.data).username
+    this.userName = JSON.parse(user.data).username;
   },
-
-
 };
 </script>
 
@@ -158,9 +155,8 @@ export default {
 @import "~@/assets/styles/mixin.scss";
 @import "~@/assets/styles/variables.scss";
 
-
 .el-dropdown-menu {
-    z-index: 10000 !important;
+  z-index: 10000 !important;
 }
 
 /* .main-container{
@@ -184,8 +180,12 @@ export default {
   width: 120px;
   height: 37px;
   /* height: 25px; */
-  background: linear-gradient(128.13deg, rgba(82, 79, 255, 1) 0%, rgba(255, 74, 74, 1) 100%);
-  box-shadow: 0px 4px 16px  rgba(179, 192, 231, 1);
+  background: linear-gradient(
+    128.13deg,
+    rgba(82, 79, 255, 1) 0%,
+    rgba(255, 74, 74, 1) 100%
+  );
+  box-shadow: 0px 4px 16px rgba(179, 192, 231, 1);
   border-radius: 27px;
   margin-top: 15px;
   font-size: 14px;
@@ -193,7 +193,6 @@ export default {
   letter-spacing: 0px;
   line-height: 20.27px;
   color: rgba(255, 255, 255, 1);
-
 }
 .user-avatar {
   cursor: pointer;
@@ -219,7 +218,7 @@ export default {
   margin-top: 18px;
 }
 
-#dropdown-menu-1780{
+#dropdown-menu-1780 {
   z-index: 1000000;
 }
 .imgg {
@@ -280,6 +279,4 @@ export default {
 .mobile .fixed-header {
   width: 100%;
 }
-
-
 </style>

+ 7 - 2
ruoyi-ui/src/store/index.js

@@ -8,8 +8,9 @@ import permission from './modules/permission'
 import settings from './modules/settings'
 import getters from './getters'
 import flow from './modules/flow'
+import createPersistedstate from 'vuex-persistedstate'
 Vue.use(Vuex)
-
+const PERSIST_PATHS = ['tagsView.visitedViews'];
 const store = new Vuex.Store({
   modules: {
     app,
@@ -21,7 +22,11 @@ const store = new Vuex.Store({
     flow
   },
   getters,
-  
+  plugins: [
+    createPersistedstate({
+      key: 'call', paths: PERSIST_PATHS
+    })
+  ]
 })
 
 export default store

+ 38 - 4
ruoyi-ui/src/store/modules/tagsView.js

@@ -1,4 +1,16 @@
+
+
+function getVisitedViews() {
+  // return sessionStorage.getItem('visitedViews') ? JSON.parse(sessionStorage.getItem('visitedViews')) : []
+  return localStorage.getItem('call') ? JSON.parse(localStorage.getItem('call')).tagsView.visitedViews : []
+}
+function setVisitedViews(visitedView = []) {
+  let temp = JSON.stringify(visitedView)
+  sessionStorage.setItem('visitedViews', temp)
+}
+
 const state = {
+  // visitedViews: getVisitedViews(),
   visitedViews: [],
   cachedViews: [],
   iframeViews: []
@@ -20,6 +32,7 @@ const mutations = {
         title: view.meta.title || 'no-name'
       })
     )
+    // setVisitedViews(state.visitedViews)
   },
   ADD_CACHED_VIEW: (state, view) => {
     if (state.cachedViews.includes(view.name)) return
@@ -31,6 +44,7 @@ const mutations = {
     for (const [i, v] of state.visitedViews.entries()) {
       if (v.path === view.path) {
         state.visitedViews.splice(i, 1)
+        // setVisitedViews(state.visitedViews)
         break
       }
     }
@@ -48,6 +62,7 @@ const mutations = {
     state.visitedViews = state.visitedViews.filter(v => {
       return v.meta.affix || v.path === view.path
     })
+    // setVisitedViews(state.visitedViews)
     state.iframeViews = state.iframeViews.filter(item => item.path === view.path)
   },
   DEL_OTHERS_CACHED_VIEWS: (state, view) => {
@@ -62,6 +77,7 @@ const mutations = {
     // keep affix tags
     const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
     state.visitedViews = affixTags
+    // setVisitedViews(state.visitedViews)
     state.iframeViews = []
   },
   DEL_ALL_CACHED_VIEWS: state => {
@@ -88,12 +104,13 @@ const mutations = {
       if (i > -1) {
         state.cachedViews.splice(i, 1)
       }
-      if(item.meta.link) {
+      if (item.meta.link) {
         const fi = state.iframeViews.findIndex(v => v.path === item.path)
         state.iframeViews.splice(fi, 1)
       }
       return false
     })
+    // setVisitedViews(state.visitedViews)
   },
   DEL_LEFT_VIEWS: (state, view) => {
     const index = state.visitedViews.findIndex(v => v.path === view.path)
@@ -108,12 +125,13 @@ const mutations = {
       if (i > -1) {
         state.cachedViews.splice(i, 1)
       }
-      if(item.meta.link) {
+      if (item.meta.link) {
         const fi = state.iframeViews.findIndex(v => v.path === item.path)
         state.iframeViews.splice(fi, 1)
       }
       return false
     })
+    // setVisitedViews(state.visitedViews)
   }
 }
 
@@ -126,7 +144,15 @@ const actions = {
     commit('ADD_IFRAME_VIEW', view)
   },
   addVisitedView({ commit }, view) {
-    commit('ADD_VISITED_VIEW', view)
+    let { path, query, fullpath, meta, name } = view
+    let visitView = {
+      path,
+      query: query ? JSON.parse(JSON.stringify(query)) : {},
+      fullpath,
+      meta: meta ? JSON.parse(JSON.stringify(meta)) : {},
+      name
+    }
+    commit('ADD_VISITED_VIEW', visitView)
   },
   addCachedView({ commit }, view) {
     commit('ADD_CACHED_VIEW', view)
@@ -204,7 +230,15 @@ const actions = {
     })
   },
   updateVisitedView({ commit }, view) {
-    commit('UPDATE_VISITED_VIEW', view)
+    let { path, query, fullpath, meta, name } = view
+    let visitView = {
+      path,
+      query: query ? JSON.parse(JSON.stringify(query)) : {},
+      fullpath,
+      meta: meta ? JSON.parse(JSON.stringify(meta)) : {},
+      name
+    }
+    commit('UPDATE_VISITED_VIEW', visitView)
   },
   delRightTags({ commit }, view) {
     return new Promise(resolve => {

+ 7 - 6
ruoyi-ui/src/store/modules/user.js

@@ -1,5 +1,5 @@
-import {login, logout, getInfo} from '@/api/login'
-import {getToken, setToken, removeToken} from '@/utils/auth'
+import { login, logout, getInfo } from '@/api/login'
+import { getToken, setToken, removeToken } from '@/utils/auth'
 
 const user = {
   state: {
@@ -38,7 +38,7 @@ const user = {
 
   actions: {
     // 登录
-    Login({commit}, userInfo) {
+    Login({ commit }, userInfo) {
       const username = userInfo.username.trim()
       const password = userInfo.password
       const code = userInfo.code
@@ -55,7 +55,7 @@ const user = {
     },
 
     // 获取用户信息
-    GetInfo({commit, state}) {
+    GetInfo({ commit, state }) {
       return new Promise((resolve, reject) => {
         getInfo().then(res => {
           const user = res.user
@@ -80,7 +80,7 @@ const user = {
     },
 
     // 退出系统
-    LogOut({commit, state}) {
+    LogOut({ commit, state }) {
       return new Promise((resolve, reject) => {
         logout(state.token).then(() => {
           commit('SET_TOKEN', '')
@@ -88,6 +88,7 @@ const user = {
           commit('SET_PERMISSIONS', [])
           commit('SET_TENANT', {})
           removeToken()
+          localStorage.clear();
           resolve()
         }).catch(error => {
           reject(error)
@@ -96,7 +97,7 @@ const user = {
     },
 
     // 前端 登出
-    FedLogOut({commit}) {
+    FedLogOut({ commit }) {
       return new Promise(resolve => {
         commit('SET_TOKEN', '')
         removeToken()

+ 10 - 3
ruoyi-ui/src/views/tool/datasheet/index.vue

@@ -259,9 +259,11 @@ export default {
     info() {
       const tableName = this.$route.query.tableName;
       const tableComment = this.$route.query.tableComment;
+      this.form.tableName = tableName;
+      this.form.tableComment = tableComment;
 
       let data = {
-        tableName: this.$route.query.tableName,
+        tableName,
         databaseType: this.databaseType,
         databaseName: this.databaseName,
       };
@@ -278,8 +280,6 @@ export default {
             { $index: index, row: val }
           );
         });
-        this.form.tableName = tableName;
-        this.form.tableComment = tableComment;
       });
     },
     // 处理长度框是否可输入
@@ -291,9 +291,13 @@ export default {
       if (tem == undefined) return;
       // console.log(this.experienceDataForm)
       // console.log(this.tableform)
+      if (!this.tableform["fieldLength" + scope.$index]) {
+        this.tableform["fieldLength" + scope.$index] = {};
+      }
       if (tem.raw.listClass === "success") {
         this.Inoputdisabled[scope.$index] = true; // 禁用长度输入框
         scope.row.fieldLength = "";
+
         this.tableform["fieldLength" + scope.$index].required = false; // 禁用长度输入框的校验
         return this.$set(
           this.experienceDataForm,
@@ -448,6 +452,9 @@ export default {
       });
     },
     edit() {
+      this.experienceData = this.experienceData.filter((item) => {
+        return item.fieldName && item.fieldType;
+      });
       this.experienceData.forEach((field) => {
         if (field.fieldLength) {
           field.fieldType = `${field.fieldType}(${field.fieldLength})`;