Pārlūkot izejas kodu

行李报文过滤

zhongxiaoyu 2 gadi atpakaļ
vecāks
revīzija
feff765644

+ 11 - 3
src/views/baggageManagement/components/baggage/index.vue

@@ -844,9 +844,17 @@ export default {
       const dataContent = [flightNO, flightDate, bagSN]
       try {
         const result = await this.queryBaggageMessage(dataContent)
-        const messageList = result.map(message => {
-          return typeof message === 'string' ? JSON.parse(message) : message
-        })
+        // const messageList = result.map(message => {
+        //   return typeof message === 'string' ? JSON.parse(message) : message
+        // })
+        const messageList = result.reduce((list, message) => {
+          const messageObject = typeof message === 'string' ? JSON.parse(message) : message
+          if (messageObject.dataContent.includes(bagSN.slice(0, 7))) {
+            return [...list, messageObject]
+          } else {
+            return list
+          }
+        }, [])
         this.messageList = this._.sortBy(messageList, 'ssid')
       } catch (error) {
         console.log('出错了', error.message || error)