Эх сурвалжийг харах

国内/国际离港航班视图-预警报警修改

zhongxiaoyu 2 жил өмнө
parent
commit
23cf9b44be

+ 1 - 1
index.html

@@ -12,6 +12,6 @@
   <body>
     <div id="app"></div>
     <script type="module" src="/src/main.ts"></script>
-    <script src="./nodeCode.js" type="text/javascript"></script>
+    <script src="./extraConfig.js" type="text/javascript"></script>
   </body>
 </html>

+ 116 - 0
public/extraConfig.js

@@ -0,0 +1,116 @@
+var NODE_CODE = {
+  NEW: '获取运单',
+  FWB: '获取运单',
+  DEH: '收运核单',
+  ACC_CHECK: '查验',
+  ACC_BUP: '加货',
+  LS_CARGO: '预配载',
+  FSUDEP: '预配载',
+  FSU_DEP: '预配载',
+  CARGOS_HANDOVER_STATUS_02: '货站交接',
+  CARGOS_HANDOVER_STATUS_03: '交接复核',
+  出港货邮: '机下交接',
+  装载完成: '装机完成',
+  货舱关闭: '关货舱门',
+  CARGOS_OFFLOAD: '拉下登记',
+  OFFLOAD_CONFIRM: '拉下确认',
+  BILL_RETURN: '退运',
+  CARGOS_ARR_HANDOVER: '卸机',
+  CARGOS_HANDOVER_STATUS_01: '机下交接',
+  CARGOS_HANDOVER_STATUS_99: '货站交接',
+  IMP_TALLY: '理货',
+  FSU_DLV: '出库',
+  FSUDLV: '出库',
+  EPORTREL: '入园',
+  FOH: '运抵货站',
+  MTREL_out: '海关放行',
+  RCS: '收运核单',
+  MTREL_in: '海关放行',
+  MTREL: '海关放行',
+  DLV: '出库',
+  RCF报: '理货',
+  CARGOS_HANDOVER_STATUS99: '货站交接',
+}
+
+var MESSAGE_TYPE = {
+  FFM: 'FFM',
+  IMP_TALLY: '理货',
+  FSUDLV: '出库',
+}
+
+var LOAD_WARNING_MAP = {
+  departure: {
+    // 窄体
+    B737: 105,
+    B757: 105,
+    A320: 105,
+    A319: 105,
+    B733: 105,
+    B752: 105,
+    B738: 105,
+    B734: 105,
+    'B752+': 105,
+    // 宽体
+    B767: 115,
+    B777: 115,
+    B747: 115,
+    A330: 115,
+    A340: 115,
+    MD11: 115,
+    IL76: 115,
+    B777F: 115,
+    'B763+': 115,
+    B748: 115,
+    B772: 115,
+    A332: 115,
+    B744: 115,
+    B763: 115,
+    B77L: 115,
+    A333: 115,
+  },
+  internationalDeparture: {
+    B737: 240,
+    B757: 240,
+    A320: 240,
+    A319: 240,
+    B733: 240,
+    B752: 240,
+    B738: 240,
+    B734: 240,
+    'B752+': 240,
+    B767: 360,
+    B777: 360,
+    B747: 360,
+    A330: 360,
+    A340: 360,
+    MD11: 360,
+    IL76: 360,
+    B777F: 360,
+    'B763+': 360,
+    B748: 360,
+    B772: 360,
+    A332: 360,
+    B744: 360,
+    B763: 360,
+    B77L: 360,
+    A333: 360,
+  },
+}
+
+var HANDOVER_WARNING_MAP = {
+  departure: {
+    '380-391': {
+      warning: 75,
+      alarm: 60,
+    },
+    '51-139': {
+      warning: 80,
+      alarm: 70,
+    },
+  },
+  internationalDeparture: {
+    all: {
+      alarm: 195,
+    },
+  },
+}

+ 0 - 39
public/nodeCode.js

@@ -1,39 +0,0 @@
-var NODE_CODE = {
-  NEW: '获取运单',
-  FWB: '获取运单',
-  DEH: '收运核单',
-  ACC_CHECK: '查验',
-  ACC_BUP: '加货',
-  LS_CARGO: '预配载',
-  FSUDEP: '预配载',
-  FSU_DEP: '预配载',
-  CARGOS_HANDOVER_STATUS_02: '货站交接',
-  CARGOS_HANDOVER_STATUS_03: '交接复核',
-  出港货邮: '机下交接',
-  装载完成: '装机完成',
-  货舱关闭: '关货舱门',
-  CARGOS_OFFLOAD: '拉下登记',
-  OFFLOAD_CONFIRM: '拉下确认',
-  BILL_RETURN: '退运',
-  CARGOS_ARR_HANDOVER: '卸机',
-  CARGOS_HANDOVER_STATUS_01: '机下交接',
-  CARGOS_HANDOVER_STATUS_99: '货站交接',
-  IMP_TALLY: '理货',
-  FSU_DLV: '出库',
-  FSUDLV: '出库',
-  EPORTREL: '入园',
-  FOH: '运抵货站',
-  MTREL_out: '海关放行',
-  RCS: '收运核单',
-  MTREL_in: '海关放行',
-  MTREL: '海关放行',
-  DLV: '出库',
-  RCF报: '理货',
-  CARGOS_HANDOVER_STATUS99: '货站交接',
-}
-
-var MESSAGE_TYPE = {
-  FFM: 'FFM',
-  IMP_TALLY: '理货',
-  FSUDLV: '出库',
-}

+ 1 - 1
src/router/routes/routes-file-one.ts

@@ -7,7 +7,7 @@ const HomeRoutes = [
     hidden: true,
     children: [
       {
-        path: '/',
+        path: '',
         name: 'HomePage',
         component: () => import('@/views/HomePage/index.vue'),
       },

+ 46 - 1
src/views/realTime/components/AirportView/useAirportTable.ts

@@ -1,6 +1,7 @@
 import { Query } from '@/api/webApi'
 import { ellipsisCell } from '@/components/SimpleTable/customRender'
-import { CommonData, CommonTableColumn } from '~/common'
+import { CommonData, CommonTableColumn, CommonValue } from '~/common'
+import { parseTime } from '@/utils/validate'
 
 interface SimpleColumn {
   columnName: string
@@ -40,6 +41,11 @@ const columnGroupsMap: {
           columnLabel: '计划起飞\n时间',
           fixed: true,
         },
+        {
+          columnName: 'endLoadTime',
+          columnLabel: '结载时间',
+          fixed: true,
+        },
         {
           columnName: 'acDepartureTime',
           columnLabel: '实际起飞\n时间',
@@ -408,6 +414,11 @@ const columnGroupsMap: {
           columnLabel: '计划起飞\n时间',
           fixed: true,
         },
+        {
+          columnName: 'endLoadTime',
+          columnLabel: '结载时间',
+          fixed: true,
+        },
         {
           columnName: 'acDepartureTime',
           columnLabel: '实际起飞\n时间',
@@ -980,6 +991,31 @@ const computedWidth = (column: SimpleColumn) => {
   return width + 1
 }
 
+function getAddend(flightNO: string, name: string) {
+  const minute =
+    LOAD_WARNING_MAP[
+      name.includes('International') ? 'internationalDeparture' : 'departure'
+    ][flightNO]
+  if (minute) {
+    return minute * -1 * 60 * 1000
+  }
+  return 0
+}
+function computedTime(originalTime: CommonValue, addend: number) {
+  if ((originalTime ?? '') === '') {
+    return null
+  }
+  let datetime = 0
+  if (typeof originalTime === 'string') {
+    datetime = new Date(originalTime).getTime()
+  }
+  if (typeof originalTime === 'number') {
+    datetime = originalTime
+  }
+  datetime += addend
+  return parseTime(new Date(datetime), '{y}-{m}-{d} {h}:{i}:{s}')
+}
+
 export function useAirportTable(name: string, formData: CommonData) {
   const tableColumns = ref<CommonTableColumn[]>([])
   const tableData = ref<CommonData[]>([])
@@ -1067,6 +1103,15 @@ export function useAirportTable(name: string, formData: CommonData) {
         //       : null
         //   row.securityTime = row.addCargoTime
         // }
+        if (
+          name === 'DepartureAirport' ||
+          name === 'InternationalDepartureAirport'
+        ) {
+          row.endLoadTime = computedTime(
+            row.planDepartureTime,
+            getAddend(`${row.IATACode}${row.flightNO}`, name)
+          )
+        }
         return {
           ...row,
           rowKey: `${row.IATACode}-${row.flightNO}-${row.flightDate}`,

+ 75 - 0
src/views/realTime/hooks/useTableStyle.ts

@@ -17,6 +17,43 @@ function getTime(time: string | null) {
   return datetime
 }
 
+function getDuration(
+  name: string,
+  takeOffStand: CommonValue
+): { warning: number | null; alarm: number | null } {
+  const subMap =
+    HANDOVER_WARNING_MAP[
+      name.includes('International') ? 'internationalDeparture' : 'departure'
+    ]
+  const stand = parseInt(String(takeOffStand))
+  const matchedKey = Object.keys(subMap).find(key => {
+    if (key.includes('-')) {
+      const [start, end] = key.split('-')
+      const min = Number(start)
+      const max = Number(end)
+      if (!Number.isNaN(min) && !Number.isNaN(max)) {
+        return stand >= min && stand <= max
+      }
+    }
+    return key === takeOffStand
+  })
+  let { warning, alarm } = subMap[matchedKey ?? 'all'] ?? {}
+  if (typeof warning === 'number') {
+    warning *= 60 * 1000
+  } else {
+    warning = null
+  }
+  if (typeof alarm === 'number') {
+    alarm *= 60 * 1000
+  } else {
+    alarm = null
+  }
+  return {
+    warning,
+    alarm,
+  }
+}
+
 export function useTableStyle(tableName?: string) {
   const rowClass = ({ row, rowIndex }) => {
     const classes: string[] = []
@@ -119,6 +156,44 @@ export function useTableStyle(tableName?: string) {
           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')
+        }
+      }
+
+      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
+        ) {
+          classes.push('cell-warning')
+        }
+      }
     }
 
     if (tableName?.includes('FlightContainer')) {

+ 2 - 0
typings/global.d.ts

@@ -13,6 +13,8 @@ declare global {
   declare var SERVICE_ID: any
   declare var NODE_CODE: any
   declare var MESSAGE_TYPE: any
+  declare var LOAD_WARNING_MAP: any
+  declare var HANDOVER_WARNING_MAP: any
 }
 
 export {}