lilei 2 tahun lalu
induk
melakukan
ffea1bb3ff
1 mengubah file dengan 15 tambahan dan 5 penghapusan
  1. 15 5
      src/views/salesReturnManagement/billOfLading/add.vue

+ 15 - 5
src/views/salesReturnManagement/billOfLading/add.vue

@@ -371,28 +371,38 @@ export default {
       this.form.attachmentList = ''
       this.$refs.attachList.setFileList('')
       this.$refs.ruleForm.resetFields()
-      if (this.$route.params.sn && this.$store.state.app.isNewTab) { //  编辑页
+
+      if (this.$route.params.sn) { //  编辑页
         this.form.theme = ''
         this.getDetail()
         this.getReturnOrderList()
       } else {
-        // 新增
-        // 如果是从销售退货列表过来的数据
+        // 从销售退货列表过来的数据
         const cd = this.$store.state.app.tempBillOfData
         if (cd) {
+          this.chooseData = []
           this.chooseData.push(cd)
         }
       }
     }
   },
+  watch: {
+    '$store.state.app.tempBillOfData' (newValue, oldValue) {
+      console.log(newValue)
+      this.chooseData = []
+      this.chooseData.push(newValue)
+    }
+  },
   mounted () {
     if (!this.$store.state.app.isNewTab) { // 页签刷新时调用
       this.pageInit()
     }
   },
   activated () {
-    this.chooseData = []
-    this.pageInit()
+    // 如果是新页签打开或者进入新的子页(例:存在列表第2条数据编辑页页签时再打开第4条数据的编辑页),则重置当前页面
+    if (this.$store.state.app.isNewTab || !this.$store.state.app.isNewSubTab) {
+      this.pageInit()
+    }
   },
   beforeRouteEnter (to, from, next) {
     next(vm => {})