浏览代码

Merge branch 'master' of http://120.26.64.82:3000/BFFE/CABaggageData2.0

chenrui  2 年之前
父节点
当前提交
7b7b0e245c
共有 2 个文件被更改,包括 208 次插入77 次删除
  1. 146 43
      src/views/baggageManagement/components/flight/index.vue
  2. 62 34
      src/views/baggageManagement/mixins/terminal.js

+ 146 - 43
src/views/baggageManagement/components/flight/index.vue

@@ -14,7 +14,8 @@
           <!-- <BackButton /> -->
         </div>
         <div class="part1-wrapper">
-          <div class="airline">{{ queryData.flightNO }}
+          <div class="airline">
+            {{ queryData.flightNO }}
             <el-select
               v-model="selectedAirline"
               size="mini"
@@ -68,18 +69,14 @@
                   :sm="24"
                   :xl="12"
                 >
-                  <span>
-                    日期:{{ flightInfo.planDepartureTime && flightInfo.planDepartureTime.split("T")[0] }}
-                  </span>
+                  <span> 日期:{{ flightInfo.planDepartureTime && flightInfo.planDepartureTime.split('T')[0] }} </span>
                 </el-col>
                 <el-col
                   :xs="24"
                   :sm="24"
                   :xl="12"
                 >
-                  <span>
-                    时间:{{ flightInfo.planDepartureTime && flightInfo.planDepartureTime.split("T")[1] }}
-                  </span>
+                  <span> 时间:{{ flightInfo.planDepartureTime && flightInfo.planDepartureTime.split('T')[1] }} </span>
                 </el-col>
               </el-row>
               <el-row>
@@ -231,18 +228,14 @@
                   :sm="24"
                   :xl="12"
                 >
-                  <span>
-                    日期:{{ flightInfo.expectLandingTime && flightInfo.expectLandingTime.split("T")[0] }}
-                  </span>
+                  <span> 日期:{{ flightInfo.expectLandingTime && flightInfo.expectLandingTime.split('T')[0] }} </span>
                 </el-col>
                 <el-col
                   :xs="24"
                   :sm="24"
                   :xl="12"
                 >
-                  <span>
-                    时间:{{ flightInfo.expectLandingTime && flightInfo.expectLandingTime.split("T")[1] }}
-                  </span>
+                  <span> 时间:{{ flightInfo.expectLandingTime && flightInfo.expectLandingTime.split('T')[1] }} </span>
                 </el-col>
               </el-row>
               <el-row>
@@ -289,7 +282,7 @@
             src="@/assets/baggage/ic_export.png"
             title="导出"
             @click="exportHandler('containerTable', '航班容器列表')"
-          >
+          />
         </div>
         <el-table
           ref="containerTable"
@@ -414,7 +407,7 @@
             <el-cascader
               v-model="selectedFilter"
               :options="filterSelectOptions"
-              :props="{ expandTrigger:'hover', checkStrictly: true }"
+              :props="{ expandTrigger: 'hover', checkStrictly: true }"
               size="mini"
               placeholder="无"
               clearable
@@ -426,13 +419,13 @@
             src="@/assets/baggage/ic_export.png"
             title="导出"
             @click="exportHandler('flightBaggageTable', '航班行李列表')"
-          >
+          />
           <img
             class="btn-square btn-shadow"
             src="@/assets/baggage/ic_setting.png"
             title="列设置"
             @click="show"
-          >
+          />
         </div>
         <el-table
           ref="flightBaggageTable"
@@ -489,7 +482,7 @@
             :default-expand-all="true"
             :props="{
               label: 'label',
-              children: 'children',
+              children: 'children'
             }"
             :default-checked-keys="checkedKeysTemp"
             @check="handleCheck"
@@ -501,11 +494,13 @@
             class="r24"
             type="primary"
             @click="onCheck('flightBaggageTableData')"
-          >确定</el-button>
+            >确定</el-button
+          >
           <el-button
             size="medium"
             @click="hide"
-          >取消</el-button>
+            >取消</el-button
+          >
         </div>
       </div>
     </Dialog>
@@ -522,6 +517,7 @@ import TableHeaderCell from '@/components/TableHeaderCell'
 import { setTableFilters } from '@/utils/table'
 import { mapGetters } from 'vuex'
 import { throttledExportToExcel } from '@/utils/table'
+import { parseTime } from '@/utils'
 
 export default {
   name: 'FlightView',
@@ -574,7 +570,7 @@ export default {
       selectedAirline: '',
       queryData: {},
       flightInfo: {},
-      keyWords: '',
+      warningRules: [],
       containerTableColumn: [
         { label: '容器编号', prop: 'containerNumber', width: 100 },
         { label: '类型', prop: 'style' },
@@ -631,14 +627,37 @@ export default {
         },
         { label: '装载序号', prop: 'LoadSN' },
         { label: '值机', prop: 'checkInTime', width: 140 },
-        { label: '状态', prop: 'latestStatus', filterable: true, sortable: true },
+        {
+          label: '状态',
+          prop: 'latestStatus',
+          filterable: true,
+          sortable: true
+        },
         { label: '安检', prop: 'securityTime', width: 140 },
         { label: '分拣', prop: 'sortTime', width: 140 },
         { label: '装车', prop: 'loadTime', width: 140 },
         { label: '装机', prop: 'inflTime', width: 140 },
-        { label: '中转进航班', prop: 'inFlightNO', filterable: true, sortable: true, width: 105 },
-        { label: '中转出航班', prop: 'transferFlightNO', filterable: true, sortable: true, width: 105 },
-        { label: '卷宗号', prop: 'fileNumber', filterable: true, sortable: true, width: 100 }
+        {
+          label: '中转进航班',
+          prop: 'inFlightNO',
+          filterable: true,
+          sortable: true,
+          width: 105
+        },
+        {
+          label: '中转出航班',
+          prop: 'transferFlightNO',
+          filterable: true,
+          sortable: true,
+          width: 105
+        },
+        {
+          label: '卷宗号',
+          prop: 'fileNumber',
+          filterable: true,
+          sortable: true,
+          width: 100
+        }
       ],
       containerTableData: [], // 容器统计
       transferInBaggageTableData: [], // 中转进
@@ -720,6 +739,14 @@ export default {
           label: '无BSM',
           value: 'NOBSM' // 1/0
         },
+        {
+          label: '预警',
+          value: 'warning'
+        },
+        {
+          label: '报警',
+          value: 'alarm'
+        },
         {
           label: '中转进航班',
           value: 'inFlightNO',
@@ -741,35 +768,77 @@ export default {
       if (!key) {
         return this.flightBaggageTableData
       }
-      return this.flightBaggageTableData.filter(item => {
+      const that = this
+      function isWarning(row) {
+        if (row['STATUS'] === 'I' || row['loadTime'] || row['isDEL'] === 'DEL') {
+          return 0
+        }
+        const planDepartureTime = that.flightInfo.planDepartureTime
+        if (!planDepartureTime) {
+          return 0
+        }
+        const currentTime = new Date().getTime()
+        const departureTime = new Date(planDepartureTime.replace('T', ' ')).getTime()
+        if (currentTime > departureTime) {
+          return 0
+        }
+
+        let flag = 0
+        const duration = departureTime - currentTime
+        that.warningRules.some(rule => {
+          if (!rule.startDate || !rule.endDate) {
+            return false
+          }
+          const ruleStartTime = new Date(rule.startDate).getTime()
+          const ruleEndTime = new Date(rule.endDate).getTime()
+          if (currentTime < ruleStartTime || currentTime > ruleEndTime) {
+            return false
+          }
+          if (rule.alarmDuration && duration < alarmDuration * 60 * 1000) {
+            flag = 1
+            return true
+          } else if (rule.warningDuration && duration < rule.warningDuration * 60 * 1000) {
+            flag = 2
+            return true
+          } else {
+            return false
+          }
+        })
+        return flag
+      }
+      return this.flightBaggageTableData.filter(row => {
         switch (key) {
           case 'arrivedID':
           case 'unloadID':
           case 'NOBSM':
-            return item[key] === 1
+            return row[key] === 1
           case 'unActive':
-            return item['STATUS'] === 'I'
+            return row['STATUS'] === 'I'
           case 'preLoad':
-            return item['STATUS'] !== 'I' && item['isDEL'] !== 'DEL'
+            return row['STATUS'] !== 'I' && row['isDEL'] !== 'DEL'
           case 'loaded':
-            return item['loadTime'] && item['isDEL'] !== 'DEL'
+            return row['loadTime'] && row['isDEL'] !== 'DEL'
           case 'destination':
-            return item['arrivedID'] === 1 && !item['transferFlightNO']
+            return row['arrivedID'] === 1 && !row['transferFlightNO']
           case 'inContainer':
-            return item['U_Device_ID'] && item['U_Device_ID'] !== 'FBULK'
+            return row['U_Device_ID'] && row['U_Device_ID'] !== 'FBULK'
           case 'FBULK':
-            return item['U_Device_ID'] === 'FBULK'
+            return row['U_Device_ID'] === 'FBULK'
           case 'toUnload':
-            return (item['loadTime'] || item['inflTime']) && item['isDEL'] === 'DEL' && item['waitOFF'] === 1
+            return (row['loadTime'] || row['inflTime']) && row['isDEL'] === 'DEL' && row['waitOFF'] === 1
           case 'unloaded':
-            return (item['loadTime'] || item['inflTime']) && item['isDEL'] === 'DEL' && item['waitOFF'] !== 1
+            return (row['loadTime'] || row['inflTime']) && row['isDEL'] === 'DEL' && row['waitOFF'] !== 1
           case 'canceled':
-            return item['isDEL'] === 'DEL'
+            return row['isDEL'] === 'DEL'
           case 'inFlightNO':
           case 'transferFlightNO':
-            return value ? item[key] === value : (item[key] ?? '') !== ''
+            return value ? row[key] === value : (row[key] ?? '') !== ''
+          case 'warning':
+            return isWarning(row) === 2
+          case 'alarm':
+            return isWarning(row) === 1
           default:
-            return (item[key] ?? '') !== ''
+            return (row[key] ?? '') !== ''
         }
       })
     },
@@ -811,14 +880,32 @@ export default {
     $route: {
       handler({ path, query }) {
         if (path.includes('flightView')) {
-          const { flightNO, flightDate, fastFilter } = query
+          const { flightNO, flightDate, departureAirport, landingAirport, fastFilter } = query
           if (flightNO && flightDate) {
-            const { flightNO: oldFlightNO, flightDate: oldFlightDate } = this.queryData
+            const {
+              flightNO: oldFlightNO,
+              flightDate: oldFlightDate,
+              departureAirport: oldDepartureAirport,
+              landingAirport: oldLandingAirport
+            } = this.queryData
             if (flightNO !== oldFlightNO || flightDate !== oldFlightDate) {
-              this.queryData = { flightNO, flightDate }
               this.queryAirline([flightNO, flightDate])
+            } else if (departureAirport !== oldDepartureAirport || landingAirport !== oldLandingAirport) {
+              if (this.airlineList.length) {
+                let currentIndex = this.airlineList.findIndex(
+                  ({ value }) => value === `${departureAirport}-${landingAirport}`
+                )
+                currentIndex = currentIndex > -1 ? currentIndex : 0
+                this.selectedAirline = this.airlineList[currentIndex].value
+              }
             }
             this.selectedFilter = fastFilter ? fastFilter.split(',') : []
+            this.queryData = {
+              flightNO,
+              flightDate,
+              departureAirport,
+              landingAirport
+            }
           } else {
             this.$router.push('/')
           }
@@ -860,6 +947,7 @@ export default {
     })
   },
   activated() {
+    this.getWarningData()
     this.$nextTick(() => {
       this.$refs['containerTable']?.doLayout()
       // this.$refs['transferInBaggageTable']?.doLayout()
@@ -1180,7 +1268,11 @@ export default {
           value: `${departureAirport}-${landingAirport}`
         }))
         if (this.airlineList.length) {
-          this.selectedAirline = this.airlineList[0].value
+          let currentIndex = this.airlineList.findIndex(
+            ({ value }) => value === `${this.queryData.departureAirport}-${this.queryData.landingAirport}`
+          )
+          currentIndex = currentIndex > -1 ? currentIndex : 0
+          this.selectedAirline = this.airlineList[currentIndex].value
         } else {
           this.$message.info('未查询到航班数据')
         }
@@ -1216,12 +1308,23 @@ export default {
         this.$message.error('失败')
       }
       this.fullscreenLoading = false
+    },
+    async getWarningData() {
+      try {
+        const listValues = await myQuery(DATACONTENT_ID.departureWarningId)
+        this.warningRules = listValues
+      } catch (error) {
+        this.$message.error('失败')
+      }
     }
   }
 }
 </script>
 
-<style lang="scss" scoped>
+<style
+  lang="scss"
+  scoped
+>
 .flight-view {
   padding: 0 0 16px 8px;
   overflow: hidden;

+ 62 - 34
src/views/baggageManagement/mixins/terminal.js

@@ -197,7 +197,12 @@ export default {
       return sums
     },
     cellClass({ row, column, rowIndex, columnIndex }) {
-      const classes = commonTableCellClass({ row, column, rowIndex, columnIndex })
+      const classes = commonTableCellClass({
+        row,
+        column,
+        rowIndex,
+        columnIndex
+      })
       if (
         [
           'flightNO',
@@ -211,6 +216,7 @@ export default {
           'checkInNumber',
           'unActive',
           'preLoad',
+          'warning',
           'midIn',
           'noCheckInNumber',
           'checkNumber',
@@ -284,6 +290,7 @@ export default {
           'checkInNumber',
           'unActive',
           'preLoad',
+          'warning',
           'midIn',
           'noCheckInNumber',
           'checkNumber',
@@ -307,45 +314,42 @@ export default {
           columnProp: column.property,
           pageName: this.$route.name
         })
+        const path = `${this.$route.path}/flightView`
+        const query = {}
         switch (column.property) {
           case 'flightNO':
-            this.$router.push({
-              path: `${this.$route.path}/flightView`,
-              query: {
-                flightNO: row.flightNO,
-                flightDate: row.flightDate
-              }
+            Object.assign(query, {
+              flightNO: row.flightNO,
+              flightDate: row.flightDate
             })
             break
           case 'preFlightNO':
-            this.$router.push({
-              path: `${this.$route.path}/flightView`,
-              query: {
-                flightNO: row.preFlightNO,
-                flightDate: row.flightDate
-              }
+            Object.assign(query, {
+              flightNO: row.preFlightNO,
+              flightDate: row.preFlightDate
             })
             break
           case 'inTransferBaggageCount':
           case 'outTransferBaggageCount':
-            this.$router.push({
-              path: `${this.$route.path}/flightView`,
-              query: {
-                flightNO: row.preFlightNO,
-                flightDate: row.preFlightDate,
-                fastFilter: `transferFlightNO,${row.flightNO}`
-              }
+            Object.assign(query, {
+              flightNO: row.preFlightNO,
+              flightDate: row.preFlightDate,
+              fastFilter: `transferFlightNO,${row.flightNO}`
             })
             break
           case 'inTransferredBaggageCount':
           case 'outTransferredBaggageCount':
-            this.$router.push({
-              path: `${this.$route.path}/flightView`,
-              query: {
-                flightNO: row.flightNO,
-                flightDate: row.flightDate,
-                fastFilter: `inFlightNO,${row.preFlightNO}`
-              }
+            Object.assign(query, {
+              flightNO: row.flightNO,
+              flightDate: row.flightDate,
+              fastFilter: `inFlightNO,${row.preFlightNO}`
+            })
+            break
+          case 'warning':
+            Object.assign(query, {
+              flightNO: row.flightNO,
+              flightDate: row.flightDate,
+              fastFilter: row['warningState'] === 1 ? 'warning' : 'alarm'
             })
             break
           default: {
@@ -371,17 +375,41 @@ export default {
               numberOfContainers: 'inContainer', // 有容器ID
               numberOfBulk: 'FBULK' // 容器ID为'FBULK'
             }
-            this.$router.push({
-              path: `${this.$route.path}/flightView`,
-              query: {
-                flightNO: row.flightNO,
-                flightDate: row.flightDate,
-                fastFilter: reflect[column.property]
-              }
+            Object.assign(query, {
+              flightNO: row.flightNO,
+              flightDate: row.flightDate,
+              fastFilter: reflect[column.property]
             })
             break
           }
         }
+        switch (this.$route.path.split('/').at(-1)) {
+          case 'departure':
+            Object.assign(query, {
+              departureAirport: this.formData.currentAirport ?? '',
+              landingAirport: row.targetAirport ?? ''
+            })
+            break
+          case 'arrival':
+            Object.assign(query, {
+              departureAirport: row.departureAirport ?? '',
+              landingAirport: this.formData.currentAirport ?? ''
+            })
+            break
+          case 'transferDeparture':
+          case 'transferArrival':
+            Object.assign(query, {
+              departureAirport: row.preAirport ?? '',
+              landingAirport: row.targetAirport ?? ''
+            })
+            break
+          default:
+            break
+        }
+        this.$router.push({
+          path,
+          query
+        })
       }
     }
   }