瀏覽代碼

航站视图-预警报警规则修改

zhongxiaoyu 2 年之前
父節點
當前提交
9e5089e694
共有 2 個文件被更改,包括 102 次插入95 次删除
  1. 1 1
      public/extraConfig.js
  2. 101 94
      src/views/realTime/hooks/useTableStyle.ts

+ 1 - 1
public/extraConfig.js

@@ -110,7 +110,7 @@ var HANDOVER_WARNING_MAP = {
   },
   internationalDeparture: {
     all: {
-      alarm: 195,
+      warning: 195,
     },
   },
 }

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

@@ -81,117 +81,124 @@ export function useTableStyle(tableName?: string) {
           classes.push('flight-state-cancel')
         }
       }
-      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 (typeof resure === 'string') {
-          resureNum = Number(resure.split('/')[0]) || 0
-        }
-        if (stowageNum !== resureNum) {
+      if (Number(row['flightType']) === 1) {
+        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 === 'loadPlaneTime') {
-      //   if (row['warningState'] === 'alarm') {
-      //     classes.push('cell-alarm')
-      //   }
-      //   if (row['warningState'] === 'warning') {
-      //     classes.push('cell-warning')
-      //   }
-      // }
-      if (['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 (
+          (['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
           }
-        } else {
-          if (typeof receiveSure === 'string') {
-            receiveNum = Number(receiveSure.split('/')[0]) || 0
+          if (typeof resure === 'string') {
+            resureNum = Number(resure.split('/')[0]) || 0
+          }
+          if (stowageNum !== resureNum) {
+            classes.push('cell-warning')
           }
         }
-        if (typeof securityYes === 'string') {
-          securityNum = Number(securityYes.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 (receiveNum !== securityNum) {
+            classes.push('cell-warning')
+          }
         }
-        if (receiveNum !== securityNum) {
-          classes.push('cell-warning')
+
+        if (column.property === 'loadPlaneSureTime') {
+          const { planDepartureTime, loadPlaneSureTime } = row
+          if (
+            getTime(planDepartureTime) - getTime(loadPlaneSureTime) <
+            5 * 60 * 1000
+          ) {
+            classes.push('cell-warning')
+          }
+        }
+        if (column.property === 'loadPlaneTime') {
+          const { planDepartureTime, loadPlaneTime } = row
+          if (
+            getTime(planDepartureTime) - getTime(loadPlaneTime) <
+            2 * 60 * 1000
+          ) {
+            classes.push('cell-warning')
+          }
         }
-      }
 
-      if (column.property === 'loadPlaneSureTime') {
-        const { planDepartureTime, loadPlaneSureTime } = row
         if (
-          getTime(planDepartureTime) - getTime(loadPlaneSureTime) <
-          5 * 60 * 1000
+          tableName === 'DepartureAirport' &&
+          column.property === 'addCargoTime'
         ) {
-          classes.push('cell-warning')
+          const { endLoadTime, addCargoTime } = row
+          if (getTime(endLoadTime) < getTime(addCargoTime)) {
+            classes.push('cell-warning')
+          }
         }
-      }
-      if (column.property === 'loadPlaneTime') {
-        const { planDepartureTime, loadPlaneTime } = row
         if (
-          getTime(planDepartureTime) - getTime(loadPlaneTime) <
-          2 * 60 * 1000
+          tableName === 'InternationalDepartureAirport' &&
+          column.property === 'securityTime'
         ) {
-          classes.push('cell-warning')
-        }
-      }
-
-      if (
-        tableName === 'DepartureAirport' &&
-        ['addCargo', 'addCargoTime'].includes(column.property)
-      ) {
-        const { endLoadTime, addCargoTime } = row
-        if (getTime(endLoadTime) < getTime(addCargoTime)) {
-          classes.push('cell-warning')
-        }
-      }
-      if (
-        tableName === 'InternationalDepartureAirport' &&
-        ['securityYes', 'securityTime'].includes(column.property)
-      ) {
-        const { endLoadTime, securityTime } = row
-        if (getTime(endLoadTime) < getTime(securityTime)) {
-          classes.push('cell-warning')
+          const { endLoadTime, securityTime } = row
+          if (getTime(endLoadTime) < getTime(securityTime)) {
+            classes.push('cell-warning')
+          }
         }
-      }
 
-      if (
-        tableName?.includes('Departure') &&
-        ['planeDownTime'].includes(column.property)
-      ) {
-        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
+          tableName?.includes('Departure') &&
+          column.property === 'planeDownTime'
         ) {
-          classes.push('cell-warning')
+          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')
+          }
         }
       }
     }