Selaa lähdekoodia

离港航班视图-预警报警修改

zhongxiaoyu 2 vuotta sitten
vanhempi
commit
1bdf4d0d6e
1 muutettua tiedostoa jossa 98 lisäystä ja 101 poistoa
  1. 98 101
      src/views/realTime/hooks/useTableStyle.ts

+ 98 - 101
src/views/realTime/hooks/useTableStyle.ts

@@ -81,124 +81,121 @@ export function useTableStyle(tableName?: string) {
           classes.push('flight-state-cancel')
         }
       }
-      if (row.flightType === '货机') {
-        if (
-          (column.property === 'register' &&
-            typeof cellData === 'string' &&
-            cellData.split('/').some(char => Number(char) > 0)) ||
-          ((['pullregisterTime', 'pullRegisterTime'] as CommonValue[]).includes(
-            column.property
-          ) &&
-            typeof cellData === 'string')
-        ) {
-          classes.push('cell-warning')
+      if (
+        (column.property === 'register' &&
+          typeof cellData === 'string' &&
+          cellData.split('/').some(char => Number(char) > 0)) ||
+        ((['pullregisterTime', 'pullRegisterTime'] as CommonValue[]).includes(
+          column.property
+        ) &&
+          typeof cellData === 'string')
+      ) {
+        classes.push('cell-warning')
+      }
+      if (
+        (['resure', 'resureTime'] as CommonValue[]).includes(column.property) &&
+        (row['planeDownTime'] ?? '') !== ''
+      ) {
+        const { stowage, resure } = row
+        let stowageNum = 0,
+          resureNum = 0
+        if (typeof stowage === 'string') {
+          stowageNum = Number(stowage.split('/')[0]) || 0
         }
-        if (
-          (['resure', 'resureTime'] as CommonValue[]).includes(
-            column.property
-          ) &&
-          (row['planeDownTime'] ?? '') !== ''
-        ) {
-          const { stowage, resure } = row
-          let stowageNum = 0,
-            resureNum = 0
-          if (typeof stowage === 'string') {
-            stowageNum = Number(stowage.split('/')[0]) || 0
-          }
-          if (typeof resure === 'string') {
-            resureNum = Number(resure.split('/')[0]) || 0
-          }
-          if (stowageNum !== resureNum) {
-            classes.push('cell-warning')
-          }
+        if (typeof resure === 'string') {
+          resureNum = Number(resure.split('/')[0]) || 0
         }
-        // if (column.property === 'loadPlaneTime') {
-        //   if (row['warningState'] === 'alarm') {
-        //     classes.push('cell-alarm')
-        //   }
-        //   if (row['warningState'] === 'warning') {
-        //     classes.push('cell-warning')
-        //   }
-        // }
-        if (
-          tableName === 'DepartureAirport' &&
-          ['securityYes', 'securityTime'].includes(column.property)
-        ) {
-          const { receiveSure, receiveSure1, securityYes } = row
-          let receiveNum = 0,
-            securityNum = 0
-          if (tableName.includes('International')) {
-            if (typeof receiveSure1 === 'string') {
-              receiveNum = Number(receiveSure1.split('/')[0]) || 0
-            }
-          } else {
-            if (typeof receiveSure === 'string') {
-              receiveNum = Number(receiveSure.split('/')[0]) || 0
-            }
-          }
-          if (typeof securityYes === 'string') {
-            securityNum = Number(securityYes.split('/')[0]) || 0
+        if (stowageNum !== resureNum) {
+          classes.push('cell-warning')
+        }
+      }
+      // if (column.property === 'loadPlaneTime') {
+      //   if (row['warningState'] === 'alarm') {
+      //     classes.push('cell-alarm')
+      //   }
+      //   if (row['warningState'] === 'warning') {
+      //     classes.push('cell-warning')
+      //   }
+      // }
+      if (
+        tableName === 'DepartureAirport' &&
+        ['securityYes', 'securityTime'].includes(column.property)
+      ) {
+        const { receiveSure, receiveSure1, securityYes } = row
+        let receiveNum = 0,
+          securityNum = 0
+        if (tableName.includes('International')) {
+          if (typeof receiveSure1 === 'string') {
+            receiveNum = Number(receiveSure1.split('/')[0]) || 0
           }
-          if (receiveNum !== securityNum) {
-            classes.push('cell-warning')
+        } else {
+          if (typeof receiveSure === 'string') {
+            receiveNum = Number(receiveSure.split('/')[0]) || 0
           }
         }
-
-        if (column.property === 'loadPlaneSureTime') {
-          const { planDepartureTime, loadPlaneSureTime } = row
-          if (
-            getTime(planDepartureTime) - getTime(loadPlaneSureTime) <
-            5 * 60 * 1000
-          ) {
-            classes.push('cell-warning')
-          }
+        if (typeof securityYes === 'string') {
+          securityNum = Number(securityYes.split('/')[0]) || 0
         }
-        if (column.property === 'loadPlaneTime') {
-          const { planDepartureTime, loadPlaneTime } = row
-          if (
-            getTime(planDepartureTime) - getTime(loadPlaneTime) <
-            2 * 60 * 1000
-          ) {
-            classes.push('cell-warning')
-          }
+        if (receiveNum !== securityNum) {
+          classes.push('cell-warning')
         }
+      }
 
+      if (column.property === 'loadPlaneSureTime') {
+        const { planDepartureTime, loadPlaneSureTime } = row
         if (
-          tableName === 'DepartureAirport' &&
-          column.property === 'addCargoTime'
+          getTime(planDepartureTime) - getTime(loadPlaneSureTime) <
+          5 * 60 * 1000
         ) {
-          const { endLoadTime, addCargoTime } = row
-          if (getTime(endLoadTime) < getTime(addCargoTime)) {
-            classes.push('cell-warning')
-          }
+          classes.push('cell-warning')
         }
+      }
+      if (column.property === 'loadPlaneTime') {
+        const { planDepartureTime, loadPlaneTime } = row
         if (
-          tableName === 'InternationalDepartureAirport' &&
-          column.property === 'securityTime'
+          getTime(planDepartureTime) - getTime(loadPlaneTime) <
+          2 * 60 * 1000
         ) {
-          const { endLoadTime, securityTime } = row
-          if (getTime(endLoadTime) < getTime(securityTime)) {
-            classes.push('cell-warning')
-          }
+          classes.push('cell-warning')
+        }
+      }
+
+      if (
+        tableName === 'DepartureAirport' &&
+        column.property === 'addCargoTime'
+      ) {
+        const { endLoadTime, addCargoTime } = row
+        if (getTime(endLoadTime) < getTime(addCargoTime)) {
+          classes.push('cell-warning')
+        }
+      }
+      if (
+        tableName === 'InternationalDepartureAirport' &&
+        column.property === 'securityTime'
+      ) {
+        const { endLoadTime, securityTime } = row
+        if (getTime(endLoadTime) < getTime(securityTime)) {
+          classes.push('cell-warning')
         }
+      }
 
+      if (
+        tableName?.includes('Departure') &&
+        column.property === 'planeDownTime' &&
+        row.flightType === '货机'
+      ) {
+        const { planDepartureTime, planeDownTime, takeOffStand } = row
+        const { warning, alarm } = getDuration(tableName, takeOffStand)
         if (
-          tableName?.includes('Departure') &&
-          column.property === 'planeDownTime'
+          typeof alarm === 'number' &&
+          getTime(planDepartureTime) - getTime(planeDownTime) < alarm
         ) {
-          const { planDepartureTime, planeDownTime, takeOffStand } = row
-          const { warning, alarm } = getDuration(tableName, takeOffStand)
-          if (
-            typeof alarm === 'number' &&
-            getTime(planDepartureTime) - getTime(planeDownTime) < alarm
-          ) {
-            classes.push('cell-alarm')
-          } else if (
-            typeof warning === 'number' &&
-            getTime(planDepartureTime) - getTime(planeDownTime) < warning
-          ) {
-            classes.push('cell-warning')
-          }
+          classes.push('cell-alarm')
+        } else if (
+          typeof warning === 'number' &&
+          getTime(planDepartureTime) - getTime(planeDownTime) < warning
+        ) {
+          classes.push('cell-warning')
         }
       }
     }