Browse Source

国内/国际离港航站视图-装机时间、关闭舱门时间预警规则

zhongxiaoyu 2 years ago
parent
commit
f4e15990fd
2 changed files with 34 additions and 8 deletions
  1. 1 0
      src/router/routes/routes-file-seven.ts
  2. 33 8
      src/views/realTime/hooks/useTableStyle.ts

+ 1 - 0
src/router/routes/routes-file-seven.ts

@@ -9,6 +9,7 @@ const HomeRoutes = {
   meta: {
     title: "统计分析",
     elSvgIcon: "analyseIcon",
+    roles: ['statistic_alanalysis_page']
   },
   children: [
     {

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

@@ -11,6 +11,12 @@ type CellClassGetter = (params: {
   rowIndex: number
 }) => string
 
+function getTime(time: string | null) {
+  const timeString = time?.replace('T', ' ')
+  const datetime = timeString ? new Date(timeString).getTime() : Date.now()
+  return datetime
+}
+
 export function useTableStyle(tableName?: string) {
   const rowClass = ({ row, rowIndex }) => {
     const classes: string[] = []
@@ -66,14 +72,14 @@ export function useTableStyle(tableName?: 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 (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,
@@ -94,6 +100,25 @@ export function useTableStyle(tableName?: string) {
           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 (tableName?.includes('FlightContainer')) {