lilei 3 anos atrás
pai
commit
a2840197b8

+ 5 - 3
src/components/MultiTab/MultiTab.vue

@@ -178,16 +178,18 @@ export default {
         const na = newVal.meta.title.indexOf('详情') >= 0
         const nb = newVal.meta.title.indexOf('新增') >= 0
         const nc = newVal.meta.title.indexOf('编辑') >= 0
+        const nxt = newVal.meta.replaceTab
         const oa = oldMenu.meta.title.indexOf('详情') >= 0
         const ob = oldMenu.meta.title.indexOf('新增') >= 0
         const oc = oldMenu.meta.title.indexOf('编辑') >= 0
-        if ((na || nb || nc || oa || ob || oc) && hasChildren) {
+        const oxt = oldMenu.meta.replaceTab
+        if ((na || nb || nc || nxt || oa || ob || oc || oxt) && hasChildren) {
           // 替换当前页签
           this.replaceTab(newVal, oldMenu)
           // 从列表打开新增,编辑
-          this.$store.state.app.isNewTab = na || nb || nc
+          this.$store.state.app.isNewTab = na || nb || nc || nxt
           // 从编辑,新增返回列表,刷新列表
-          this.$store.state.app.updateList = ob || oc
+          this.$store.state.app.updateList = ob || oc || oxt
           this.activeKey = newVal.name
         } else {
           // 新打开的页签

+ 2 - 1
src/config/router.config.js

@@ -66,7 +66,8 @@ export const asyncRouterMap = [
         component: () => import(/* webpackChunkName: "home" */ '@/views/productManagement/newProduct/detail'),
         meta: {
           title: '产品详情',
-          icon: 'home'
+          icon: 'home',
+          replaceTab: true
         },
         hidden: true
       },

+ 2 - 5
src/views/productManagement/newProduct/detail.vue

@@ -100,11 +100,8 @@ export default {
     }
   },
   activated () {
-    // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面  (当前产品详情页的上级页分别有 上下线产品列表、箭冠产品列表和采购新增编辑页。因此处判断是否为子页是通过上级页路由路径是否有'/list',故需单独处理)
-    if ((this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) || (this.prevPageInfo && (this.prevPageInfo.name == 'purchaseOrderEdit' || this.prevPageInfo.name == 'purchaseOrderAdd'))) {
-      this.itemId = this.$route.params.sn
-      this.getDetail()
-    }
+    this.itemId = this.$route.params.sn
+    this.getDetail()
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {