lilei hace 3 años
padre
commit
8b8e0fc6fa

+ 13 - 13
src/components/MultiTab/MultiTab.vue

@@ -152,7 +152,7 @@ export default {
   watch: {
     '$route': function (newVal, oldVal) {
       if (newVal.name == oldVal.name) { return }
-      // console.log(newVal, oldVal, this.pages)
+      console.log(newVal, oldVal, this.pages)
       // 解决页面地址相同参数不同时打开多个页签问题(例 详情页id或sn不同时)
       const index = this.tabsList.indexOf(newVal.name)
 
@@ -170,18 +170,18 @@ export default {
       const molen = oldMenu.matched.length < 3
       const oldMatched = oldMenu.matched[molen ? 1 : 2]
       const hasChildren = newMatched.name == oldMatched.name
+      // 判断是否是新增,编辑,详情页
+      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
+      const oxt = oldMenu.meta.replaceTab
 
       if (index < 0) { // 不存在
-        // console.log(1, hasChildren, '不存在')
-        // 判断是否是新增,编辑,详情页
-        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
-        const oxt = oldMenu.meta.replaceTab
+        console.log(1, hasChildren, '不存在')
         if ((na || nb || nc || nxt || oa || ob || oc || oxt) && hasChildren) {
           // 替换当前页签
           this.replaceTab(newVal, oldMenu)
@@ -211,13 +211,13 @@ export default {
           }
         }
       } else { // 已存在
+        console.log(1, nxt, '已存在')
         this.pages.splice(index, 1, newVal)
         this.tabsList.splice(index, 1, newVal.name)
-        this.$store.state.app.isNewTab = false
+        this.$store.state.app.isNewTab = !!nxt
         if (hasEqChild) {
           this.$store.state.app.updateList = hasEqChild.name == oldVal.name
         }
-        // console.log(1, this.$store.state.app.updateList, '已存在')
         this.activeKey = newVal.name
       }
     },

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

@@ -375,6 +375,7 @@ export const asyncRouterMap = [
                   title: '采购单详情',
                   icon: 'money-collect',
                   hidden: true,
+                  replaceTab: true,
                   permission: 'B_purchaseDetail'
                 }
               },

+ 1 - 0
src/views/purchasingManagement/purchaseOrder/detail.vue

@@ -249,6 +249,7 @@ export default {
     }
   },
   activated () {
+    console.log(this.$store.state.app.isNewTab, !this.$store.state.app.isNewSubTab)
     // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
     if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
       this.$refs.table.refresh(true)