Browse Source

行李详情页接口参数修改

zhongxiaoyu 3 years ago
parent
commit
fe8aac95fc
1 changed files with 191 additions and 277 deletions
  1. 191 277
      src/views/advancedQuery/views/advancedBag.vue

+ 191 - 277
src/views/advancedQuery/views/advancedBag.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2022-01-17 10:39:22
- * @LastEditTime: 2022-05-03 16:57:24
+ * @LastEditTime: 2022-05-05 11:47:24
  * @LastEditors: your name
  * @Description: 行李视图
 -->
@@ -23,25 +23,37 @@
       </div>
       <div class="part1_info">
         <el-row :gutter="50">
-          <el-col :span="3">行李牌号:{{ infoData.BagSN }}</el-col>
-          <el-col :span="3">特殊行李类型:{{ infoData.SpecialType }}</el-col>
-          <el-col :span="3">旅客姓名:{{ infoData.PassengerNameUpcase }}</el-col>
-          <el-col :span="3">行李异常分类: {{ infoData.bagExcType }}</el-col>
-          <el-col :span="4">企业或团队名称:{{ infoData.TeamOrGroup }}</el-col>
-          <el-col :span="4">PNR: {{ infoData.PNR }}</el-col>
+          <el-col :span="3">行李牌号:{{ baggageBasicInfo.BagSN }}</el-col>
+          <el-col :span="3">特殊行李类型:{{ baggageBasicInfo.SpecialType }}</el-col>
+          <el-col :span="3">旅客姓名:{{ baggageBasicInfo.PassengerNameUpcase }}</el-col>
+          <el-col :span="3">行李异常分类: {{ baggageBasicInfo.bagExcType }}</el-col>
+          <el-col :span="4">企业或团队名称:{{ baggageBasicInfo.TeamOrGroup }}</el-col>
+          <el-col :span="4">PNR: {{ baggageBasicInfo.PNR }}</el-col>
         </el-row>
       </div>
     </div>
     <div class="part2">
       <div class="part2_info">
-        <div style="width: 120px" class="title">行李跟踪信息</div>
-        <div v-if="infoBtn == '跟踪信息'" class="type normal">
-          {{ infoData.BagStatus }}
+        <div
+          style="width: 120px"
+          class="title"
+        >行李跟踪信息</div>
+        <div
+          v-if="infoBtn === '跟踪信息'"
+          class="type normal"
+        >
+          {{ baggageBasicInfo.BagStatus }}
         </div>
-        <div v-if="infoBtn == '跟踪信息'" class="step">
+        <div
+          v-if="infoBtn === '跟踪信息'"
+          class="step"
+        >
           <div class="ddd">
             <div class="stepLine">
-              <div :style="{ width: lineWidth }" class="stepLineBlue" />
+              <div
+                :style="{ width: lineWidth }"
+                class="stepLineBlue"
+              />
             </div>
             <div
               v-for="(item, index) in stepData"
@@ -61,7 +73,11 @@
         </div>
       </div>
       <div class="Btn">
-        <el-button type="primary" icon="el-icon-download" size="mini" />
+        <el-button
+          type="primary"
+          icon="el-icon-download"
+          size="mini"
+        />
         <el-button
           class="setBtn"
           type="primary"
@@ -71,7 +87,10 @@
         />
       </div>
     </div>
-    <div v-if="infoBtn == '跟踪信息'" class="part3">
+    <div
+      v-if="infoBtn == '跟踪信息'"
+      class="part3"
+    >
       <el-table
         ref="table"
         :data="baggageTableData"
@@ -80,7 +99,6 @@
         height="calc(100vh - 81px - 144px - 156px)"
         stripe
         size="mini"
-        :span-method="objectSpanMethod"
         :header-cell-style="{ color: '#101116' }"
       >
         <el-table-column
@@ -95,9 +113,15 @@
       </el-table>
     </div>
 
-    <div v-if="infoBtn == '跟踪报文'" class="part4">
+    <div
+      v-if="infoBtn == '跟踪报文'"
+      class="part4"
+    >
       <template v-if="messageList.length">
-        <el-row :gutter="24" type="flex">
+        <el-row
+          :gutter="24"
+          type="flex"
+        >
           <el-col
             v-for="(message, index) in messageList"
             :key="index"
@@ -121,11 +145,17 @@
         </el-row>
       </template>
       <template v-else>
-        <el-empty :image-size="1" description="暂无数据" />
+        <el-empty
+          :image-size="1"
+          description="暂无数据"
+        />
       </template>
     </div>
     <!--列设置-->
-    <Dialog :flag="dialogFlag" class="dialog-check-cols">
+    <Dialog
+      :flag="dialogFlag"
+      class="dialog-check-cols"
+    >
       <div class="col-dialog">
         <div class="title">列设置</div>
         <div class="content">
@@ -144,49 +174,50 @@
           />
         </div>
         <div class="foot right t30">
-          <el-button size="medium" class="r24" type="primary" @click="onCheck"
-            >确定</el-button
-          >
-          <el-button size="medium" @click="hide">取消</el-button>
+          <el-button
+            size="medium"
+            class="r24"
+            type="primary"
+            @click="onCheck"
+          >确定</el-button>
+          <el-button
+            size="medium"
+            @click="hide"
+          >取消</el-button>
         </div>
       </div>
     </Dialog>
   </div>
 </template>
 <script>
-import Dialog from "@/layout/components/Dialog/index.vue";
-import {
-  nodeinfoes,
-  fulltrackinfoAndNodeInfoList,
-  BaggageMessageQuery,
-} from "@/api/flight";
-import { getQuery } from "@/api/flight";
-import tableColsMixin from "../mixins/tableCols";
+import Dialog from '@/layout/components/Dialog/index.vue'
+import { queryMap, myQuery } from '@/api/dataIntegration'
+import tableColsMixin from '../mixins/tableCols'
 
 export default {
-  name: "BaggageView",
+  name: 'BaggageView',
   components: {
-    Dialog,
+    Dialog
   },
   mixins: [tableColsMixin],
   data() {
     return {
-      departureAirport: "",
-      landingAirport: "",
+      departureAirport: '',
+      landingAirport: '',
       queryData: {},
-      infoData: {
-        BagSN: "3666149457",
+      baggageBasicInfo: {
+        BagSN: '3666149457',
         SpecialType: null,
         PassengerInfoStatus: null,
-        PassengerNameUpcase: "AIJIAMEI",
+        PassengerNameUpcase: 'AIJIAMEI',
         bagExcType: null,
         TeamOrGroup: null,
         PNR: null,
-        BagStatus: null,
+        BagStatus: null
       },
       dialogVisibledele: false,
       active: 2,
-      infoBtn: "跟踪信息",
+      infoBtn: '跟踪信息',
       hasMessageGotten: false,
       messageList: [
         // `BSM
@@ -199,309 +230,192 @@ export default {
         // .W/K/l/0
         // .P/1CUI/DI ENDBSM`
       ],
-      lineWidth: "100%",
+      lineWidth: '100%',
       checkList: [],
       stepData: [
         {
-          NodeNameEN: "CHECKIN",
-          DealTime: null,
+          NodeNameEN: 'CHECKIN',
+          DealTime: null
         },
         {
-          NodeNameEN: "SECURITY",
-          DealTime: null,
+          NodeNameEN: 'SECURITY',
+          DealTime: null
         },
         {
-          NodeNameEN: "SORT",
-          DealTime: null,
+          NodeNameEN: 'SORT',
+          DealTime: null
         },
         {
-          NodeNameEN: "存储",
-          DealTime: null,
+          NodeNameEN: '存储',
+          DealTime: null
         },
         {
-          NodeNameEN: "LOAD",
-          DealTime: null,
+          NodeNameEN: 'LOAD',
+          DealTime: null
         },
         {
-          NodeNameEN: "离港运输",
-          DealTime: null,
+          NodeNameEN: '离港运输',
+          DealTime: null
         },
         {
-          NodeNameEN: "INFL",
-          DealTime: null,
+          NodeNameEN: 'INFL',
+          DealTime: null
         },
         {
-          NodeNameEN: "UNLOAD",
-          DealTime: null,
+          NodeNameEN: 'UNLOAD',
+          DealTime: null
         },
         {
-          NodeNameEN: "进港运输",
-          DealTime: null,
+          NodeNameEN: '进港运输',
+          DealTime: null
         },
         {
-          NodeNameEN: "中转",
-          DealTime: null,
+          NodeNameEN: '中转',
+          DealTime: null
         },
         {
-          NodeNameEN: "SORT",
-          DealTime: null,
+          NodeNameEN: 'SORT',
+          DealTime: null
         },
         {
-          NodeNameEN: "提取",
-          DealTime: null,
+          NodeNameEN: '提取',
+          DealTime: null
         },
         {
-          NodeNameEN: "LOAD",
-          DealTime: null,
+          NodeNameEN: 'LOAD',
+          DealTime: null
         },
         {
-          NodeNameEN: "INFL",
-          DealTime: null,
+          NodeNameEN: 'INFL',
+          DealTime: null
         },
         {
-          NodeNameEN: "OFFLOAD",
-          DealTime: null,
+          NodeNameEN: 'OFFLOAD',
+          DealTime: null
         },
         {
-          NodeNameEN: "ARRIVED",
-          DealTime: null,
-        },
+          NodeNameEN: 'ARRIVED',
+          DealTime: null
+        }
       ],
       tableCols: [
         {
-          name: "航班号",
-          prop: "FlightNO",
-          align: "center",
+          name: '航班号',
+          prop: 'FlightNO',
+          align: 'center'
         },
-        { name: "航班日期", prop: "FlightDate", align: "center" },
+        { name: '航班日期', prop: 'FlightDate', align: 'center' },
         {
-          name: "起飞航站/预计起飞时间",
-          prop: "PlanDepartureTime",
-          align: "center",
+          name: '起飞航站/预计起飞时间',
+          prop: 'PlanDepartureTime',
+          align: 'center'
         },
         {
-          name: "目的航站/预计降落时间",
-          prop: "PlanLandingTime",
-          align: "center",
-          sortable: "custom",
+          name: '目的航站/预计降落时间',
+          prop: 'PlanLandingTime',
+          align: 'center',
+          sortable: 'custom'
         },
-        { name: "旅客仓位", prop: "Canbin", align: "center" },
-        { name: "旅客座位号", prop: "SeatNO", align: "center" },
-        { name: "值机序号", prop: "CheckInNO", align: "center" },
-        { name: "节点标识", prop: "NodeCode", align: "center" },
-        { name: "节点名称", prop: "NodeName", align: "center" },
-        { name: "位置码", prop: "LocationMark", align: "center" },
-        { name: "位置描述", prop: "RemarkCN", align: "center" },
-        { name: "读取时间", prop: "DealTime", align: "center" },
-        { name: "结果", prop: "DealResult", align: "center" },
-        { name: "次级代码", prop: "SecondCode", align: "center" },
-        { name: "操作人", prop: "creator", align: "center" },
-        { name: "设备ID", prop: "DeviceCode", align: "center" },
-        { name: "发往位置", prop: "ToPlaceCode", align: "center" },
-        { name: "位置描述", prop: "ToPlaceMark", align: "center" },
-        { name: "装载序号", prop: "LoadSN", align: "center" },
-        { name: "容器编号", prop: "containerNumber", align: "center" }, //容器编号
-        { name: "报文", prop: "ResourceFile", align: "center" },
+        { name: '旅客仓位', prop: 'Canbin', align: 'center' },
+        { name: '旅客座位号', prop: 'SeatNO', align: 'center' },
+        { name: '值机序号', prop: 'CheckInNO', align: 'center' },
+        { name: '节点标识', prop: 'NodeCode', align: 'center' },
+        { name: '节点名称', prop: 'NodeName', align: 'center' },
+        { name: '位置码', prop: 'LocationMark', align: 'center' },
+        { name: '位置描述', prop: 'RemarkCN', align: 'center' },
+        { name: '读取时间', prop: 'DealTime', align: 'center' },
+        { name: '结果', prop: 'DealResult', align: 'center' },
+        { name: '次级代码', prop: 'SecondCode', align: 'center' },
+        { name: '操作人', prop: 'creator', align: 'center' },
+        { name: '设备ID', prop: 'DeviceCode', align: 'center' },
+        { name: '发往位置', prop: 'ToPlaceCode', align: 'center' },
+        { name: '位置描述', prop: 'ToPlaceMark', align: 'center' },
+        { name: '装载序号', prop: 'LoadSN', align: 'center' },
+        { name: '容器编号', prop: 'containerNumber', align: 'center' },
+        { name: '报文', prop: 'ResourceFile', align: 'center' }
       ],
       baggageTableData: [],
       spanArr: [],
-      pos: 0,
-    };
+      pos: 0
+    }
   },
   watch: {
     infoBtn(val) {
-      if (val === "跟踪报文" && !this.hasMessageGotten) {
-        const { BagSN: bagNo, FlightNO: flightNo, FlightDate: flightDate } = this.queryData;
-        const params = { flightNo, flightDate, bagNo };
-        this.baggageMessageQuery(params);
+      if (val === '跟踪报文') {
+        const { BagSN: bagNo, FlightNO: flightNo, FlightDate: flightDate } = this.queryData
+        const params = { flightNo, flightDate, bagNo }
+        this.baggageMessageQuery(params)
       }
-    },
+    }
   },
-  created() {
-    this.queryData = this._.cloneDeep(this.$route.query);
+  mounted() {
+    this.queryData = this._.cloneDeep(this.$route.query)
     // console.log(this.queryData)
-    const { BagSN: bagNo, FlightNO: flightNO, FlightDate: flightDate } = this.queryData
-    // const nodeData = { bagNo, flightNO, flightDate }
-    // this.baggageTableColumnCheckList = this._.cloneDeep(this.baggageTableColumn)
-    // this.getNodeinfoes(nodeData);
-    // this.getFulltrackinfoAndNodeInfoList(nodeData);
-    // const id = 3666149457;
-    this.baggageDetails(bagNo);
-    this.baggageTrack(bagNo);
-    this.baggageDatas(bagNo);
+    this.queryBaggageAll()
   },
   methods: {
-    async getFulltrackinfoAndNodeInfoList(data) {
-      try {
-        const result = await fulltrackinfoAndNodeInfoList(data);
-        if (result.returnData.length > 0) {
-          this.departureAirport = result.returnData[0].departureAirport;
-          this.landingAirport = result.returnData[0].landingAirport;
-        }
-        // result.returnData.forEach((item) => {
-        //   item["start"] = item.departureAirport + "\n" + item.departureTime;
-        //   item["end"] = item.landingAirport + "\n" + item.landingTime;
-        //   item["dealTime"] = item.dealTime.split("T")[1];
-        // });
-        this.baggageTableData = this._.cloneDeep(result.returnData);
-        for (var i = 0; i < this.baggageTableData.length; i++) {
-          if (i === 0) {
-            this.spanArr.push(1);
-            this.pos = 0;
-          } else {
-            // 判断当前元素与上一个元素是否相同
-            if (
-              this.baggageTableData[i].flightNo ===
-              this.baggageTableData[i - 1].flightNo
-            ) {
-              this.spanArr[this.pos] += 1;
-              this.spanArr.push(0);
-            } else {
-              this.spanArr.push(1);
-              this.pos = i;
-            }
-          }
-          // console.log(this.spanArr)
-        }
-      } catch (error) {
-        console.log(error);
-      }
-    },
-    async getNodeinfoes(data) {
-      try {
-        const result = await nodeinfoes(data);
-        const nodes = this._.cloneDeep(result.returnData);
-        let finalStep = 0;
-        this.stepData.forEach((item, index) => {
-          nodes.forEach((node) => {
-            if (item.nodeCode === node.nodeCode) {
-              item.date = node.realTime.split(" ")[0];
-              item.time = node.realTime.split(" ")[1];
-              finalStep < index + 1 && (finalStep = index + 1);
-            }
-          });
-        });
-        this.lineWidth = (finalStep / 8) * 100 + "%";
-        // console.log(this.stepData)
-      } catch (error) {
-        console.log(error);
-      }
-    },
-    async baggageMessageQuery(params) {
-      try {
-        const result = await BaggageMessageQuery(params);
-        this.hasMessageGotten = true;
-        // console.log(result.returnData)
-        this.messageList = result.returnData;
-      } catch (error) {
-        console.log(error);
-      }
-    },
-    objectSpanMethod({ row, column, rowIndex, columnIndex }) {
-      if (columnIndex < 4) {
-        const _row = this.spanArr[rowIndex];
-        const _col = _row > 0 ? 1 : 0;
-        // console.log(`rowspan:${_row} colspan:${_col}`)
-        return {
-          rowspan: _row,
-          colspan: _col,
-        };
-      }
-    },
+    // objectSpanMethod({ row, column, rowIndex, columnIndex }) {
+    //   if (columnIndex < 4) {
+    //     const _row = this.spanArr[rowIndex]
+    //     const _col = _row > 0 ? 1 : 0
+    //     // console.log(`rowspan:${_row} colspan:${_col}`)
+    //     return {
+    //       rowspan: _row,
+    //       colspan: _col
+    //     }
+    //   }
+    // },
     renderHeader(h, { column, $index }) {
-      const arr = column.label.split("/");
+      const arr = column.label.split('/')
       if (arr.length > 1) {
-        return h("span", {
+        return h('span', {
           attrs: {},
           domProps: {
-            innerHTML: "<span>" + arr[0] + "</span><br>" + arr[1],
-          },
-        });
+            innerHTML: '<span>' + arr[0] + '</span><br>' + arr[1]
+          }
+        })
       } else {
-        return h("span", {
+        return h('span', {
           attrs: {},
           domProps: {
-            innerHTML: "<span>" + arr[0] + "</span>",
-          },
-        });
+            innerHTML: '<span>' + arr[0] + '</span>'
+          }
+        })
       }
     },
-    //行李详情基础信息
-    async baggageDetails(params) {
-      try {
-        const result = await getQuery({
-          id: 60,
-          dataContent: [params],
-        });
-        if (result.code == 0) {
-          this.infoData = result.returnData[0];
-        } else {
-          this.$message.error(result.message);
-        }
-      } catch (error) {
-        console.log(error);
-      }
+    // 行李详情基础信息
+    queryBaggageBasicInfo(dataContent) {
+      return myQuery(queryMap.baggageBasicInfoByID, ...dataContent)
     },
-    //行李详情追踪链
-    async baggageTrack(params) {
-      try {
-        const result = await getQuery({
-          id: 61,
-          dataContent: [params],
-        });
-        if (result.code == 0) {
-          this.stepData = result.returnData;
-        } else {
-          this.$message.error(result.message);
-        }
-      } catch (error) {
-        console.log(error);
-      }
+    // 行李详情追踪链
+    queryBaggageTrack(dataContent) {
+      return myQuery(queryMap.baggageTrackByID, ...dataContent)
     },
-    //行李详情表格
-    async baggageDatas(params) {
+    // 行李详情表格
+    queryBaggageDetails(dataContent) {
+      return myQuery(queryMap.baggageDetailsByID, ...dataContent)
+    },
+    async queryBaggageAll(queryData = this.queryData) {
+      const { BagSN, FlightDate, FlightNO } = queryData
+      const dataContent = [BagSN, FlightDate, FlightNO]
       try {
-        const result = await getQuery({
-          id: 62,
-          dataContent: [params],
-        });
-        if (result.code == 0) {
-          if (result.returnData.length > 0) {
-            this.departureAirport = result.returnData[0].departureAirport;
-            this.landingAirport = result.returnData[0].landingAirport;
-          }
-          this.baggageTableData = result.returnData.map((item) => {
-            item["DealTime"] = item.DealTime.split("T")[1];
-            return item;
-          });
-          for (var i = 0; i < this.baggageTableData.length; i++) {
-            if (i === 0) {
-              this.spanArr.push(1);
-              this.pos = 0;
-            } else {
-              // 判断当前元素与上一个元素是否相同
-              if (
-                this.baggageTableData[i].flightNo ===
-                this.baggageTableData[i - 1].flightNo
-              ) {
-                this.spanArr[this.pos] += 1;
-                this.spanArr.push(0);
-              } else {
-                this.spanArr.push(1);
-                this.pos = i;
-              }
-            }
-            // console.log(this.spanArr)
-          }
-        } else {
-          this.$message.error(result.message);
-        }
+        const [baggageBasicInfo, baggageTrack, baggageDetails] = await Promise.all([
+          this.queryBaggageBasicInfo(dataContent),
+          this.queryBaggageTrack(dataContent),
+          this.queryBaggageDetails(dataContent)
+        ])
+        baggageBasicInfo.length && (this.baggageBasicInfo = baggageBasicInfo[0])
+        baggageTrack.length && (this.stepData = baggageTrack)
+        this.baggageTableData = baggageDetails.map(item => {
+          item['DealTime'] = item['DealTime'].split('T')[1]
+          return item
+        })
       } catch (error) {
-        console.log(error);
+        console.log('错误', error)
       }
-    },
-  },
-};
+    }
+  }
+}
 </script>
 <style lang="scss">
 .radioBtn {