zhaoke 10 сар өмнө
parent
commit
e035f72f90

+ 32 - 5
src/views/newBagDetails/components/baggageMessage.vue

@@ -76,15 +76,16 @@ export default {
           // this.messageList = [...returnData]
           const messageDatas = [...returnData]
           messageDatas.map(item => {
-            const { dataObjectId } = item
+            const { dataObjectId, dataType } = item
+            const other = dataType == ('BSM' || 'bsm') ? '(航信)' : '(BRS)'
             if (dataObjectId && dataObjectId.length) {
               const len = dataObjectId.length
               const popNums = [100, 101, 102].map(item => item.toString())
               const target = dataObjectId.substring(len - 3, len)
-              const place = popNums.includes(target) ? '(国航)' : dataObjectId.substring(len - 5, len) == '10000' ? '(国航)' : '(广州)'
-              item.readTime = item.readTime ? item.readTime.replace('T', ' ') + place : item.readTime
+              const place = popNums.includes(target) ? '(国航)' : dataObjectId.substring(len - 5, len) == '10000' ? '(国航)' : dataObjectId.substring(len - 5, len) == '20021' ? other : other
+              item.readTime = item.readTime ? item.readTime.replace('T', ' ') + place : item.createAt.replace('T', ' ') + place
             } else {
-              item.readTime = item.readTime ? item.readTime.replace('T', ' ') + '(广州)' : item.readTime
+              item.readTime = item.readTime ? item.readTime.replace('T', ' ') + other : item.createAt.replace('T', ' ') + other
             }
           })
           this.messageList = messageDatas
@@ -102,11 +103,37 @@ export default {
         this.$message.error('失败')
       }
     },
+    //初始化数据地址
+    formatTableData (returnData) {
+      const messageDatas = [...returnData]
+      messageDatas.forEach(item => {
+        const { dataObjectId, dataType } = item
+        if (dataObjectId) {
+          const len = dataObjectId.length
+          const place = dataObjectId.substring(len - 5, len) == '20021'
+          if (place) {
+            const bsm = dataType ? `${dataType} `.toLocaleUpperCase() == 'BSM' : false
+            const bpm = dataType ? `${dataType} `.toLocaleUpperCase() == 'BPM' : false
+            if (place && bsm) {
+              item.readTime = item.readTime ? item.readTime.replace('T', ' ') + '航信' : item.readTime
+            }
+            if (place && bpm) {
+              item.readTime = item.readTime ? item.readTime.replace('T', ' ') + 'BRS' : item.readTime
+            }
+          } else {
+            item.readTime = item.readTime ? item.readTime.replace('T', ' ') : item.createAt.replace('T', ' ')
+          }
+        } else {
+          item.readTime = item.readTime ? item.readTime.replace('T', ' ') : item.createAt.replace('T', ' ')
+        }
+      })
+      return messageDatas
+    },
     exportMessageToExcel () {
       const xlsxDatas = [['Date & Time', 'Message']]
       xlsxDatas.push(
         ...this.messageList.map(message => [
-          message.readTime,
+          message.readTime || message.createAt.replace('T', ' '),
           message.sourceData.replaceAll('n', '\n').replaceAll('r', '').replaceAll('\\', '').replaceAll('"', '')
           // message.sourceData.replaceAll(/[\\r\\n]{2,}/g, '\n').replaceAll('\\', '')
         ])