Ver Fonte

实时视图-国内进港航站视图-排序修改

zhongxiaoyu há 2 anos atrás
pai
commit
08316d88b1

+ 12 - 1
src/views/realTime/components/AirportView/index.scss

@@ -61,7 +61,18 @@
             background-color: #d6f2f3;
           }
           &.underline-red {
-            border-bottom: 2px solid #e83f82;
+            // border-bottom: 2px solid #e83f82;
+            position: relative;
+            &::after {
+              content: '';
+              position: absolute;
+              left: 0;
+              bottom: 0;
+              width: 100%;
+              height: 2px;
+              background: #e83f82;
+              z-index: 2;
+            }
           }
           .el-table__cell {
             height: 50px;

+ 58 - 8
src/views/realTime/components/AirportView/index.vue

@@ -83,6 +83,7 @@ const props = defineProps({
   },
 })
 
+const isInternational = props.name.includes('International')
 const isDeparture = props.name.includes('Departure')
 
 const formData: CommonData = reactive({})
@@ -227,7 +228,7 @@ const summaryMethod: SummaryMethod<CommonData> = ({ columns, data }) => {
  * 2.未起飞中已装机在前
  * 3.已起飞和未起飞分类中各自按照预计起飞时间排序
  */
-const defaultSortFunction = (a: CommonData, b: CommonData) => {
+const defaultDepartureSortFunction = (a: CommonData, b: CommonData) => {
   const departureTimeCompare = (a: CommonData, b: CommonData) => {
     if (a.planDepartureTime) {
       if (b.planDepartureTime) {
@@ -290,18 +291,67 @@ const defaultSortFunction = (a: CommonData, b: CommonData) => {
     }
   }
 
-  return receiveCompare(a, b)
+  return isInternational ? takeOffCompare(a, b) : receiveCompare(a, b)
+}
+
+const defaultArrivalSortFunction = (a: CommonData, b: CommonData) => {
+  const landingTimeCompare = (a: CommonData, b: CommonData) => {
+    if (a.planLandingTime) {
+      if (b.planLandingTime) {
+        if (a.planLandingTime > b.planLandingTime) {
+          return 1
+        } else if (a.planLandingTime < b.planLandingTime) {
+          return -1
+        } else {
+          return 0
+        }
+      } else {
+        return -1
+      }
+    } else if (b.planLandingTime) {
+      return 1
+    } else {
+      return 0
+    }
+  }
+
+  const tallyCompare = (a: CommonData, b: CommonData) => {
+    if (a.tally) {
+      if (b.tally) {
+        return landingTimeCompare(a, b)
+      } else {
+        return -1
+      }
+    } else if (b.tally) {
+      return 1
+    } else {
+      return landingTimeCompare(a, b)
+    }
+  }
+
+  const unloadCompare = (a: CommonData, b: CommonData) => {
+    if (a.unLoad) {
+      if (b.unLoad) {
+        return tallyCompare(a, b)
+      } else {
+        return -1
+      }
+    } else if (b.unLoad) {
+      return 1
+    } else {
+      return tallyCompare(a, b)
+    }
+  }
+
+  return isInternational ? landingTimeCompare(a, b) : unloadCompare(a, b)
 }
 
 const filterSortOptions = computed(() => ({
   defaultFilterValueMap,
   extraFilterValueMap: flightStateFilter,
-  defaultSortRuleMap: isDeparture
-    ? undefined
-    : {
-        planLandingTime: 'ascending',
-      },
-  defaultSortFunction: isDeparture ? defaultSortFunction : undefined,
+  defaultSortFunction: isDeparture
+    ? defaultDepartureSortFunction
+    : defaultArrivalSortFunction,
 }))
 
 const sortRuleMap = ref({})

+ 5 - 1
src/views/realTime/components/AirportView/useFlightState.ts

@@ -81,7 +81,11 @@ export function useFlightState(
         // 判断已降落
         if (now >= landingTime) {
           row.hasLanded = 'Y'
-          finishedCount.value++
+          if (name.includes('International')) {
+            finishedCount.value++
+          } else if (row['unLoad'] && row['tally']) {
+            finishedCount.value++
+          }
         } else {
           row.hasLanded = 'N'
         }