瀏覽代碼

bug修复

chenrui 3 年之前
父節點
當前提交
32b791c437
共有 1 個文件被更改,包括 13 次插入3 次删除
  1. 13 3
      src/views/productManagement/productInfo/list.vue

+ 13 - 3
src/views/productManagement/productInfo/list.vue

@@ -250,7 +250,8 @@ export default {
       openOfflineModal: false, //  下线  弹框
       offlineProductList: [], //  下线 当前所选数据
       productBrandList: [], //  品牌下拉数据
-      productTypeList: [] //  分类下拉数据
+      productTypeList: [], //  分类下拉数据
+      pageFromInfo: null
     }
   },
   computed: {
@@ -594,6 +595,7 @@ export default {
     }
   },
   activated () {
+    const _this = this
     // 如果是新页签打开,则重置当前页面
     if (this.$store.state.app.isNewTab) {
       this.pageInit()
@@ -602,11 +604,19 @@ export default {
     // 仅刷新列表,不重置页面
     if (this.$store.state.app.updateList) {
       this.pageInit()
-      this.$refs.table.refresh()
+      setTimeout(() => { //  解决 编辑页 返回列表 请求先前页的数据。新增页 返回列表 请求第一页的数据。延迟是为了解决先执行activated 后执行beforeRouteEnter的问题
+        if (_this.pageFromInfo && _this.pageFromInfo.name == 'productInfoAdd') {
+        	_this.resetSearchForm()
+        } else {
+        	_this.$refs.table.refresh()
+        }
+      }, 100)
     }
   },
   beforeRouteEnter (to, from, next) {
-    next(vm => {})
+    next(vm => {
+      vm.pageFromInfo = from
+    })
   }
 }
 </script>