Jelajahi Sumber

航站视图-起飞、降落添加背景色

zhongxiaoyu 2 tahun lalu
induk
melakukan
8daef6934b

+ 3 - 3
src/views/realTime/components/AirportView/index.scss

@@ -65,9 +65,9 @@
           }
           }
           &.bg-gray {
           &.bg-gray {
             background-color: #d2d6df;
             background-color: #d2d6df;
-          }
-          &.underline-red {
-            border-bottom: 2px solid #e83f82;
+            & + :not(.bg-gray) {
+              border-top: 2px solid #e83f82;
+            }
           }
           }
           .el-table-v2__row-cell {
           .el-table-v2__row-cell {
             &.cell-warning {
             &.cell-warning {

+ 1 - 1
src/views/realTime/components/AirportView/index.vue

@@ -204,7 +204,7 @@ const {
   tableColumns,
   tableColumns,
   tableData,
   tableData,
   {},
   {},
-  { planDepartureTime: 'ascending' }
+  { [props.name.includes('Departure') ? 'planDepartureTime' : 'planLandingTime']: 'ascending' }
 )
 )
 
 
 const permissionMap = {
 const permissionMap = {

+ 17 - 8
src/views/realTime/hooks/useTableStyle.ts

@@ -62,14 +62,23 @@ export function useTableStyle(tableName?: string) {
 
 
   const rowClassV2: RowClassGetter = ({ columns, rowData, rowIndex }) => {
   const rowClassV2: RowClassGetter = ({ columns, rowData, rowIndex }) => {
     const classes: string[] = []
     const classes: string[] = []
-    // if (tableName?.includes('Airport')) {
-    //   if (rowIndex <= 1) {
-    //     classes.push('bg-gray')
-    //   }
-    //   if (rowIndex === 1) {
-    //     classes.push('underline-red')
-    //   }
-    // }
+    const now = new Date().getTime()
+    if (tableName?.includes('DepartureAirport') && rowData.planDepartureTime) {
+      const departureTime = new Date(
+        (rowData.planDepartureTime as string).replace('T', ' ')
+      ).getTime()
+      if (now >= departureTime) {
+        classes.push('bg-gray')
+      }
+    }
+    if (tableName?.includes('ArrivalAirport') && rowData.planLandingTime) {
+      const landingTime = new Date(
+        (rowData.planLandingTime as string).replace('T', ' ')
+      ).getTime()
+      if (now >= landingTime) {
+        classes.push('bg-gray')
+      }
+    }
     return classes.join(' ')
     return classes.join(' ')
   }
   }