Преглед на файлове

1.0中转视图切换保留条件

zhongxiaoyu преди 1 година
родител
ревизия
ee1084425b

+ 23 - 25
src/views/baggageManagementTemp/components/transferArrival/index.vue

@@ -326,7 +326,7 @@ import formMixin from '../../mixins/form'
 import tableColsMixin from '../../mixins/tableCols'
 import timeZoneMixin from '../../mixins/timeZone'
 import pf from '@/layout/mixin/publicFunc'
-import { TempQuery } from '@/api/temp'
+// import { TempQuery } from '@/api/temp'
 import { GeneralDataReception } from '@/api/temp'
 import TableHeaderCell from '@/components/TableHeaderCell'
 import { setTableFilters, throttledExportToExcel, timeInZone } from '@/utils/table'
@@ -555,22 +555,20 @@ export default {
     })
   },
   activated() {
+    const { currentAirport, startDate, endDate } = this.$route.query
+    if ((currentAirport ?? '') !== '') {
+      this.formData.currentAirport = currentAirport
+    }
+    if ((startDate ?? '') !== '') {
+      this.formData.flightDate[0] = startDate
+    }
+    if ((endDate ?? '') !== '') {
+      this.formData.flightDate[1] = endDate
+    }
     this.table.scrollTop = this.scrollTop
     this.getTableData()
     this.getWarningData()
     this.loopEvent = setInterval(this.getTableData, LOOP_INTERVAL.transferArrivalTable)
-    // const { startDate, endDate } = this.$route.query
-    // Object.entries(this.$route.query).forEach(([key, value]) => {
-    //   if ((value ?? '') !== '' && JSON.stringify(value) !== '[]') {
-    //     this.formData[key] = value
-    //   }
-    // })
-    // if (startDate !== null && startDate !== undefined) {
-    //   this.formData.flightDate[0] = startDate
-    // }
-    // if (endDate !== null && endDate !== undefined) {
-    //   this.formData.flightDate[1] = endDate
-    // }
   },
   deactivated() {
     if (this.loopEvent) {
@@ -628,17 +626,15 @@ export default {
       return classes.join(' ')
     },
     changeView() {
-      // const query = {
-      //   ...this.formData,
-      //   startDate: this.startDate,
-      //   endDate: this.endDate
-      // }
-      // delete query.flightDate
-      // this.$router.replace({
-      //   path: '/transfer/departure',
-      //   query
-      // })
-      this.$router.push('/transfer/departure')
+      const query = {
+        currentAirport: this.formData.currentAirport,
+        startDate: this.startDate,
+        endDate: this.endDate
+      }
+      this.$router.push({
+        path:'/transfer/departure',
+        query
+      })
     },
     airPortChange() {
       this.getAviationData()
@@ -660,8 +656,10 @@ export default {
         const res = await this.getQueryListAuth(SERVICE_ID.departureAirId, {}, 1, 9999, 280)
         if (Number(res.code) === 0) {
           if (res.returnData?.listValues?.length) {
+            if (!this.formData.currentAirport) {
+              this.formData.currentAirport = res.returnData.listValues[0].planDepartureApt
+            }
             this.AirportList = this._.orderBy(res.returnData.listValues, o => o.planDepartureApt)
-            this.formData.currentAirport = res.returnData.listValues[0].planDepartureApt
             this.getAviationData()
             this.upAviationData()
             this.resetLoopEvent()

+ 23 - 25
src/views/baggageManagementTemp/components/transferDeparture/index.vue

@@ -148,7 +148,7 @@ import formMixin from '../../mixins/form'
 import tableColsMixin from '../../mixins/tableCols'
 import timeZoneMixin from '../../mixins/timeZone'
 import pf from '@/layout/mixin/publicFunc'
-import { TempQuery, WhatQuery } from '@/api/temp'
+// import { TempQuery, WhatQuery } from '@/api/temp'
 import { GeneralDataReception } from '@/api/temp'
 import TableHeaderCell from '@/components/TableHeaderCell'
 import { setTableFilters, throttledExportToExcel, timeInZone } from '@/utils/table'
@@ -352,22 +352,20 @@ export default {
     })
   },
   activated () {
+    const { currentAirport, startDate, endDate } = this.$route.query
+    if ((currentAirport ?? '') !== '') {
+      this.formData.currentAirport = currentAirport
+    }
+    if ((startDate ?? '') !== '') {
+      this.formData.flightDate[0] = startDate
+    }
+    if ((endDate ?? '') !== '') {
+      this.formData.flightDate[1] = endDate
+    }
     this.table.scrollTop = this.scrollTop
     this.getTableData()
     this.getWarningData()
     this.loopEvent = setInterval(this.getTableData, LOOP_INTERVAL.transferDepartureTable)
-    // const { startDate, endDate } = this.$route.query
-    // Object.entries(this.$route.query).forEach(([key, value]) => {
-    //   if ((value ?? '') !== '' && JSON.stringify(value) !== '[]') {
-    //     this.formData[key] = value
-    //   }
-    // })
-    // if (startDate !== null && startDate !== undefined) {
-    //   this.formData.flightDate[0] = startDate
-    // }
-    // if (endDate !== null && endDate !== undefined) {
-    //   this.formData.flightDate[1] = endDate
-    // }
   },
   deactivated () {
     if (this.loopEvent) {
@@ -425,17 +423,15 @@ export default {
       return classes.join(' ')
     },
     changeView () {
-      // const query = {
-      //   ...this.formData,
-      //   startDate: this.startDate,
-      //   endDate: this.endDate
-      // }
-      // delete query.flightDate
-      // this.$router.replace({
-      //   path: '/transfer/arrival',
-      //   query
-      // })
-      this.$router.push('/transfer/arrival')
+      const query = {
+        currentAirport: this.formData.currentAirport,
+        startDate: this.startDate,
+        endDate: this.endDate
+      }
+      this.$router.push({
+        path: '/transfer/arrival',
+        query
+      })
     },
     airPortChange () {
       this.getAviationData()
@@ -457,8 +453,10 @@ export default {
         const res = await this.getQueryListAuth(SERVICE_ID.departureAirLtId, {}, 1, 9999, 280)
         if (Number(res.code) === 0) {
           if (res.returnData?.listValues?.length) {
+            if (!this.formData.currentAirport) {
+              this.formData.currentAirport = res.returnData.listValues[0].planDepartureApt
+            }
             this.AirportList = this._.orderBy(res.returnData.listValues, o => o.planDepartureApt)
-            this.formData.currentAirport = res.returnData.listValues[0].planDepartureApt
             this.getAviationData()
             this.upAviationData()
             this.resetLoopEvent()