zhongxiaoyu 2 жил өмнө
parent
commit
cf89f2f8e7

+ 79 - 0
src/components/TimeZoneSelector/index.vue

@@ -0,0 +1,79 @@
+<!--
+ * @Author: Badguy
+ * @Date: 2022-05-17 15:56:46
+ * @LastEditTime: 2022-05-17 17:03:28
+ * @LastEditors: your name
+ * @Description: 时区下拉选择菜单
+ * have a nice day!
+-->
+<template>
+  <el-dropdown :hide-on-click="false" @command="commandHandler">
+    <img
+      class="checkTime msgImg"
+      src="../../assets/departure/ic_time.png"
+    >
+    <el-dropdown-menu
+      slot="dropdown"
+      class="time-zone"
+    >
+      <el-dropdown-item
+        v-for="(item, index) in DropdownItems"
+        :key="index"
+        :class="{ 'time-zone-selected': timeZone === item.command }"
+        :command="item.command"
+        :disabled="item.disabled"
+      >{{ item.text }}</el-dropdown-item>
+    </el-dropdown-menu>
+  </el-dropdown>
+</template>
+
+<script>
+import { mapGetters } from 'vuex'
+export default {
+  name: 'TimeZoneSelector',
+  data() {
+    return {
+      DropdownItems: [
+        {
+          text: '国内Local/国际UTC',
+          disabled: true
+        },
+        {
+          text: 'Local',
+          command: 8
+        },
+        {
+          text: 'UTC',
+          command: 0
+        }
+      ]
+    }
+  },
+  computed: {
+    ...mapGetters(['timeZone'])
+  },
+  methods: {
+    commandHandler(command) {
+      this.$store.dispatch('timeZone/setTimeZone', command)
+    }
+  }
+}
+</script>
+
+<style lang="scss" scoped>
+.time-zone .el-dropdown-menu__item {
+  padding-left: 30px;
+  font-family: Helvetica, 'Microsoft YaHei';
+  font-size: 12px;
+  color: #101116;
+  position: relative;
+  &.is-disabled {
+    color: #909399;
+  }
+  &.time-zone-selected::before {
+    content: '√';
+    position: absolute;
+    left: 10px;
+  }
+}
+</style>

+ 3 - 2
src/store/getters.js

@@ -1,7 +1,7 @@
 /*
  * @Author: your name
  * @Date: 2021-10-14 17:17:53
- * @LastEditTime: 2022-03-09 13:38:26
+ * @LastEditTime: 2022-05-17 15:48:13
  * @LastEditors: your name
  * @Description: In User Settings Edit
  * @FilePath: \Foshan4A\src\store\getters.js
@@ -30,6 +30,7 @@ const getters = {
   userPowerList: state => state.user.userPoewrList,
   permission_routes: state => state.permission.routes,
   keepAlivePages: state => state.keepAlive.keepAlivePages.map(page => page.name),
-  queryForm:state => state.app.queryForm
+  queryForm: state => state.app.queryForm,
+  timeZone: state => state.timeZone.currentTimeZone
 }
 export default getters

+ 3 - 1
src/store/index.js

@@ -8,6 +8,7 @@ import auth from './modules/auths'
 import tagsView from './modules/tagsView'
 import permission from './permission'
 import keepAlive from './modules/keepAlive'
+import timeZone from './modules/timeZone'
 Vue.use(Vuex)
 
 const store = new Vuex.Store({
@@ -18,7 +19,8 @@ const store = new Vuex.Store({
     tagsView,
     auth,
     permission,
-    keepAlive
+    keepAlive,
+    timeZone
   },
   getters
 })

+ 2 - 2
src/store/modules/keepAlive.js

@@ -1,7 +1,7 @@
 /*
  * @Author: Badguy
  * @Date: 2022-03-08 17:31:03
- * @LastEditTime: 2022-03-09 17:23:46
+ * @LastEditTime: 2022-05-17 15:37:13
  * @LastEditors: your name
  * @Description: 页面缓存
  * have a nice day!
@@ -10,7 +10,7 @@ const defaultPages = [{ name: 'BaggageManagement' }]
 const savedPages = JSON.parse(sessionStorage.getItem('keepAlivePages'))
 
 const state = {
-  keepAlivePages: defaultPages || savedPages
+  keepAlivePages: savedPages || defaultPages
 }
 
 const mutations = {

+ 35 - 0
src/store/modules/timeZone.js

@@ -0,0 +1,35 @@
+/*
+ * @Author: Badguy
+ * @Date: 2022-05-17 15:35:35
+ * @LastEditTime: 2022-05-17 17:44:00
+ * @LastEditors: your name
+ * @Description: 时区统一管理
+ * have a nice day!
+ */
+
+const defaultTimeZone = 8
+const savedTimeZone = sessionStorage.getItem('currentTimeZone')
+
+const state = {
+  currentTimeZone: Number(savedTimeZone ?? defaultTimeZone)
+}
+
+const mutations = {
+  SET_TIME_ZONE(state, timeZone) {
+    state.currentTimeZone = timeZone
+    sessionStorage.setItem('currentTimeZone', timeZone)
+  }
+}
+
+const actions = {
+  setTimeZone({ commit }, timeZone) {
+    commit('SET_TIME_ZONE', timeZone)
+  }
+}
+
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions
+}

+ 0 - 7
src/styles/index.scss

@@ -549,13 +549,6 @@ li {
   cursor: pointer;
 }
 
-/* 时区选择下拉菜单 */
-.time-zone .el-dropdown-menu__item {
-  font-family: Helvetica, 'Microsoft YaHei';
-  font-size: 12px;
-  color: #101116;
-}
-
 // 表格列筛选弹框
 .dialog-check-cols .el-tree {
   &.has-children .el-tree-node > .el-tree-node__children {

+ 38 - 5
src/utils/table.js

@@ -1,7 +1,7 @@
 /*
  * @Author: Badguy
  * @Date: 2022-02-11 09:20:58
- * @LastEditTime: 2022-05-16 15:45:46
+ * @LastEditTime: 2022-05-17 17:53:24
  * @LastEditors: your name
  * @Description: 表格用
  * have a nice day!
@@ -18,14 +18,23 @@ export function mergeTableRow(config) {
   if (!mergeColNames || mergeColNames.length === 0) {
     return data
   }
-  mergeColNames.forEach((m) => {
+  mergeColNames.forEach(m => {
     const mList = {}
     data = data.map((v, index) => {
       const rowVal = v[m]
       if (mList[rowVal] && mList[rowVal].newIndex === index) {
-        const flag = firstMergeColNames.filter((f) => { return f === m }).length !== 0
-        const mcFlag = mergeColNames.filter((mc) => { return mc === firstMerge }).length === 0
-        if ((mcFlag && flag) || (flag && data[index][firstMerge + '-span'] && data[index][firstMerge + '-span'].rowspan === 1)) {
+        const flag =
+          firstMergeColNames.filter(f => {
+            return f === m
+          }).length !== 0
+        const mcFlag =
+          mergeColNames.filter(mc => {
+            return mc === firstMerge
+          }).length === 0
+        if (
+          (mcFlag && flag) ||
+          (flag && data[index][firstMerge + '-span'] && data[index][firstMerge + '-span'].rowspan === 1)
+        ) {
           v[m + '-span'] = {
             rowspan: 1,
             colspan: 1
@@ -60,3 +69,27 @@ export function commonTableCellClass({ row, column, rowIndex, columnIndex }) {
   }
   return classString
 }
+
+// 获取对应时区的时间
+export function timeInZone(date, timeZone = 0, local = 8) {
+  if (!(date instanceof Date)) {
+    if (typeof date === 'string' && date.length) {
+      date = new Date(date)
+    } else {
+      return ''
+    }
+  }
+
+  function formatDate(num) {
+    return num < 10 ? '0' + num : num
+  }
+  const time = date.getTime() + (timeZone - local) * 60 * 60 * 1000
+  date.setTime(time)
+  const year = date.getFullYear()
+  const month = formatDate(date.getMonth() + 1)
+  const day = formatDate(date.getDate())
+  const hour = formatDate(date.getHours())
+  const minute = formatDate(date.getMinutes())
+  const second = formatDate(date.getSeconds())
+  return `${year}-${month}-${day} ${hour}:${minute}:${second}`
+}

+ 20 - 18
src/views/advancedQuery/views/advancedHome.vue

@@ -77,9 +77,9 @@
           :filter-method="tableDataFilters[item.prop] && filterHandler"
           filter-placement="top"
         >
-        <template slot-scope="scope">
-          <a href="javascript:void(0);">{{scope.row[item.prop]}}</a>
-        </template>
+          <template slot-scope="scope">
+            <a href="javascript:void(0);">{{ scope.row[item.prop] }}</a>
+          </template>
         </el-table-column>
       </el-table>
     </div>
@@ -274,7 +274,10 @@
                     v-model="form.DealResult"
                     clearable
                   >
-                    <el-option label="OFF" value="OFF" />
+                    <el-option
+                      label="OFF"
+                      value="OFF"
+                    />
                   </el-select>
                 </el-form-item>
               </el-col>
@@ -442,16 +445,16 @@ export default {
     }
   },
   created() {
-    console.log(this.$store.state.app.queryForm)
+    // console.log(this.$store.state.app.queryForm)
     // 参数顺序   【航班开始日期,航班结束日期,航班号,航班号,行李牌号,行李牌号,起飞站,起飞站,目的站,目的站,特殊行李类型,特殊 行李类型,旅客姓名大写拼音,旅客姓名大写拼音,pnr,pnr,值机号,值机号】
     // const dataContent = [this.time[0], this.time[1]]
     // for (let i = 0; i < 18; i++) {
     //   dataContent.push(null)
     // }
     // this.statItemsQueryByStatMain(dataContent);
-    if(this.$store.state.app.queryForm){
-      this.form = this.$store.state.app.queryForm;
-      this.time = this.form.time;
+    if (this.$store.state.app.queryForm) {
+      this.form = this.$store.state.app.queryForm
+      this.time = this.form.time
       this.onCheckGj()
     }
   },
@@ -543,6 +546,15 @@ export default {
       this.$refs.table.doLayout()
     })
   },
+  beforeDestroy() {
+    // console.log(this.$route.matched.filter(item => item.name && item.meta.title))
+    this.form.time = this.time
+    if (this.$route.matched.filter(item => item.name && item.meta.title).length > 1) {
+      this.$store.state.app.queryForm = this.form
+    } else {
+      this.$store.state.app.queryForm = null
+    }
+  },
   methods: {
     arraySpanMethod({ row, column, rowIndex, columnIndex }) {
       for (let i = 0; i < 5; i++) {
@@ -779,16 +791,6 @@ export default {
         return ['合计', `共${num}件`]
       }
     }
-  },
-  beforeDestroy(){
-    console.log(this.$route.matched.filter((item) => item.name && item.meta.title))
-    this.form.time = this.time;
-    if(this.$route.matched.filter((item) => item.name && item.meta.title).length>1){
-      this.$store.state.app.queryForm = this.form
-    }
-    else{
-      this.$store.state.app.queryForm = null
-    }
   }
 }
 </script>

+ 4 - 16
src/views/baggageManagement/components/arrival/index.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: zk
  * @Date: 2022-01-17 10:39:22
- * @LastEditTime: 2022-05-16 15:46:13
+ * @LastEditTime: 2022-05-17 16:19:19
  * @LastEditors: your name
  * @Description: 进港01
 -->
@@ -114,20 +114,7 @@
             />
           </el-form-item> -->
           <el-form-item v-is="['i_timeIcon']">
-            <el-dropdown>
-              <img
-                class="checkTime msgImg"
-                src="../../../../assets/departure/ic_time.png"
-              >
-              <el-dropdown-menu
-                slot="dropdown"
-                class="time-zone"
-              >
-                <el-dropdown-item>国内Local/国际UTC</el-dropdown-item>
-                <el-dropdown-item>Local</el-dropdown-item>
-                <el-dropdown-item>UTC</el-dropdown-item>
-              </el-dropdown-menu>
-            </el-dropdown>
+            <TimeZoneSelector />
           </el-form-item>
           <el-form-item>
             <img
@@ -235,6 +222,7 @@
 
 <script>
 import Dialog from '@/layout/components/Dialog'
+import TimeZoneSelector from '@/components/TimeZoneSelector'
 import terminalMixin from '../../mixins/terminal'
 import formMixin from '../../mixins/form'
 import tableColsMixin from '../../mixins/tableCols'
@@ -242,7 +230,7 @@ import { getQuery } from '@/api/flight'
 
 export default {
   name: 'DepartureTerminalView',
-  components: { Dialog },
+  components: { Dialog, TimeZoneSelector },
   mixins: [terminalMixin, formMixin, tableColsMixin],
   data() {
     return {

+ 7 - 17
src/views/baggageManagement/components/departure/index.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: zk
  * @Date: 2022-01-17 10:39:22
- * @LastEditTime: 2022-05-16 15:48:33
+ * @LastEditTime: 2022-05-17 17:53:25
  * @LastEditors: your name
  * @Description: 离港01
 -->
@@ -114,20 +114,7 @@
             />
           </el-form-item> -->
           <el-form-item v-is="['i_timeIcon']">
-            <el-dropdown>
-              <img
-                class="checkTime msgImg"
-                src="../../../../assets/departure/ic_time.png"
-              >
-              <el-dropdown-menu
-                slot="dropdown"
-                class="time-zone"
-              >
-                <el-dropdown-item>国内Local/国际UTC</el-dropdown-item>
-                <el-dropdown-item>Local</el-dropdown-item>
-                <el-dropdown-item>UTC</el-dropdown-item>
-              </el-dropdown-menu>
-            </el-dropdown>
+            <TimeZoneSelector />
           </el-form-item>
           <el-form-item>
             <img
@@ -177,6 +164,7 @@
           :prop="item.statCode"
           :label="item.statName"
           :width="item.width"
+          :formatter="tableFormat"
           :filters="tableDataFilters[item.statCode]"
           :filter-method="tableDataFilters[item.statCode] && filterHandler"
         >
@@ -227,15 +215,17 @@
 
 <script>
 import Dialog from '@/layout/components/Dialog'
+import TimeZoneSelector from '@/components/TimeZoneSelector'
 import terminalMixin from '../../mixins/terminal'
 import formMixin from '../../mixins/form'
 import tableColsMixin from '../../mixins/tableCols'
+import timeZoneMixin from '../../mixins/timeZone'
 import { getQuery } from '@/api/flight'
 
 export default {
   name: 'DepartureTerminalView',
-  components: { Dialog },
-  mixins: [terminalMixin, formMixin, tableColsMixin],
+  components: { Dialog, TimeZoneSelector },
+  mixins: [terminalMixin, formMixin, tableColsMixin, timeZoneMixin],
   data() {
     return {
       orderNum: ['0', '0', '0', '0', '0', '0'], // 默认总数

+ 22 - 28
src/views/baggageManagement/components/flight/index.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2022-01-17 10:39:22
- * @LastEditTime: 2022-05-16 16:16:40
+ * @LastEditTime: 2022-05-17 17:59:01
  * @LastEditors: your name
  * @Description: 航班视图
 -->
@@ -269,23 +269,16 @@
               size="mini"
             >搜索</el-button>
           </div> -->
-          <el-switch
-            v-model="openUTC"
-            active-text="开启UTC"
-          />
-          <el-button
+          <TimeZoneSelector />
+          <img
             class="btn-square"
-            type="primary"
-            icon="el-icon-download"
-            size="mini"
-          />
-          <el-button
-            class="btn-square setBtn"
-            type="primary"
-            icon="el-icon-s-tools"
-            size="mini"
+            src="../../../../assets/departure/ic_setting.png"
+          >
+          <img
+            class="btn-square"
+            src="../../../../assets/departure/ic_setting.png"
             @click="show"
-          />
+          >
         </div>
         <el-table
           ref="flightBaggageTable"
@@ -353,8 +346,10 @@
 </template>
 <script>
 import Dialog from '@/layout/components/Dialog/index.vue'
+import TimeZoneSelector from '@/components/TimeZoneSelector'
 import { queryMap, myQuery } from '@/api/dataIntegration'
 import tableColsMixin from '../../mixins/tableCols'
+import timeZoneMixin from '../../mixins/timeZone'
 
 // const arrivalBaggageTableColumn = [
 //   { name: '序号', prop: 'index', align: 'center' },
@@ -409,9 +404,10 @@ const departureBaggageTableColumn = [
 export default {
   name: 'FlightView',
   components: {
-    Dialog
+    Dialog,
+    TimeZoneSelector
   },
-  mixins: [tableColsMixin],
+  mixins: [tableColsMixin, timeZoneMixin],
   data() {
     return {
       queryData: {},
@@ -454,7 +450,7 @@ export default {
       transferOutBaggageTableData: [], // 中转出
       flightBaggageTableData: [], // 行李列表
       flightBaggageTableFilters: {
-        latestStatus:[]
+        latestStatus: []
       }
     }
   },
@@ -747,15 +743,13 @@ export default {
           margin-left: 20px;
           margin-right: 10px;
         }
-        .el-button {
-          margin-left: 10px;
-          &.btn-square {
-            width: 30px;
-            height: 30px;
-            display: flex;
-            align-items: center;
-            justify-content: center;
-          }
+        .el-dropdown {
+          height: 30px;
+        }
+        .btn-square {
+          margin-left: 20px;
+          cursor: pointer;
+          position: relative;
         }
         .setBtn {
           margin-right: 30px;

+ 31 - 39
src/views/baggageManagement/components/transferArrival/index.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: zk
  * @Date: 2022-01-17 10:39:22
- * @LastEditTime: 2022-05-16 17:53:30
+ * @LastEditTime: 2022-05-17 18:01:53
  * @LastEditors: your name
  * @Description: 离港01
 -->
@@ -146,20 +146,7 @@
             />
           </el-form-item> -->
           <el-form-item v-is="['i_timeIcon']">
-            <el-dropdown>
-              <img
-                class="checkTime msgImg"
-                src="../../../../assets/departure/ic_time.png"
-              >
-              <el-dropdown-menu
-                slot="dropdown"
-                class="time-zone"
-              >
-                <el-dropdown-item>国内Local/国际UTC</el-dropdown-item>
-                <el-dropdown-item>Local</el-dropdown-item>
-                <el-dropdown-item>UTC</el-dropdown-item>
-              </el-dropdown-menu>
-            </el-dropdown>
+            <TimeZoneSelector />
           </el-form-item>
           <el-form-item>
             <img
@@ -218,7 +205,10 @@
             :formatter="tableFormat"
           >
             <template slot="header">
-              <el-tooltip :content="p.statName" placement="top"><span>{{ p.statName }}</span></el-tooltip>
+              <el-tooltip
+                :content="p.statName"
+                placement="top"
+              ><span>{{ p.statName }}</span></el-tooltip>
             </template>
           </el-table-column>
         </el-table-column>
@@ -265,16 +255,18 @@
 
 <script>
 import Dialog from '@/layout/components/Dialog'
+import TimeZoneSelector from '@/components/TimeZoneSelector'
 import terminalMixin from '../../mixins/terminal'
 import formMixin from '../../mixins/form'
 import tableColsMixin from '../../mixins/tableCols'
+import timeZoneMixin from '../../mixins/timeZone'
 import { getQuery } from '@/api/flight'
 import { commonTableCellClass } from '@/utils/table'
 
 export default {
   name: 'DepartureTerminalView',
-  components: { Dialog },
-  mixins: [terminalMixin, formMixin, tableColsMixin],
+  components: { Dialog, TimeZoneSelector },
+  mixins: [terminalMixin, formMixin, tableColsMixin, timeZoneMixin],
   data() {
     return {
       optionProps: {
@@ -413,6 +405,17 @@ export default {
     // this.upAviationData();
     this.getAirPortData()
   },
+  mounted() {
+    // this.arraySpanMethod();
+    const that = this
+    this.loopEvent = setInterval(function () {
+      // console.log(this.contactDot)
+      that.getTableData()
+    }, 3000)
+  },
+  beforeDestroy() {
+    clearInterval(this.loopEvent)
+  },
   // watch: {
   //   formData() {
   //     this.getAviationData();
@@ -463,7 +466,7 @@ export default {
       this.upAviationData()
       // this.getTableData();
     },
-    //选择机场
+    // 选择机场
     async getAirPortData() {
       try {
         const res = await getQuery({
@@ -483,7 +486,7 @@ export default {
         console.log('出错了', error)
       }
     },
-    //选择航司
+    // 选择航司
     async getAviationData() {
       try {
         const res = await getQuery({
@@ -500,7 +503,7 @@ export default {
         console.log('出错了', error)
       }
     },
-    //选择航司
+    // 选择航司
     async upAviationData() {
       try {
         const res = await getQuery({
@@ -518,8 +521,8 @@ export default {
       }
     },
     tableRowClassName({ row, rowIndex }) {
-      if (row.hasTakenOff == 0) {
-        if (rowIndex == this.leaveCount - 1) {
+      if (row.hasTakenOff === 0) {
+        if (rowIndex === this.leaveCount - 1) {
           return 'bgl-hui redBorder'
         } else {
           return 'bgl-hui'
@@ -550,9 +553,9 @@ export default {
       if (!this.currentAirport) {
         return
       }
-      let arrs1 = [this.formData.inboundCarrier.length == 0 ? '' : this.formData.inboundCarrier[0]]
-      let arrs2 = [this.formData.outgoingAirline.length == 0 ? '' : this.formData.outgoingAirline[0]]
-      let arr = [
+      const arrs1 = [this.formData.inboundCarrier.length == 0 ? '' : this.formData.inboundCarrier[0]]
+      const arrs2 = [this.formData.outgoingAirline.length == 0 ? '' : this.formData.outgoingAirline[0]]
+      const arr = [
         this.formData.currentAirport,
         this.formData.startDate,
         this.formData.endDate,
@@ -594,7 +597,7 @@ export default {
               }
             }
           })
-          //this.initTableData(res.returnData);
+          // this.initTableData(res.returnData);
         } else {
           console.log(res.message)
         }
@@ -607,7 +610,7 @@ export default {
       this.leaveCount = 0
       this.baggageCount = 0
       tableData.forEach(item => {
-        if (item.hasTakenOff == 0) {
+        if (item.hasTakenOff === 0) {
           this.leaveCount++
         }
         // item["waitfanj"] = item["noCheckInNumber"] - item["unLoad"];
@@ -728,17 +731,6 @@ export default {
       //   }
       // }
     }
-  },
-  mounted() {
-    // this.arraySpanMethod();
-    let that = this
-    this.loopEvent = setInterval(function () {
-      // console.log(this.contactDot)
-      that.getTableData()
-    }, 3000)
-  },
-  beforeDestroy() {
-    clearInterval(this.loopEvent)
   }
 }
 </script>

+ 29 - 50
src/views/baggageManagement/components/transferDeparture/index.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: zk
  * @Date: 2022-01-17 10:39:22
- * @LastEditTime: 2022-05-16 16:01:33
+ * @LastEditTime: 2022-05-17 17:08:03
  * @LastEditors: your name
  * @Description: 离港01
 -->
@@ -139,19 +139,6 @@
               active-text="显示中转"
             />
           </el-form-item> -->
-          <!-- <el-form-item v-is="['i_timeIcon']">
-            <el-dropdown>
-              <img
-                class="checkTime msgImg"
-                src="../../../../assets/departure/ic_time.png"
-              />切换视角
-              <el-dropdown-menu slot="dropdown" class="time-zone">
-                <el-dropdown-item>国内Local/国际UTC</el-dropdown-item>
-                <el-dropdown-item>Local</el-dropdown-item>
-                <el-dropdown-item>UTC</el-dropdown-item>
-              </el-dropdown-menu>
-            </el-dropdown>
-          </el-form-item> -->
           <el-form-item v-is="['ti_showTransit']">
             <el-button
               size="small"
@@ -160,20 +147,7 @@
             >切换视角</el-button>
           </el-form-item>
           <el-form-item v-is="['i_timeIcon']">
-            <el-dropdown>
-              <img
-                class="checkTime msgImg"
-                src="../../../../assets/departure/ic_time.png"
-              >
-              <el-dropdown-menu
-                slot="dropdown"
-                class="time-zone"
-              >
-                <el-dropdown-item>国内Local/国际UTC</el-dropdown-item>
-                <el-dropdown-item>Local</el-dropdown-item>
-                <el-dropdown-item>UTC</el-dropdown-item>
-              </el-dropdown-menu>
-            </el-dropdown>
+            <TimeZoneSelector />
           </el-form-item>
           <el-form-item>
             <img
@@ -232,7 +206,10 @@
             :formatter="tableFormat"
           >
             <template slot="header">
-              <el-tooltip :content="p.statName" placement="top"><span>{{ p.statName }}</span></el-tooltip>
+              <el-tooltip
+                :content="p.statName"
+                placement="top"
+              ><span>{{ p.statName }}</span></el-tooltip>
             </template>
           </el-table-column>
         </el-table-column>
@@ -279,16 +256,18 @@
 
 <script>
 import Dialog from '@/layout/components/Dialog'
+import TimeZoneSelector from '@/components/TimeZoneSelector'
 import terminalMixin from '../../mixins/terminal'
 import formMixin from '../../mixins/form'
 import tableColsMixin from '../../mixins/tableCols'
+import timeZoneMixin from '../../mixins/timeZone'
 import { getQuery } from '@/api/flight'
 import { commonTableCellClass } from '@/utils/table'
 
 export default {
   name: 'DepartureTerminalView',
-  components: { Dialog },
-  mixins: [terminalMixin, formMixin, tableColsMixin],
+  components: { Dialog, TimeZoneSelector },
+  mixins: [terminalMixin, formMixin, tableColsMixin, timeZoneMixin],
   data() {
     return {
       optionProps: {
@@ -423,6 +402,15 @@ export default {
   created() {
     this.getAirPortData()
   },
+  mounted() {
+    const that = this
+    this.loopEvent = setInterval(function () {
+      that.getTableData()
+    }, 3000)
+  },
+  beforeDestroy() {
+    clearInterval(this.loopEvent)
+  },
   methods: {
     cellClass({ row, column, rowIndex, columnIndex }) {
       let classString = commonTableCellClass({ row, column, rowIndex, columnIndex })
@@ -467,7 +455,7 @@ export default {
       this.upAviationData()
       // this.getTableData();
     },
-    //选择机场
+    // 选择机场
     async getAirPortData() {
       try {
         const res = await getQuery({
@@ -487,7 +475,7 @@ export default {
         console.log('出错了', error)
       }
     },
-    //选择航司
+    // 选择航司
     async getAviationData() {
       try {
         const res = await getQuery({
@@ -504,7 +492,7 @@ export default {
         console.log('出错了', error)
       }
     },
-    //选择航司
+    // 选择航司
     async upAviationData() {
       try {
         const res = await getQuery({
@@ -522,8 +510,8 @@ export default {
       }
     },
     tableRowClassName({ row, rowIndex }) {
-      if (row.hasTakenOff == 0) {
-        if (rowIndex == this.leaveCount - 1) {
+      if (row.hasTakenOff === 0) {
+        if (rowIndex === this.leaveCount - 1) {
           return 'bgl-hui redBorder'
         } else {
           return 'bgl-hui'
@@ -558,9 +546,9 @@ export default {
       //   this.formData.inboundCarrier,
       //   this.formData.outgoingAirline,
       // ];
-      let arrs1 = [this.formData.inboundCarrier.length == 0 ? '' : this.formData.inboundCarrier[0]]
-      let arrs2 = [this.formData.outgoingAirline.length == 0 ? '' : this.formData.outgoingAirline[0]]
-      let arr = [
+      const arrs1 = [this.formData.inboundCarrier.length === 0 ? '' : this.formData.inboundCarrier[0]]
+      const arrs2 = [this.formData.outgoingAirline.length === 0 ? '' : this.formData.outgoingAirline[0]]
+      const arr = [
         this.formData.currentAirport,
         this.formData.startDate,
         this.formData.endDate,
@@ -598,7 +586,7 @@ export default {
               }
             }
           })
-          //this.initTableData(res.returnData);
+          // this.initTableData(res.returnData);
         } else {
           console.log(res.message)
         }
@@ -611,7 +599,7 @@ export default {
       this.leaveCount = 0
       this.baggageCount = 0
       tableData.forEach(item => {
-        if (item.hasTakenOff == 0) {
+        if (item.hasTakenOff === 0) {
           this.leaveCount++
         }
         // item["waitfanj"] = item["noCheckInNumber"] - item["unLoad"];
@@ -710,15 +698,6 @@ export default {
         }
       }
     }
-  },
-  mounted() {
-    let that = this
-    this.loopEvent = setInterval(function () {
-      that.getTableData()
-    }, 3000)
-  },
-  beforeDestroy() {
-    clearInterval(this.loopEvent)
   }
 }
 </script>

+ 1 - 24
src/views/baggageManagement/mixins/terminal.js

@@ -1,7 +1,7 @@
 /*
  * @Author: Badguy
  * @Date: 2022-03-04 11:41:55
- * @LastEditTime: 2022-05-16 15:37:54
+ * @LastEditTime: 2022-05-17 17:07:07
  * @LastEditors: your name
  * @Description: 航站视图通用部分
  * have a nice day!
@@ -69,29 +69,6 @@ export default {
       })
       return arr
     },
-    // 表格数据格式化
-    tableFormat(row, column, cellValue) {
-      if (cellValue || cellValue === 0) {
-        switch (column.property) {
-          case 'FlightDate':
-            return cellValue.split('-').slice(1).join('-')
-          case 'PlanLandingTime':
-          case 'PlanDepartureTime':
-          case 'PrePlanLandingTime':
-          case 'TransferFlightPlanDepartureTime':
-          case 'ActualDepartureTime':
-          case 'ActualLandingTime':
-            // return cellValue.split('T')[1].split(':').slice(0, 2).join(':')
-            return cellValue.replace('T', '\n')
-          case 'timeDifference':
-            return cellValue <= -120 ? '-2h+' : cellValue >= 120 ? '2h+' : cellValue
-          default:
-            return cellValue
-        }
-      } else {
-        return ''
-      }
-    },
     // 合计行
     summaryMethod({ columns, data }) {
       const sums = []

+ 39 - 0
src/views/baggageManagement/mixins/timeZone.js

@@ -0,0 +1,39 @@
+/*
+ * @Author: Badguy
+ * @Date: 2022-05-17 17:04:32
+ * @LastEditTime: 2022-05-17 17:53:26
+ * @LastEditors: your name
+ * @Description: 时区相关
+ * have a nice day!
+ */
+import { timeInZone } from '@/utils/table'
+import { mapGetters } from 'vuex'
+
+export default {
+  computed: {
+    ...mapGetters(['timeZone'])
+  },
+  methods: {
+    // 表格数据格式化
+    tableFormat(row, column, cellValue) {
+      if (cellValue || cellValue === 0) {
+        switch (column.property) {
+          // case 'FlightDate':
+          //   return cellValue.split('-').slice(1).join('-')
+          case 'PlanLandingTime':
+          case 'PlanDepartureTime':
+            return timeInZone(cellValue, this.timeZone)
+          case 'ActualDepartureTime':
+          case 'ActualLandingTime':
+            return timeInZone(cellValue.replace('T', ' '), this.timeZone).replace(' ', '\n')
+          case 'timeDifference':
+            return cellValue <= -120 ? '-2h+' : cellValue >= 120 ? '2h+' : cellValue
+          default:
+            return cellValue
+        }
+      } else {
+        return ''
+      }
+    }
+  }
+}