Browse Source

bug修复,采购新增编辑页 查看产品详情数据不刷新

chenrui 3 years ago
parent
commit
27bf8a9341

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

@@ -48,7 +48,7 @@ export default {
       const index = this.tabsList.indexOf(targetKey)
       const index = this.tabsList.indexOf(targetKey)
       if (index >= 0) {
       if (index >= 0) {
         const row = this.pages[index]
         const row = this.pages[index]
-        if (row && row.fullPath && row.fullPath.indexOf('/list') == -1) { // 非列表页
+        if (row && row.fullPath && row.fullPath.indexOf('/list') == -1) { // 非列表页,根据当前路由路径判断是子页还是列表页
           this.$store.state.app.isNewSubTab = true
           this.$store.state.app.isNewSubTab = true
         } else {
         } else {
           this.$store.state.app.isNewSubTab = false
           this.$store.state.app.isNewSubTab = false

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

@@ -58,7 +58,7 @@ export default {
     return {
     return {
       itemId: null,
       itemId: null,
       detailsData: null, //  详情数据
       detailsData: null, //  详情数据
-      pageInfo: null
+      prevPageInfo: null
     }
     }
   },
   },
   methods: {
   methods: {
@@ -75,7 +75,7 @@ export default {
     },
     },
     // 返回
     // 返回
     goBack () {
     goBack () {
-      this.$router.push({ path: this.pageInfo && this.pageInfo.path, query: { closeLastOldTab: true } })
+      this.$router.push({ path: this.prevPageInfo && this.prevPageInfo.path, query: { closeLastOldTab: true } })
     }
     }
   },
   },
   mounted () {
   mounted () {
@@ -85,15 +85,15 @@ export default {
     }
     }
   },
   },
   activated () {
   activated () {
-    // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
-    if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
+    // 如果是新页签打开或者进入新的子页(例:存在列表第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.itemId = this.$route.params.sn
       this.getDetail()
       this.getDetail()
     }
     }
   },
   },
   beforeRouteEnter (to, from, next) {
   beforeRouteEnter (to, from, next) {
     next(vm => {
     next(vm => {
-      vm.pageInfo = from
+      vm.prevPageInfo = from
     })
     })
   }
   }
 }
 }

+ 4 - 1
src/views/purchasingManagement/purchaseOrder/edit.vue

@@ -505,7 +505,6 @@ export default {
     },
     },
     // 查看产品
     // 查看产品
     handlePicDetail (row) {
     handlePicDetail (row) {
-      console.log(row)
       this.$router.push({ name: 'viewProduct', params: { sn: row.productSn } })
       this.$router.push({ name: 'viewProduct', params: { sn: row.productSn } })
     },
     },
     // 上次缺货 导入成功
     // 上次缺货 导入成功
@@ -581,13 +580,17 @@ export default {
     }
     }
   },
   },
   mounted () {
   mounted () {
+    console.log(555)
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
+      console.log(666)
       this.pageInit()
       this.pageInit()
     }
     }
   },
   },
   activated () {
   activated () {
     // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
     // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
+    console.log(777)
     if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
     if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
+      console.log(888)
       this.pageInit()
       this.pageInit()
     }
     }
   },
   },