zhaoke 1 жил өмнө
parent
commit
33b95b7f45

+ 26 - 5
src/views/bagDetailsPage/components/baggageList.vue

@@ -13,7 +13,7 @@ import { exportToExcel } from '@/utils/table'
 export default {
   name: 'BaggageList',
   components: { Table },
-  props: ['tableDatas'],
+  props: ['tableDatas', 'queryItem'],
   data () {
     return {
       tableCols: [],
@@ -25,13 +25,34 @@ export default {
       tableTag: []
     }
   },
-  mounted () {
-    if (this.tableDatas?.length) {
-      this.tableDatas[0].nfilter = JSON.parse(sessionStorage.getItem('bagQueryParams')) || {}
-      this.tableTag = this.tableDatas
+  watch: {
+    queryItem: {
+      handler (val) {
+        if (val) {
+          this.getViewData(true)
+        }
+      },
+      deep: true
     }
   },
+  mounted () {
+    this.getViewData()
+  },
   methods: {
+    getViewData (Jump = false) {
+      if (this.tableDatas?.length) {
+        if (Jump) {
+          const ndata = _.cloneDeep(this.tableDatas)
+          if (ndata?.length) {
+            ndata[0].nfilter = JSON.parse(sessionStorage.getItem('bagQueryParams')) || {}
+            this.tableTag = ndata
+          }
+        } else {
+          this.tableDatas[0].nfilter = JSON.parse(sessionStorage.getItem('bagQueryParams')) || {}
+          this.tableTag = this.tableDatas
+        }
+      }
+    },
     exportHandler (refName, tableName) {
       const { query } = this.$route
       const table = this.$refs[refName].$el.cloneNode(true)

+ 20 - 6
src/views/bagDetailsPage/components/baggageView.vue

@@ -39,6 +39,7 @@
 import { Query } from '@/api/webApi'
 export default {
   name: 'BaggageView',
+  props: ['queryItem'],
   data () {
     return {
       stepNodes: [
@@ -142,15 +143,28 @@ export default {
       }
     },
   },
-  mounted () {
-    const bagQueryParams = JSON.parse(sessionStorage.getItem('bagQueryParams')) || ''
-    if (bagQueryParams) {
-      this.dataContent = bagQueryParams
-      this.restTable()
-      this.load()
+  watch: {
+    queryItem: {
+      handler (val) {
+        if (val) {
+          this.getViewData()
+        }
+      },
+      deep: true
     }
   },
+  mounted () {
+    this.getViewData()
+  },
   methods: {
+    getViewData () {
+      const bagQueryParams = JSON.parse(sessionStorage.getItem('bagQueryParams')) || ''
+      if (bagQueryParams) {
+        this.dataContent = bagQueryParams
+        this.restTable()
+        this.load()
+      }
+    },
     //获取行李信息
     async getLuggageList (serviceid = 116, datacontent = { filter: this.dataContent }, page = ++this.page, size = this.pageSize) {
       try {

+ 6 - 2
src/views/bagDetailsPage/index.vue

@@ -42,7 +42,7 @@
         </div>
       </div>
       <div class="newBagDetails-contents-page">
-        <component ref="dataChild" :tableDatas="tableDatas" :is="componentName"></component>
+        <component ref="dataChild" :queryItem="queryItem" :tableDatas="tableDatas" :is="componentName"></component>
       </div>
     </div>
     <Dialog :flag="imgFlag" width="600px" class="dialog-check-img">
@@ -119,7 +119,8 @@ export default {
       queryObj: {},
       imgFlag: false,
       srcList: [],
-      srcUrl: []
+      srcUrl: [],
+      queryItem: null
     }
   },
   computed: {
@@ -218,6 +219,8 @@ export default {
             this.setTableLocalData('bagQueryParams', this.queryObj)
             this.getLuggageNums()
             this.loading = false
+          } else {
+            this.loading = false
           }
         } else {
           this.loading = false
@@ -276,6 +279,7 @@ export default {
       }
       this.activeIndex = index
       this.setTableLocalData('bagQueryParams', this.tagObj)
+      this.queryItem = Math.random()
       this.queryTableData(115, this.tagObj)
     },
     tabClick (item, index) {