瀏覽代碼

中转管理添加报警预警

zhaoke 2 年之前
父節點
當前提交
0d0a2b9bac

+ 119 - 3
src/views/baggageManagement/components/transferDeparture/index.vue

@@ -148,9 +148,11 @@ import formMixin from "../../mixins/form";
 import tableColsMixin from "../../mixins/tableCols";
 import timeZoneMixin from "../../mixins/timeZone";
 import { getQuery } from "@/api/flight";
+import { GeneralDataReception } from "@/api/dataIntegration";
 import TableHeaderCell from "@/components/TableHeaderCell";
-import { setTableFilters, throttledExportToExcel } from "@/utils/table";
-
+import { setTableFilters, throttledExportToExcel, timeInZone } from "@/utils/table";
+import { parseTime } from '@/utils/index';
+import { mapGetters } from 'vuex';
 export default {
   name: "DepartureTerminalView",
   components: { Dialog, TimeZoneSelector, TableHeaderCell },
@@ -327,12 +329,14 @@ export default {
       contactDot: 0,
       flag: 0,
       table: null,
+      WarningData: []
     };
   },
   computed: {
     singleDay () {
       return this.startDate === this.endDate;
     },
+    ...mapGetters(['timeZone'])
   },
   created () {
     // this.getAirPortData()
@@ -348,6 +352,7 @@ export default {
   },
   activated () {
     this.table.scrollTop = this.scrollTop;
+    this.getWarningData();
     this.getTableData();
     this.loopEvent = setInterval(this.getTableData, LOOP_INTERVAL.transferDepartureTable);
     // const { startDate, endDate } = this.$route.query
@@ -376,6 +381,22 @@ export default {
     }
   },
   methods: {
+    async getWarningData () {
+      try {
+        const res = await getQuery({
+          id: DATACONTENT_ID.departureWarningId,
+          dataContent: [],
+        });
+        if (Number(res.code) === 0) {
+          const { listValues } = res.returnData;
+          this.WarningData = listValues;
+        } else {
+          this.$message.error(res.message);
+        }
+      } catch (error) {
+        this.$message.error("失败");
+      }
+    },
     resetLoopEvent () {
       this.loading = true;
       this.hasSetTableScroll = false;
@@ -441,7 +462,7 @@ export default {
           this.$message.error(res.message);
         }
       } catch (error) {
-this.$message.error("失败");
+        this.$message.error("失败");
       }
     },
     // 选择航司
@@ -529,12 +550,50 @@ this.$message.error("失败");
       }
     },
     initTableData (tableData) {
+      const currentTime = new Date();
+      const curTime = this.formatTime(currentTime);
       this.leaveCount = 0;
       this.baggageCount = 0;
+
       tableData.forEach((item) => {
         if (this.hasTakeOff(item)) {
           this.leaveCount++;
         }
+        if (!item["hasTakeOff"] && item["outTransferBaggageCount"] - item["outTransferredBaggageCount"] > 0) {
+          this.WarningData.forEach(p => {
+            const startTime = this.formatTime(timeInZone((p.startDate ?? '').replace('T', ' '), this.timeZone), 2);
+            const endTime = this.formatTime(timeInZone((p.endDate ?? '').replace('T', ' '), this.timeZone), 2);
+            const planTime = this.formatTime(timeInZone((item.actualDepartureTime ?? '').replace('T', ' '), this.timeZone), 2);
+            const capTime = Math.ceil((planTime - curTime) / (1000 * 60));
+            if (Number(startTime) - Number(curTime) < 0 && Number(endTime) - Number(curTime) > 0) {
+              if (p.flightNO != '' && p.flightNO == item.flightNO) {
+                if (capTime - p.warningDuration < 0 && capTime - p.alarmDuration > 0) {
+                  item["warningState"] = 1;
+                  const returnedTarget = Object.assign(item, p);
+                  this.sendLog(returnedTarget);
+                }
+                if (capTime - p.alarmDuration < 0) {
+                  item["warningState"] = 2;
+                  const returnedTarget = Object.assign(item, p);
+                  this.sendLog(returnedTarget);
+                }
+              } else if (p.flightNO == '' && p.IATACode != '') {
+                if (item.flightNO.substring(0, 2) == p.IATACode) {
+                  if (capTime - p.warningDuration < 0 && capTime - p.alarmDuration > 0) {
+                    item["warningState"] = 1;
+                    const returnedTarget = Object.assign(item, p);
+                    this.sendLog(returnedTarget);
+                  }
+                  if (capTime - p.alarmDuration < 0) {
+                    item["warningState"] = 2;
+                    const returnedTarget = Object.assign(item, p);
+                    this.sendLog(returnedTarget);
+                  }
+                }
+              }
+            }
+          })
+        }
         this.baggageCount = this.baggageCount + item.outTransferBaggageCount;
       });
       this.tableData = this._.sortBy(tableData, ["actualDepartureTime", "flightNO", "actualLandingTime", "preFlightNO"]);
@@ -544,6 +603,35 @@ this.$message.error("失败");
         this.setTableScroll();
       });
     },
+    formatTime (date, type = 1) {
+      let time = null;
+      if (type == 1) {
+        time = parseTime(date, "{y}-{m}-{d} {h}:{i}:{s}");
+      } else {
+        time = date;
+      }
+      const newTimt = new Date(time);
+      return newTimt.getTime();
+    },
+    async sendLog (obj) {
+      try {
+        const newObj = {
+          logTime: parseTime(new Date(), "{y}-{m}-{d} {h}:{i}:{s}"),
+          logInfo: obj,
+          flightNO: obj.flightNO,
+          flightDate: obj.flightDate,
+          luggageSN: '',
+          strategyUseID: obj.alarmStrategyID,
+          event: 1
+        }
+        await GeneralDataReception({
+          serviceId: SERVICE_ID.departureScId,
+          dataContent: JSON.stringify(newObj),
+        });
+      } catch (error) {
+        this.$message.error("失败");
+      }
+    },
     hasTakeOff (flight) {
       if (flight.actualDepartureTime) {
         const now = new Date();
@@ -793,6 +881,34 @@ this.$message.error("失败");
         }
       }
     }
+    td.cell-tounLoad {
+      background: lightcoral !important;
+      position: relative;
+      &::after {
+        content: "";
+        display: block;
+        width: 100%;
+        height: 100%;
+        position: absolute;
+        top: 0;
+        left: 0;
+        border: 2px dashed red;
+      }
+    }
+    td.cell-tounLoadNew {
+      background: #fcf0b1 !important;
+      position: relative;
+      &::after {
+        content: "";
+        display: block;
+        width: 100%;
+        height: 100%;
+        position: absolute;
+        top: 0;
+        left: 0;
+        border: 2px dashed #e28913;
+      }
+    }
     .el-table__cell.is-hidden > * {
       visibility: visible;
     }

+ 9 - 0
src/views/baggageManagement/mixins/terminal.js

@@ -250,6 +250,15 @@ export default {
       if (column.property === 'warning' && row['warningState'] && row['warningState'] == 1) {
         classes.push('cell-tounLoadNew')
       }
+      if (column.property === 'outTransferredBaggageCount' && row['warningState'] && row['warningState'] == 2) {
+        classes.push('cell-tounLoad')
+      }
+      if (column.property === 'outTransferredBaggageCount' && row['warningState'] && row['warningState'] == 1) {
+        classes.push('cell-tounLoadNew')
+      }
+      if (column.property === 'outTransferBaggageCount' && row['sharpSign']) {
+        classes.push('cell-tounLoadNew')
+      }
       return classes.join(' ')
     },
     cellClickHandler (row, column, cell, event) {