Kaynağa Gözat

实时视图-安检节点数据替换

zhongxiaoyu 2 yıl önce
ebeveyn
işleme
64c5315770

+ 13 - 4
src/views/realTime/components/AirportView/useAirportTable.ts

@@ -914,10 +914,19 @@ export function useAirportTable(name: string, formData: CommonData) {
       //   align: 'center',
       //   ...column,
       // }))
-      tableData.value = listValues.map(row => ({
-        ...row,
-        rowKey: `${row.IATACode}-${row.flightNO}-${row.flightDate}`,
-      }))
+      tableData.value = listValues.map(row => {
+        if (name === 'DepartureAirport') {
+          row.securityYes =
+            typeof row.addCargo === 'string'
+              ? row.addCargo.split('/').slice(0, 2).join('/')
+              : null
+          row.securityTime = row.addCargoTime
+        }
+        return {
+          ...row,
+          rowKey: `${row.IATACode}-${row.flightNO}-${row.flightDate}`,
+        }
+      })
     } catch (error) {
       console.error(error)
     }

+ 19 - 2
src/views/realTime/hooks/useTrackData.ts

@@ -32,7 +32,8 @@ const trackNodesMap = {
     // },
     {
       name: '安检',
-      nodeCode: '安检', // 暂无
+      // nodeCode: '安检',
+      nodeCode: 'SECURITY', // 临时-复制加货
     },
     {
       name: '加货',
@@ -199,9 +200,25 @@ const trackNodesMap = {
 export function useTrackData(name: string, trackData: MaybeRef<CommonData[]>) {
   const isInternational = name.includes('International')
 
+  const computedTrackData = computed(() => {
+    if (name !== 'DepartureWaybill') {
+      return unref(trackData)
+    }
+    return unref(trackData).reduce((prevData, currentNode) => {
+      if (currentNode.nodeCode === 'ACC_BUP') {
+        return [
+          ...prevData,
+          currentNode,
+          { ...currentNode, nodeCode: 'SECURITY' },
+        ]
+      }
+      return [...prevData, currentNode]
+    }, [] as CommonData[])
+  })
+
   const trackAirlines = ref<TrackAirline[]>([])
   const getTrackAirlines = () => {
-    const airlines = unref(trackData).reduce(
+    const airlines = unref(computedTrackData).reduce(
       (
         airlines,
         {