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

航班视图-基础信息修改

zhongxiaoyu 1 жил өмнө
parent
commit
7f999af6f5

+ 12 - 15
src/views/realTime/components/FlightView/useFlightInfo.ts

@@ -1,6 +1,7 @@
 import { CommonData, CommonValue } from '~/common'
 import { Query } from '@/api/webApi'
 import { ElMessage } from 'element-plus'
+import _ from 'lodash'
 
 const flightTypeMap = ['货机', '客机', '其他']
 const flightStateMap = {
@@ -188,11 +189,21 @@ export function useFlightInfo(name: string, dataContent: CommonValue[]) {
     }[][]
   >([])
   const getFlightInfoItems = () => {
-    flightInfoItems.value =
+    flightInfoItems.value = _.cloneDeep(
       flightInfoItemsMap[name.includes('Departure') ? 'departure' : 'arrival']
+    )
   }
   getFlightInfoItems()
 
+  const proxyItem = {
+    label: '机场代理',
+    key: 'proxy',
+    getter: info => (info.proxy === 1 ? '是' : '否'),
+  }
+  if (name.includes('International')) {
+    flightInfoItems.value[0].push(proxyItem)
+  }
+
   const flightInfo: CommonData = reactive({})
   const getFlightInfo = async () => {
     try {
@@ -276,20 +287,6 @@ export function useFlightInfo(name: string, dataContent: CommonValue[]) {
     }
   })
 
-  const proxyItem = {
-    label: '机场代理',
-    key: 'proxy',
-    getter: info => (info.proxy === 1 ? '是' : '否'),
-  }
-  onBeforeMount(() => {
-    if (
-      name.includes('International') &&
-      !flightInfoItems.value[0].find(item => item.key === 'proxy')
-    ) {
-      flightInfoItems.value[0].push(proxyItem)
-    }
-  })
-
   return {
     flightInfoItems,
     flightInfo,