Browse Source

航站视图-航班类型筛选修改

zhongxiaoyu 2 years ago
parent
commit
67a8ff4008

+ 8 - 1
src/views/realTime/components/AirportView/index.vue

@@ -373,7 +373,14 @@ watch(
     }
   }
 )
-watch(tableData, async () => {
+const flightTypeMap = ['货机', '客机', '其他']
+watch(tableData, async data => {
+  data.forEach(row => {
+    row.flightType =
+      typeof row.flightType === 'number'
+        ? flightTypeMap[row.flightType] ?? '其他'
+        : '其他'
+  })
   await nextTick()
   if (hasSetTableScroll.value || !finishedCount.value) {
     return

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

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