瀏覽代碼

航站视图、航班视图-航班类型、航班状态

zhongxiaoyu 2 年之前
父節點
當前提交
8a01a0e90e

+ 3 - 1
src/views/dataQuery/components/DataQueryView/index.vue

@@ -376,7 +376,9 @@ const formatter: CommonTableFormatter = (row, column, cellValue, index) => {
     return value ? flightStateMap[value] ?? '正常' : '正常'
   }
   if (column.property === 'flightType') {
-    return typeof cellValue === 'number' ? flightTypeMap[cellValue] : '其他'
+    return typeof cellValue === 'number'
+      ? flightTypeMap[cellValue] ?? '其他'
+      : '其他'
   }
   return value
 }

+ 7 - 0
src/views/realTime/components/AirportView/useFormatter.ts

@@ -7,6 +7,8 @@ export function useFormatter(flag: Ref<boolean>) {
     return unref(flag) ? columnLabel : columnLabel.replace('/件', '')
   }
 
+  const flightTypeMap = ['客机', '货机', '其他']
+
   const tableDataFormatter: CommonTableFormatter = (
     row,
     { label, property },
@@ -55,6 +57,11 @@ export function useFormatter(flag: Ref<boolean>) {
     if (property === 'jiahuo') {
       return cellValue ? '是' : '否'
     }
+    if (property === 'flightType') {
+      return typeof cellValue === 'number'
+        ? flightTypeMap[cellValue] ?? '其他'
+        : '其他'
+    }
     return String(cellValue ?? '')
   }
 

+ 28 - 2
src/views/realTime/components/FlightView/useFlightInfo.ts

@@ -2,6 +2,12 @@ import { CommonData, CommonValue } from '~/common'
 import { Query } from '@/api/webApi'
 import { ElMessage } from 'element-plus'
 
+const flightTypeMap = ['客机', '货机', '其他']
+const flightStateMap = {
+  CAN: '取消',
+  DLY: '延误',
+}
+
 const flightInfoItemsMap = {
   departure: [
     [
@@ -23,7 +29,17 @@ const flightInfoItemsMap = {
       },
       {
         label: '航班类型',
-        key: 'flightType',
+        getter: info =>
+          typeof info.flightType === 'number'
+            ? flightTypeMap[info.flightType] ?? '其他'
+            : '其他',
+      },
+      {
+        label: '航班状态',
+        getter: info =>
+          info.flightState
+            ? flightStateMap[info.flightState] ?? '正常'
+            : '正常',
       },
       {
         label: '停机位',
@@ -100,7 +116,17 @@ const flightInfoItemsMap = {
       },
       {
         label: '航班类型',
-        key: 'flightType',
+        getter: info =>
+          typeof info.flightType === 'number'
+            ? flightTypeMap[info.flightType] ?? '其他'
+            : '其他',
+      },
+      {
+        label: '航班状态',
+        getter: info =>
+          info.flightState
+            ? flightStateMap[info.flightState] ?? '正常'
+            : '正常',
       },
     ],
     [