Bläddra i källkod

行李详情格式化

zhongxiaoyu 2 år sedan
förälder
incheckning
5873f87a21

+ 2 - 2
src/views/advancedQuery/views/advancedHome.vue

@@ -267,11 +267,11 @@
                     clearable
                   >
                     <el-option
-                      label=""
+                      label="已翻减"
                       :value="1"
                     />
                     <el-option
-                      label=""
+                      label="待翻减"
                       :value="0"
                     />
                   </el-select>

+ 55 - 29
src/views/baggageManagement/components/baggage/index.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2022-01-17 10:39:22
- * @LastEditTime: 2022-05-19 16:39:34
+ * @LastEditTime: 2022-05-20 14:19:57
  * @LastEditors: your name
  * @Description: 行李视图
 -->
@@ -33,8 +33,8 @@
           >
             <span class="label">{{ item.label }}:</span><span
               class="content"
-              :title="baggageBasicInfo[item.content]"
-            >{{ baggageBasicInfo[item.content] }}</span>
+              :title="formattedBaggageInfo(item.prop)"
+            >{{ formattedBaggageInfo(item.prop) }}</span>
           </el-col>
         </el-row>
       </div>
@@ -267,103 +267,103 @@ export default {
       baggageBasicInfoCols: [
         {
           label: '行李牌号',
-          content: 'bagNo'
+          prop: 'bagNo'
         },
         {
           label: '航班号',
-          content: 'FlightNO'
+          prop: 'FlightNO'
         },
         {
           label: '企业或团队名称',
-          content: 'teamOrGroup'
+          prop: 'teamOrGroup'
         },
         {
           label: '值机位置',
-          content: 'checkInLocation'
+          prop: 'checkInLocation'
         },
         {
           label: '特殊行李类型',
-          content: 'specialType'
+          prop: 'specialType'
         },
         {
           label: 'PNR编号',
-          content: 'PNR'
+          prop: 'PNR'
         },
         {
           label: '旅客姓名大写拼音',
-          content: 'name'
+          prop: 'name'
         },
         {
           label: '装载序列号',
-          content: 'loadSequenceIndex'
+          prop: 'loadSequenceIndex'
         },
         {
           label: '总件数',
-          content: 'totalNumber'
+          prop: 'totalNumber'
         },
         {
           label: '总重量',
-          content: 'totalWeight'
+          prop: 'totalWeight'
         },
         {
           label: '尺寸',
-          content: 'size'
+          prop: 'size'
         },
         {
           label: '外部特征描述',
-          content: 'externalCharacterization'
+          prop: 'externalCharacterization'
         },
         {
           label: '常旅客号',
-          content: 'frequentFlyerNumber'
+          prop: 'frequentFlyerNumber'
         },
         {
           label: '常旅客级别',
-          content: 'frequentFlyerClass'
+          prop: 'frequentFlyerClass'
         },
         {
           label: '是否取消值机',
-          content: 'whetherToCancelTheCheckIn'
+          prop: 'whetherToCancelTheCheckIn'
         },
         {
           label: '是否可装载',
-          content: 'isItLoadable'
+          prop: 'isItLoadable'
         },
         {
           label: '是否可运输',
-          content: 'isItTransportable'
+          prop: 'isItTransportable'
         },
         {
           label: '行李激活状态',
-          content: 'activeState'
+          prop: 'activeState'
         },
         {
           label: '无BSM状态',
-          content: 'noBSM'
+          prop: 'noBSM'
         },
         {
           label: '中转标记',
-          content: 'transitSign'
+          prop: 'transitSign'
         },
         {
           label: '速运标记',
-          content: 'expressSign'
+          prop: 'expressSign'
         },
         {
           label: '破损标记',
-          content: 'brokenSign'
+          prop: 'brokenSign'
         },
         {
           label: '投诉标记',
-          content: 'complaintSign'
+          prop: 'complaintSign'
         },
         {
           label: '赔偿标记',
-          content: 'compensationSign'
+          prop: 'compensationSign'
         },
         {
           label: '异常状态',
-          content: 'bagExcType'
+          prop: 'bagExcType'
         }
       ],
       baggageBasicInfo: {},
@@ -445,6 +445,33 @@ export default {
         const message = this.messageTooltipList.find(message => message.resourceFile === resourceFile)
         return message ? `${message.date}\n${message.dataContent.replaceAll(/[\r\n]{2,}/g, '\n')}` : ''
       }
+    },
+    formattedBaggageInfo() {
+      return function (prop) {
+        const value = this.baggageBasicInfo[prop]
+        if ((value ?? '') === '') {
+          return ''
+        } else if (prop === 'transitSign') {
+          return Number(value) === 1 ? '中转' : '非中转'
+        } else if (
+          [
+            'whetherToCancelTheCheckIn',
+            'isItLoadable',
+            'isItTransportable',
+            'activeState',
+            'noBSM',
+            'expressSign',
+            'brokenSign',
+            'complaintSign',
+            'compensationSign',
+            'bagExcType'
+          ].includes(prop)
+        ) {
+          return Number(value) === 1 || String(value) === 'Y' ? '是' : '否'
+        } else {
+          return value
+        }
+      }
     }
   },
   watch: {
@@ -597,7 +624,6 @@ export default {
           this.queryBaggageDetails(new Array(6).fill(dataContent).flat())
         ])
         if (baggageBasicInfo.length) {
-          baggageBasicInfo[0].transitSign = baggageBasicInfo[0].transitSign === 1 ? '非中转' : '中转'
           baggageBasicInfo[0].FlightNO = FlightNO
           this.baggageBasicInfo = baggageBasicInfo[0]
         }