Browse Source

修改标签

乐菲 3 weeks ago
parent
commit
b0dd6d5e64

+ 3 - 3
.env.dev

@@ -5,8 +5,8 @@ NODE_ENV = 'development'
 VUE_APP_TITLE = WMS开发环境
 
 # 芋道管理系统/开发环境
-# VUE_APP_BASE_API = 'http://192.168.1.94:48080'
-VUE_APP_BASE_API = 'http://61.155.26.34:36936'
+VUE_APP_BASE_API = 'http://192.168.1.94:48080'
+# VUE_APP_BASE_API = 'http://61.155.26.34:36936'
 # VUE_APP_BASE_API = 'http://127.0.0.1:48080'
 # VUE_APP_BASE_API = 'http://2227el9013.iok.la'
 # VUE_APP_BASE_API = 'http://192.168.1.85:48080'
@@ -18,7 +18,7 @@ VUE_APP_BASE_API = 'http://61.155.26.34:36936'
 # VUE_APP_SYSTEM_URL = 'http://192.168.1.163:8181/system/'
 
 # 报表IP
-VUE_APP_REPORT_API = 'http://113.105.183.190:48064'
+VUE_APP_REPORT_API = 'http://113.105.183.190:48028'
 
 # 路由懒加载
 VUE_CLI_BABEL_TRANSPILE_MODULES = true

+ 3 - 0
.env.rtk.prod

@@ -7,6 +7,9 @@ VUE_APP_TITLE = 瑞泰克WMS开发环境
 # 芋道管理系统/开发环境
 VUE_APP_BASE_API = 'http://113.105.183.190:48028'
 
+# 积木报表API
+VUE_APP_REPORT_API = 'http://113.105.183.190:48028'
+
 # 路由懒加载
 VUE_CLI_BABEL_TRANSPILE_MODULES = true
 

+ 14 - 10
src/layout/components/AppMain.vue

@@ -1,6 +1,10 @@
 <template>
   <section class="app-main">
-    <transition name="fade-transform" :mode="cachedViews.includes($route.name)? 'in-out' : 'out-in'" :duration="cachedViews.includes($route.name) ? 0 : 300">
+    <transition
+      name="fade-transform"
+      :mode="cachedViews.includes($route.name) ? 'in-out' : 'out-in'"
+      :duration="cachedViews.includes($route.name) ? 0 : 300"
+    >
       <keep-alive :include="cachedViews">
         <router-view :key="key" />
       </keep-alive>
@@ -10,28 +14,28 @@
 
 <script>
 export default {
-  name: 'AppMain',
+  name: "AppMain",
   computed: {
     cachedViews() {
-      return this.$store.state.tagsView.cachedViews
+      return this.$store.state.tagsView.cachedViews;
     },
     key() {
-      return this.$route.path
-    }
-  }
-}
+      return this.$route.fullPath;
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
 .app-main {
   /* 50= navbar  50  */
- min-height: calc(100vh - 85px);
+  min-height: calc(100vh - 85px);
   width: 100%;
   position: relative;
   overflow: hidden;
 }
 
-.fixed-header+.app-main {
+.fixed-header + .app-main {
   padding-top: 50px;
 }
 
@@ -42,7 +46,7 @@ export default {
     // min-height: 100vh
   }
 
-  .fixed-header+.app-main {
+  .fixed-header + .app-main {
     padding-top: 84px;
   }
 }

+ 139 - 109
src/layout/components/TagsView/index.vue

@@ -1,37 +1,61 @@
 <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':''"
+        :key="tag.fullPath"
+        :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" /> 刷新页面</li>
-      <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)"><i class="el-icon-close" /> 关闭当前</li>
-      <li @click="closeOthersTags"><i class="el-icon-circle-close" /> 关闭其他</li>
-      <li v-if="!isFirstView()" @click="closeLeftTags"><i class="el-icon-back" /> 关闭左侧</li>
-      <li v-if="!isLastView()" @click="closeRightTags"><i class="el-icon-right" /> 关闭右侧</li>
-      <li @click="closeAllTags(selectedTag)"><i class="el-icon-circle-close" /> 全部关闭</li>
+    <ul
+      v-show="visible"
+      :style="{ left: left + 'px', top: top + 'px' }"
+      class="contextmenu"
+    >
+      <li @click="refreshSelectedTag(selectedTag)">
+        <i class="el-icon-refresh-right" /> 刷新页面
+      </li>
+      <li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">
+        <i class="el-icon-close" /> 关闭当前
+      </li>
+      <li @click="closeOthersTags">
+        <i class="el-icon-circle-close" /> 关闭其他
+      </li>
+      <li v-if="!isFirstView()" @click="closeLeftTags">
+        <i class="el-icon-back" /> 关闭左侧
+      </li>
+      <li v-if="!isLastView()" @click="closeRightTags">
+        <i class="el-icon-right" /> 关闭右侧
+      </li>
+      <li @click="closeAllTags(selectedTag)">
+        <i class="el-icon-circle-close" /> 全部关闭
+      </li>
       <li @click="collectTags"><i class="el-icon-star-off" /> 收藏页面</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 },
@@ -41,207 +65,213 @@ 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
-    }
+      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.fullPath === this.$route.fullPath;
     },
     activeStyle(tag) {
-      if (!this.isActive(tag)) return {}
+      if (!this.isActive(tag)) return {};
       return {
-        'background-color': this.theme,
-        'border-color': this.theme
-      }
+        "background-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 === this.visitedViews[1].fullPath || this.selectedTag.fullPath === '/index'
+        return (
+          this.selectedTag.fullPath === this.visitedViews[1].fullPath ||
+          this.selectedTag.fullPath === "/index"
+        );
       } 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);
       }
-      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)
+          if (tag.to.fullPath === this.$route.fullPath) {
+            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)
+      this.$tab.refreshPage(view);
     },
     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).catch(() => {})
+      this.$router.push(this.selectedTag).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];
       if (latestView) {
-        this.$router.push(latestView.fullPath)
+        this.$router.push(latestView.fullPath);
       } 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();
     },
     collectTags() {
-      const menuId = this.selectedTag?.meta.id
+      const menuId = this.selectedTag?.meta.id;
       if (!menuId) {
-        this.$message.warning('该页面不允许收藏')
-        return
+        this.$message.warning("该页面不允许收藏");
+        return;
       }
-      const data = { menuId, favoritePath: this.selectedTag.path }
+      const data = { menuId, favoritePath: this.selectedTag.path };
 
-      this.$store.dispatch('settings/addCollectRoute', data).then(() => {
-        this.$message.success('收藏成功')
-      })
-    }
-  }
-}
+      this.$store.dispatch("settings/addCollectRoute", data).then(() => {
+        this.$message.success("收藏成功");
+      });
+    },
+  },
+};
 </script>
 
 <style lang="scss" scoped>
@@ -250,7 +280,7 @@ export default {
   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;
@@ -276,7 +306,7 @@ export default {
         color: #fff;
         border-color: #42b983;
         &::before {
-          content: '';
+          content: "";
           background: #fff;
           display: inline-block;
           width: 8px;
@@ -299,7 +329,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;
@@ -322,10 +352,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;
       }

+ 7 - 2
src/permission.js

@@ -55,7 +55,12 @@ function routerAction(to, from, next) {
     } else {
       if (!!to.meta.queryManageId) {
         const { queryManageId, ...metaWithoutQueryId } = to.meta;
-        const targetPath = `/querymanage/queryFormNew?id=${queryManageId}`;
+        // 构建查询参数,包含id和name
+        const queryParams = {
+          id: queryManageId,
+          name: to.meta.title, // 使用原路由的标题作为name参数
+        };
+        const targetPath = `/querymanage/queryFormNew`;
 
         // 防止死循环:如果当前路径已经是目标路径,就不再跳转
         if (to.path === targetPath) {
@@ -65,7 +70,7 @@ function routerAction(to, from, next) {
 
         next({
           path: targetPath,
-          query: { id: queryManageId },
+          query: queryParams,
           meta: metaWithoutQueryId,
           replace: true, // 使用 replace 避免历史栈堆积
         });

+ 6 - 1
src/store/modules/permission.js

@@ -69,7 +69,12 @@ function filterAsyncRouter(asyncRouterMap, lastRouter = false, type = false) {
     // 路由地址转首字母大写驼峰,作为路由名称,适配keepAlive
     // route.name = toCamelCase(route.path, true)
     // 开始调用后端返回的组件名
-    route.name = route.componentName;
+    // 为包含queryManageId的路由生成唯一的名称,避免keep-alive缓存问题
+    if (route.meta && route.meta.queryManageId) {
+      route.name = `${route.componentName}_${route.meta.queryManageId}`;
+    } else {
+      route.name = route.componentName;
+    }
     route.hidden = !route.visible;
     // 处理 component 属性
     if (route.children) {

+ 119 - 101
src/store/modules/tagsView.js

@@ -1,207 +1,225 @@
 const state = {
   visitedViews: [],
-  cachedViews: []
-}
+  cachedViews: [],
+};
 
 const mutations = {
   ADD_VISITED_VIEW: (state, view) => {
-    if (state.visitedViews.some(v => v.path === view.path)) return
+    // 使用fullPath作为判断依据,支持相同路径不同参数的路由打开多个标签页
+    if (state.visitedViews.some((v) => v.fullPath === view.fullPath)) return;
+    let title = view.meta.title || "no-name";
+
+    // 为 /querymanage/queryFormNew 路由设置动态标题
+    if (view.path === "/querymanage/queryFormNew") {
+      title = view.query.name || view.meta.title || "查询表单";
+    }
+
     state.visitedViews.push(
       Object.assign({}, view, {
-        title: view.meta.title || 'no-name'
+        title: title,
       })
-    )
+    );
   },
   ADD_CACHED_VIEW: (state, view) => {
-    if (state.cachedViews.includes(view.name)) return
+    if (state.cachedViews.includes(view.name)) return;
     if (view.meta && !view.meta.noCache) {
-      state.cachedViews.push(view.name)
+      state.cachedViews.push(view.name);
     }
   },
 
   DEL_VISITED_VIEW: (state, view) => {
     for (const [i, v] of state.visitedViews.entries()) {
-      if (v.path === view.path) {
-        state.visitedViews.splice(i, 1)
-        break
+      // 使用fullPath匹配要删除的标签页
+      if (v.fullPath === view.fullPath) {
+        state.visitedViews.splice(i, 1);
+        break;
       }
     }
   },
   DEL_CACHED_VIEW: (state, view) => {
-    const index = state.cachedViews.indexOf(view.name)
-    index > -1 && state.cachedViews.splice(index, 1)
+    const index = state.cachedViews.indexOf(view.name);
+    index > -1 && state.cachedViews.splice(index, 1);
   },
 
   DEL_OTHERS_VISITED_VIEWS: (state, view) => {
-    state.visitedViews = state.visitedViews.filter(v => {
-      return v.meta.affix || v.path === view.path
-    })
+    state.visitedViews = state.visitedViews.filter((v) => {
+      return v.meta.affix || v.fullPath === view.fullPath;
+    });
   },
   DEL_OTHERS_CACHED_VIEWS: (state, view) => {
-    const index = state.cachedViews.indexOf(view.name)
+    const index = state.cachedViews.indexOf(view.name);
     if (index > -1) {
-      state.cachedViews = state.cachedViews.slice(index, index + 1)
+      state.cachedViews = state.cachedViews.slice(index, index + 1);
     } else {
-      state.cachedViews = []
+      state.cachedViews = [];
     }
   },
 
-  DEL_ALL_VISITED_VIEWS: state => {
+  DEL_ALL_VISITED_VIEWS: (state) => {
     // keep affix tags
-    const affixTags = state.visitedViews.filter(tag => tag.meta.affix)
-    state.visitedViews = affixTags
+    const affixTags = state.visitedViews.filter((tag) => tag.meta.affix);
+    state.visitedViews = affixTags;
   },
-  DEL_ALL_CACHED_VIEWS: state => {
-    state.cachedViews = []
+  DEL_ALL_CACHED_VIEWS: (state) => {
+    state.cachedViews = [];
   },
 
   UPDATE_VISITED_VIEW: (state, view) => {
     for (let v of state.visitedViews) {
-      if (v.path === view.path) {
-        v = Object.assign(v, view)
-        break
+      if (v.fullPath === view.fullPath) {
+        // 为 /querymanage/queryFormNew 路由更新动态标题
+        if (view.path === "/querymanage/queryFormNew") {
+          v.title = view.query.name || view.meta.title || "查询表单";
+        }
+        // 更新view的所有属性,包括fullPath和query参数
+        Object.assign(v, view);
+        break;
       }
     }
   },
-  
+
   DEL_RIGHT_VIEWS: (state, view) => {
-    const index = state.visitedViews.findIndex(v => v.path === view.path)
+    const index = state.visitedViews.findIndex(
+      (v) => v.fullPath === view.fullPath
+    );
     if (index === -1) {
-      return
+      return;
     }
     state.visitedViews = state.visitedViews.filter((item, idx) => {
       if (idx <= index || (item.meta && item.meta.affix)) {
-        return true
+        return true;
       }
-      const i = state.cachedViews.indexOf(item.name)
+      const i = state.cachedViews.indexOf(item.name);
       if (i > -1) {
-        state.cachedViews.splice(i, 1)
+        state.cachedViews.splice(i, 1);
       }
-      return false
-    })
+      return false;
+    });
   },
 
   DEL_LEFT_VIEWS: (state, view) => {
-    const index = state.visitedViews.findIndex(v => v.path === view.path)
+    const index = state.visitedViews.findIndex(
+      (v) => v.fullPath === view.fullPath
+    );
     if (index === -1) {
-      return
+      return;
     }
     state.visitedViews = state.visitedViews.filter((item, idx) => {
       if (idx >= index || (item.meta && item.meta.affix)) {
-        return true
+        return true;
       }
-      const i = state.cachedViews.indexOf(item.name)
+      const i = state.cachedViews.indexOf(item.name);
       if (i > -1) {
-        state.cachedViews.splice(i, 1)
+        state.cachedViews.splice(i, 1);
       }
-      return false
-    })
-  }
-}
+      return false;
+    });
+  },
+};
 
 const actions = {
   addView({ dispatch }, view) {
-    dispatch('addVisitedView', view)
-    dispatch('addCachedView', view)
+    dispatch("addVisitedView", view);
+    dispatch("addCachedView", view);
   },
   addVisitedView({ commit }, view) {
-    commit('ADD_VISITED_VIEW', view)
+    commit("ADD_VISITED_VIEW", view);
   },
   addCachedView({ commit }, view) {
-    commit('ADD_CACHED_VIEW', view)
+    commit("ADD_CACHED_VIEW", view);
   },
 
   delView({ dispatch, state }, view) {
-    return new Promise(resolve => {
-      dispatch('delVisitedView', view)
-      dispatch('delCachedView', view)
+    return new Promise((resolve) => {
+      dispatch("delVisitedView", view);
+      dispatch("delCachedView", view);
       resolve({
         visitedViews: [...state.visitedViews],
-        cachedViews: [...state.cachedViews]
-      })
-    })
+        cachedViews: [...state.cachedViews],
+      });
+    });
   },
   delVisitedView({ commit, state }, view) {
-    return new Promise(resolve => {
-      commit('DEL_VISITED_VIEW', view)
-      resolve([...state.visitedViews])
-    })
+    return new Promise((resolve) => {
+      commit("DEL_VISITED_VIEW", view);
+      resolve([...state.visitedViews]);
+    });
   },
   delCachedView({ commit, state }, view) {
-    return new Promise(resolve => {
-      commit('DEL_CACHED_VIEW', view)
-      resolve([...state.cachedViews])
-    })
+    return new Promise((resolve) => {
+      commit("DEL_CACHED_VIEW", view);
+      resolve([...state.cachedViews]);
+    });
   },
 
   delOthersViews({ dispatch, state }, view) {
-    return new Promise(resolve => {
-      dispatch('delOthersVisitedViews', view)
-      dispatch('delOthersCachedViews', view)
+    return new Promise((resolve) => {
+      dispatch("delOthersVisitedViews", view);
+      dispatch("delOthersCachedViews", view);
       resolve({
         visitedViews: [...state.visitedViews],
-        cachedViews: [...state.cachedViews]
-      })
-    })
+        cachedViews: [...state.cachedViews],
+      });
+    });
   },
   delOthersVisitedViews({ commit, state }, view) {
-    return new Promise(resolve => {
-      commit('DEL_OTHERS_VISITED_VIEWS', view)
-      resolve([...state.visitedViews])
-    })
+    return new Promise((resolve) => {
+      commit("DEL_OTHERS_VISITED_VIEWS", view);
+      resolve([...state.visitedViews]);
+    });
   },
   delOthersCachedViews({ commit, state }, view) {
-    return new Promise(resolve => {
-      commit('DEL_OTHERS_CACHED_VIEWS', view)
-      resolve([...state.cachedViews])
-    })
+    return new Promise((resolve) => {
+      commit("DEL_OTHERS_CACHED_VIEWS", view);
+      resolve([...state.cachedViews]);
+    });
   },
 
   delAllViews({ dispatch, state }, view) {
-    return new Promise(resolve => {
-      dispatch('delAllVisitedViews', view)
-      dispatch('delAllCachedViews', view)
+    return new Promise((resolve) => {
+      dispatch("delAllVisitedViews", view);
+      dispatch("delAllCachedViews", view);
       resolve({
         visitedViews: [...state.visitedViews],
-        cachedViews: [...state.cachedViews]
-      })
-    })
+        cachedViews: [...state.cachedViews],
+      });
+    });
   },
   delAllVisitedViews({ commit, state }) {
-    return new Promise(resolve => {
-      commit('DEL_ALL_VISITED_VIEWS')
-      resolve([...state.visitedViews])
-    })
+    return new Promise((resolve) => {
+      commit("DEL_ALL_VISITED_VIEWS");
+      resolve([...state.visitedViews]);
+    });
   },
   delAllCachedViews({ commit, state }) {
-    return new Promise(resolve => {
-      commit('DEL_ALL_CACHED_VIEWS')
-      resolve([...state.cachedViews])
-    })
+    return new Promise((resolve) => {
+      commit("DEL_ALL_CACHED_VIEWS");
+      resolve([...state.cachedViews]);
+    });
   },
 
   updateVisitedView({ commit }, view) {
-    commit('UPDATE_VISITED_VIEW', view)
+    commit("UPDATE_VISITED_VIEW", view);
   },
 
   delRightTags({ commit }, view) {
-    return new Promise(resolve => {
-      commit('DEL_RIGHT_VIEWS', view)
-      resolve([...state.visitedViews])
-    })
+    return new Promise((resolve) => {
+      commit("DEL_RIGHT_VIEWS", view);
+      resolve([...state.visitedViews]);
+    });
   },
 
   delLeftTags({ commit }, view) {
-    return new Promise(resolve => {
-      commit('DEL_LEFT_VIEWS', view)
-      resolve([...state.visitedViews])
-    })
+    return new Promise((resolve) => {
+      commit("DEL_LEFT_VIEWS", view);
+      resolve([...state.visitedViews]);
+    });
   },
-}
+};
 
 export default {
   namespaced: true,
   state,
   mutations,
-  actions
-}
+  actions,
+};

+ 5 - 3
src/views/mes/queryManage/index.vue

@@ -88,7 +88,7 @@
           <span v-if="row.parentId == 0 || row.status == 1">{{
             row.name
           }}</span>
-          <el-link v-else type="primary" @click="handleToQuery(row.id)">{{
+          <el-link v-else type="primary" @click="handleToQuery(row)">{{
             row.name
           }}</el-link>
         </template>
@@ -200,9 +200,11 @@ export default {
         this.refreshTable = true;
       });
     },
-    handleToQuery(id) {
+    handleToQuery(row) {
       this.$router.push({
-        path: `/querymanage/queryFormNew?id=${id}`,
+        path: `/querymanage/queryFormNew?id=${row.id}&name=${encodeURIComponent(
+          row.name
+        )}`,
       });
     },
     /** 查询列表 */

+ 19 - 1
src/views/mes/queryManage/queryNew.vue

@@ -242,10 +242,26 @@ export default {
       headerWidthChange: false,
     };
   },
+  watch: {
+    // 监听路由参数变化,确保标题正确更新
+    "$route.query.name": {
+      handler(newName) {
+        this.title =
+          newName || this.$route.redirectedFrom?.meta?.title || "查询";
+      },
+    },
+    // 监听路由参数变化,确保数据正确加载
+    "$route.query.id": {
+      handler() {
+        this.init();
+      },
+    },
+  },
   mounted() {
     this.init();
   },
   activated() {
+    // 每次激活标签页时都调用init(),确保数据正确加载
     this.init();
   },
   beforeDestroy() {
@@ -427,7 +443,9 @@ export default {
         tenantId,
         ...fieldValues,
       });
-      const src = `${this.baseUrl}${interfaceUrl}${reportId}?${printParams.toString()}`;
+      const src = `${
+        this.baseUrl
+      }${interfaceUrl}${reportId}?${printParams.toString()}`;
       this.$refs.reportPrint.open(
         src,
         this.$route.query?.name ||