Browse Source

航站视图-单元格颜色提示规则修改

zhongxiaoyu 2 years ago
parent
commit
0127f52ff1
1 changed files with 15 additions and 58 deletions
  1. 15 58
      src/views/realTime/hooks/useTableStyle.ts

+ 15 - 58
src/views/realTime/hooks/useTableStyle.ts

@@ -21,19 +21,6 @@ export function useTableStyle(tableName?: string) {
         classes.push('bg-light')
       }
     }
-    // if (tableName?.includes('FlightContainer')) {
-    //   if (rowIndex === 1) {
-    //     classes.push('row-warning')
-    //   }
-    // }
-    // if (tableName?.includes('FlightWaybill')) {
-    //   if (rowIndex === 0) {
-    //     classes.push('row-alarm')
-    //   }
-    //   if (rowIndex === 1) {
-    //     classes.push('row-warning')
-    //   }
-    // }
     return classes.join(' ')
   }
 
@@ -63,15 +50,12 @@ export function useTableStyle(tableName?: string) {
         classes.push('cell-warning')
       }
       if (
-        tableName?.includes('DepartureAirport') &&
-        (['depotJoin', 'resure'] as any[]).includes(column.property) &&
-        (cellData ?? '') !== ''
+        (['resure', 'resureTime'] as any[]).includes(column.property) &&
+        (cellData ?? '') !== '' &&
+        row['resure'] !== row['stowage'] &&
+        (row['planeDownTime'] ?? '') !== ''
       ) {
-        if (cellData === row['stowage']) {
-          classes.push('cell-success')
-        } else if ((row['planeDownTime'] ?? '') !== '') {
-          classes.push('cell-alarm')
-        }
+        classes.push('cell-warning')
       }
       if (column.property === 'loadPlaneTime') {
         if (row['warningState'] === 'alarm') {
@@ -82,17 +66,23 @@ export function useTableStyle(tableName?: string) {
         }
       }
       if (['securityYes', 'securityTime'].includes(column.property)) {
-        const { receiveSure, securityYes } = row
+        const { receiveSure, receiveSure1, securityYes } = row
         let receiveNum = 0,
           securityNum = 0
-        if (typeof receiveSure === 'string') {
-          receiveNum = Number(receiveSure.split('/')[1]) || 0
+        if (tableName.includes('International')) {
+          if (typeof receiveSure1 === 'string') {
+            receiveNum = Number(receiveSure1.split('/')[1]) || 0
+          }
+        } else {
+          if (typeof receiveSure === 'string') {
+            receiveNum = Number(receiveSure.split('/')[1]) || 0
+          }
         }
         if (typeof securityYes === 'string') {
           securityNum = Number(securityYes.split('/')[1]) || 0
         }
         if (receiveNum !== securityNum) {
-          classes.push('cell-striking')
+          classes.push('cell-warning')
         }
       }
     }
@@ -143,39 +133,6 @@ export function useTableStyle(tableName?: string) {
     rowIndex,
   }) => {
     const classes: string[] = []
-    if ((['flightNO'] as any[]).includes(column.dataKey)) {
-      classes.push('cell-click')
-    }
-    if (
-      (column.dataKey === 'register' &&
-        typeof cellData === 'string' &&
-        cellData.split('/').some(char => Number(char) > 0)) ||
-      ((['pullregisterTime', 'pullRegisterTime'] as any[]).includes(
-        column.dataKey
-      ) &&
-        typeof cellData === 'string')
-    ) {
-      classes.push('cell-warning')
-    }
-    if (
-      tableName?.includes('DepartureAirport') &&
-      (['depotJoin', 'resure'] as any[]).includes(column.dataKey) &&
-      (cellData ?? '') !== ''
-    ) {
-      if (cellData === rowData['stowage']) {
-        classes.push('cell-success')
-      } else if ((rowData['planeDownTime'] ?? '') !== '') {
-        classes.push('cell-alarm')
-      }
-    }
-    if (column.dataKey === 'loadPlaneTime') {
-      if (rowData['warningState'] === 'alarm') {
-        classes.push('cell-alarm')
-      }
-      if (rowData['warningState'] === 'warning') {
-        classes.push('cell-warning')
-      }
-    }
     return classes.join(' ')
   }