Преглед на файлове

运单节点跟踪-时间格式修改

zhongxiaoyu преди 2 години
родител
ревизия
027ee035bd
променени са 3 файла, в които са добавени 27 реда и са изтрити 9 реда
  1. 10 2
      src/views/realTime/components/WaybillView/index.vue
  2. 4 4
      src/views/realTime/hooks/useTable.ts
  3. 13 3
      src/views/realTime/hooks/useTrackData.ts

+ 10 - 2
src/views/realTime/components/WaybillView/index.vue

@@ -172,7 +172,7 @@ const tableData = computed(() => {
   const mergedTableData = trackData.value.reduce(
     (data: CommonData[], current) => {
       const sameRow = data.find(row =>
-        ['stockCode', 'flightNO', 'flightDate', 'cargoSN'].every(
+        ['flightNO', 'flightDate', 'cargoSN'].every(
           key => row[key] === current[key]
         )
       )
@@ -249,7 +249,15 @@ const tableData = computed(() => {
 const formatter: CommonTableFormatter = (row, column, cellValue, index) => {
   const value = String(cellValue ?? '').split('\n')
   if (value[2]) {
-    value[2] = value[2].split('T')[1].slice(0, -3)
+    const [date, time] = value[2].split('T')
+    let clipTime = time.slice(0, -3)
+    if (date !== flightDate) {
+      const days =
+        (new Date(date).getTime() - new Date(flightDate as string).getTime()) /
+        (24 * 60 * 60 * 1000)
+      clipTime += ` (${days > 0 ? '+' : ''}${days})`
+    }
+    value[2] = clipTime
   }
   return value.join('\n')
 }

+ 4 - 4
src/views/realTime/hooks/useTable.ts

@@ -90,7 +90,7 @@ const tableColumnsMap: {
       customRender: ellipsisCell,
     },
     { columnLabel: '运单件数', columnName: 'luggageCount', needCount: 1 },
-    { columnLabel: '货物重量', columnName: 'weight', needCount: 1 },
+    { columnLabel: '运单重量', columnName: 'weight', needCount: 1 },
     { columnLabel: '拉下件数', columnName: 'pullNum', needCount: 1 },
     { columnLabel: '退运件数', columnName: 'returnNum', needCount: 1 },
     { columnLabel: '最新节点', columnName: 'nodeCode' },
@@ -276,7 +276,7 @@ const tableColumnsMap: {
       needCount: 1,
     },
     {
-      columnLabel: '货物重量',
+      columnLabel: '运单重量',
       columnName: 'weight',
       needCount: 1,
     },
@@ -510,7 +510,7 @@ const tableColumnsMap: {
       customRender: ellipsisCell,
     },
     { columnLabel: '运单件数', columnName: 'luggageCount', needCount: 1 },
-    { columnLabel: '货物重量', columnName: 'weight', needCount: 1 },
+    { columnLabel: '运单重量', columnName: 'weight', needCount: 1 },
     { columnLabel: '拉下件数', columnName: 'pullNum', needCount: 1 },
     { columnLabel: '退运件数', columnName: 'returnNum', needCount: 1 },
     { columnLabel: '最新节点', columnName: 'nodeCode' },
@@ -655,7 +655,7 @@ const tableColumnsMap: {
       needCount: 1,
     },
     {
-      columnLabel: '货物重量',
+      columnLabel: '运单重量',
       columnName: 'weight',
       needCount: 1,
     },

+ 13 - 3
src/views/realTime/hooks/useTrackData.ts

@@ -215,6 +215,18 @@ export function useTrackData(name: string, trackData: MaybeRef<CommonData[]>) {
           execTime,
         }
       ) => {
+        let clipTime = ''
+        if (typeof execTime === 'string') {
+          const [date, time] = execTime.split('T')
+          clipTime = time.slice(0, -3)
+          if (date !== flightDate) {
+            const days =
+              (new Date(date).getTime() -
+                new Date(flightDate as string).getTime()) /
+              (24 * 60 * 60 * 1000)
+            clipTime += ` (${days > 0 ? '+' : ''}${days})`
+          }
+        }
         const isDeparture =
           trackNodesMap.departure
             .concat(trackNodesMap.internationalDeparture)
@@ -236,9 +248,7 @@ export function useTrackData(name: string, trackData: MaybeRef<CommonData[]>) {
             String(execPosition ?? ''),
             String(ConsignmentItemPackagingQuantityQuantity ?? ''),
             execResult ? '通过' : '未通过',
-            String(execTime ?? '')
-              .split('T')[1]
-              ?.slice(0, -3) ?? '',
+            clipTime,
           ],
         }
         const nodeList = trackNodesMap[