index.vue 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933
  1. <!--
  2. * @Author: zk
  3. * @Date: 2022-01-17 10:39:22
  4. * @LastEditTime: 2022-06-28 10:11:56
  5. * @LastEditors: your name
  6. * @Description: 中转离港
  7. -->
  8. <template>
  9. <div class="transfer-out">
  10. <!--功能区-表单-->
  11. <div ref="formWrap" class="terminal-form-wrap">
  12. <el-form ref="form" :inline="true" :model="formData" :rules="rules" class="form">
  13. <div class="form-left">
  14. <el-form-item prop="currentAirport">
  15. <!-- <el-cascader
  16. v-model="formData.currentAirport"
  17. style="width:144px;margin-left:10px"
  18. placeholder="全部机场"
  19. size="small"
  20. :options="currentAirportList"
  21. :props="currentAirportProps"
  22. collapse-tags
  23. clearable
  24. filterable
  25. @change="setCurrentAirport"
  26. /> -->
  27. <el-select v-model="formData.currentAirport" class="input-shadow" size="small" style="width: 100px" filterable default-first-option placeholder="请选择机场" @change="airPortChange">
  28. <el-option v-for="(item, index) in AirportList" :key="index" :label="item.planDepartureApt" :value="item.planDepartureApt" />
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item prop="inboundCarrier">
  32. <el-cascader v-model="formData.inboundCarrier" class="input-shadow" style="width: 140px" size="small" :options="carrierProps" :props="optionProps" placeholder="进港承运航司" collapse-tags clearable filterable default-first-option @change="resetLoopEvent" />
  33. </el-form-item>
  34. <el-form-item prop="outgoingAirline">
  35. <el-cascader v-model="formData.outgoingAirline" class="input-shadow" style="width: 140px" size="small" :options="carrierPropsop" :props="optionPropser" placeholder="离港承运航司" collapse-tags clearable filterable default-first-option @change="resetLoopEvent" />
  36. </el-form-item>
  37. <!-- <el-form-item prop="startDate">
  38. <el-date-picker
  39. v-model="formData.startDate"
  40. class="input-shadow"
  41. style="width: 216px"
  42. size="small"
  43. type="date"
  44. value-format="yyyy-MM-dd"
  45. placeholder="开始时间"
  46. @change="startDateChangeHandler"
  47. />
  48. </el-form-item>
  49. <el-form-item prop="endDate">
  50. <el-date-picker
  51. v-model="formData.endDate"
  52. class="input-shadow"
  53. style="width: 216px"
  54. size="small"
  55. type="date"
  56. value-format="yyyy-MM-dd"
  57. placeholder="结束时间"
  58. @change="endDateChangeHandler"
  59. />
  60. </el-form-item> -->
  61. <el-form-item prop="flightDate" label="航班日期">
  62. <el-date-picker v-model="formData.flightDate" size="small" style="width: 280px" type="daterange" value-format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期" :picker-options="dateRangePickerOptions" @change="dateChangeHandler" />
  63. </el-form-item>
  64. <el-form-item>
  65. <div class="box-item">
  66. <p>预计中转数:</p>
  67. <li v-for="(item, index) in orderNum" :key="index" :class="{ 'number-item': !isNaN(item), 'mark-item': isNaN(item) }">
  68. <span v-if="!isNaN(item)">
  69. <i ref="numberItem">0123456789</i>
  70. </span>
  71. <span v-else class="comma">{{ item }}</span>
  72. </li>
  73. </div>
  74. </el-form-item>
  75. </div>
  76. <div class="form-right" @keyup.enter="onSubmit(0)">
  77. <el-form-item prop="search">
  78. <el-popover :value="popoverVisible" placement="bottom" trigger="manual">
  79. <span>请输入航班号(示例:CA1234)或行李牌号(示例:1234567890)</span>
  80. <el-input slot="reference" v-model="formData.search" class="input-shadow" style="width: 240px" size="small" placeholder="请输入内容" prefix-icon="el-icon-search" clearable @focus="popoverVisible = true" @blur="popoverVisible = false" />
  81. </el-popover>
  82. </el-form-item>
  83. <el-form-item>
  84. <el-button class="btn-shadow" size="mini" type="primary" @click="onSubmit(0)">搜索</el-button>
  85. </el-form-item>
  86. <el-form-item>
  87. <el-button class="btn-shadow" size="mini" type="primary" @click="changeView">切换视角</el-button>
  88. </el-form-item>
  89. <!-- <el-form-item v-is="['td_timeIcon']">
  90. <TimeZoneSelector />
  91. </el-form-item> -->
  92. <el-form-item>
  93. <TimeZoneSelector />
  94. </el-form-item>
  95. <!-- <el-form-item v-is="['td_columnSettings']">
  96. <img class="btn-img btn-shadow" src="@/assets/baggage/ic_setting.png" title="列设置" @click="show" />
  97. </el-form-item> -->
  98. <el-form-item>
  99. <img class="btn-img btn-shadow" src="@/assets/baggage/ic_setting.png" title="列设置" @click="show" />
  100. </el-form-item>
  101. <!-- <el-form-item v-is="['dm_dt_columnSettings']">
  102. <img class="btn-img btn-shadow" src="@/assets/baggage/ic_export.png" title="导出" @click="exportHandler('table', '航站中转进港列表')" />
  103. </el-form-item> -->
  104. <el-form-item>
  105. <img class="btn-img btn-shadow" src="@/assets/baggage/ic_export.png" title="导出" @click="exportHandler('table', '航站中转进港列表')" />
  106. </el-form-item>
  107. </div>
  108. </el-form>
  109. </div>
  110. <!--表格-->
  111. <div v-loading="loading" class="terminal-table" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)">
  112. <el-table ref="table" class="table" :data="dealedTableData" :height="computedTableHeight" show-summary :summary-method="summaryMethod" :span-method="arraySpanMethod" :header-cell-class-name="headerCellClass" :row-class-name="tableRowClassName" :cell-class-name="cellClass" border stripe fit @cell-click="cellClickHandler">
  113. <el-table-column v-for="col in tableColsCopy" :key="col.prop" :prop="col.prop" :label="col.label" :width="col.width" :fixed="col.fixed">
  114. <el-table-column v-for="childCol in col.children" :key="childCol.prop" :prop="childCol.prop" :label="childCol.label" :width="childCol.width" :formatter="tableFormat">
  115. <template #header>
  116. <el-tooltip :content="childCol.desc || childCol.label" placement="top">
  117. <TableHeaderCell :label="childCol.label" :filter-options="tableDataFilters[childCol.prop]" :filter-values.sync="filterValues[childCol.prop]" :sortable="childCol.sortable" :sort-rule.sync="tableDataSortRules[childCol.prop]" />
  118. </el-tooltip>
  119. </template>
  120. </el-table-column>
  121. </el-table-column>
  122. </el-table>
  123. </div>
  124. <!--列设置-->
  125. <Dialog :flag="dialogFlag" class="dialog-check-group">
  126. <div class="dialog-wrapper">
  127. <div class="title">列设置</div>
  128. <div class="content">
  129. <el-tree ref="columnSetTree" :data="tableCols" :class="colsCheckClass" show-checkbox node-key="index" :default-expand-all="true" :props="{
  130. label: 'label',
  131. children: 'children'
  132. }" :default-checked-keys="checkedKeysTemp" @check="handleCheck" />
  133. </div>
  134. <div class="foot right t30">
  135. <el-button size="medium" class="r24" type="primary" @click="onCheck">确定</el-button>
  136. <el-button size="medium" @click="hide">取消</el-button>
  137. </div>
  138. </div>
  139. </Dialog>
  140. </div>
  141. </template>
  142. <script>
  143. import Dialog from '@/layout/components/Dialog'
  144. import TimeZoneSelector from '@/components/TimeZoneSelector'
  145. import terminalMixin from '../../mixins/terminal'
  146. import formMixin from '../../mixins/form'
  147. import tableColsMixin from '../../mixins/tableCols'
  148. import timeZoneMixin from '../../mixins/timeZone'
  149. import pf from '@/layout/mixin/publicFunc'
  150. // import { TempQuery, WhatQuery } from '@/api/temp'
  151. import { GeneralDataReception } from '@/api/temp'
  152. import TableHeaderCell from '@/components/TableHeaderCell'
  153. import { setTableFilters, throttledExportToExcel, timeInZone } from '@/utils/table'
  154. import { parseTime } from '@/utils/index'
  155. import { mapGetters } from 'vuex'
  156. export default {
  157. name: 'DepartureTerminalView',
  158. components: { Dialog, TimeZoneSelector, TableHeaderCell },
  159. mixins: [terminalMixin, formMixin, tableColsMixin, timeZoneMixin, pf],
  160. data () {
  161. return {
  162. optionProps: {
  163. value: 'inAicompanyCode2',
  164. label: 'inAicompanyCode2'
  165. },
  166. optionPropser: {
  167. value: 'outAicompanyCode2',
  168. label: 'outAicompanyCode2'
  169. },
  170. popoverVisible: false,
  171. orderNum: ['0', '0', '0', '0', '0', '0'], // 默认总数
  172. // 初始表头
  173. tableCols: [
  174. {
  175. prop: 'departureInfo',
  176. label: '离港航班',
  177. width: 180,
  178. fixed: 'left',
  179. children: [
  180. {
  181. prop: 'flightNO',
  182. label: '航班号',
  183. desc: '指航班编号',
  184. width: 80,
  185. filterable: true,
  186. sortable: true
  187. },
  188. {
  189. prop: 'flightDate',
  190. label: '航班日期',
  191. desc: '指航班计划起飞日期(不变的,机票上),不是预计起飞日期(预计起飞时间可能多个),也不是实际起飞日期(实际起飞等于最后预计)',
  192. width: 100
  193. },
  194. {
  195. prop: 'actualDepartureTime',
  196. label: '起飞时间',
  197. desc: '根据优先级别显示时间。优先级别:1.实际起飞时间,2.预计起飞时间,3.计划起飞时间',
  198. width: 100
  199. },
  200. {
  201. prop: 'targetAirport',
  202. label: '目的站',
  203. desc: '指航班执飞航段的目的航站,以航站三字码+航站简称显示',
  204. filterable: true,
  205. sortable: true
  206. },
  207. {
  208. prop: 'departureBuild',
  209. label: '起飞航站楼',
  210. desc: '指航班执飞航段的起飞航站的航站楼',
  211. width: 98,
  212. filterable: true,
  213. sortable: true
  214. },
  215. {
  216. prop: 'bordingGate',
  217. label: '起飞登机口',
  218. desc: '指航班的登机口代码,数据是变化的,仅显示最新信息',
  219. width: 98,
  220. filterable: true,
  221. sortable: true
  222. },
  223. {
  224. prop: 'standForDepartrue',
  225. label: '起飞停机位',
  226. desc: '指航班的停机位代码,数据是变化的,仅显示最新信息',
  227. width: 98,
  228. filterable: true,
  229. sortable: true
  230. },
  231. {
  232. prop: 'timeDifference',
  233. label: '转运时间',
  234. desc: '指中转动作完成时间'
  235. },
  236. {
  237. prop: 'outTransferredBaggageCount',
  238. label: '已中转进行李数',
  239. desc: '指其它航班实际已中转至本航班的行李数量',
  240. width: 120
  241. }
  242. ]
  243. },
  244. {
  245. prop: 'arrivalInfo',
  246. label: '进港航班',
  247. children: [
  248. {
  249. prop: 'outTransferBaggageCount',
  250. label: '中转进行李数',
  251. desc: '指其它航班预计中转至本航班的行李数量',
  252. width: 100
  253. },
  254. {
  255. prop: 'preFlightNO',
  256. label: '航班号',
  257. desc: '进港航班编号',
  258. width: 80,
  259. filterable: true,
  260. sortable: true
  261. },
  262. {
  263. prop: 'preFlightDate',
  264. label: '航班日期',
  265. desc: '指航班计划起飞日期(不变的,机票上),不是预计起飞日期(预计起飞时间可能多个),也不是实际起飞日期(实际起飞等于最后预计)',
  266. width: 100
  267. },
  268. {
  269. prop: 'preAirport',
  270. label: '起飞航站',
  271. desc: '指进港航班的起飞机场三字码',
  272. width: 100,
  273. filterable: true,
  274. sortable: true
  275. },
  276. {
  277. prop: 'actualLandingTime',
  278. label: '降落时间',
  279. desc: '指航班预计到达时间,数据是变化的,仅显示最新结果',
  280. width: 100
  281. },
  282. {
  283. prop: 'landingBuild',
  284. label: '降落航站楼',
  285. desc: '指航班降落后位于机场的哪个航站楼',
  286. width: 98,
  287. filterable: true,
  288. sortable: true
  289. },
  290. {
  291. prop: 'carousel',
  292. label: '行李转盘',
  293. desc: '指航班到达后行李提取的地方,仅显示最新信息',
  294. width: 100,
  295. filterable: true,
  296. sortable: true
  297. },
  298. {
  299. prop: 'standForLanding',
  300. label: '降落停机位',
  301. desc: '指航班的停机位代码,数据是变化的,仅显示最新信息',
  302. width: 98,
  303. filterable: true,
  304. sortable: true
  305. }
  306. // {
  307. // prop: 'inTransferBaggageCount',
  308. // label: '中转行李数',
  309. // desc: '指航班在本航站预计需要中转至对应航班的行李数量'
  310. // },
  311. // {
  312. // prop: 'inTransferredBaggageCount',
  313. // label: '已中转行李数',
  314. // desc: '指航班在本航站实际已经中转至对应航班的行李数量',
  315. // width: 100
  316. // }
  317. ]
  318. }
  319. ],
  320. loading: false,
  321. AirportList: [],
  322. carrierProps: [],
  323. carrierPropsop: [],
  324. loopEvent: null,
  325. leaveCount: 0,
  326. baggageCount: 0,
  327. hasSetTableScroll: false,
  328. spanArr: [],
  329. contactDot: 0,
  330. flag: 0,
  331. table: null,
  332. WarningData: []
  333. }
  334. },
  335. computed: {
  336. singleDay () {
  337. return this.startDate === this.endDate
  338. },
  339. ...mapGetters(['timeZone'])
  340. },
  341. created () {
  342. // this.getAirPortData()
  343. },
  344. mounted () {
  345. this.$refs['form'].validateField('flightDate')
  346. this.getAirPortData()
  347. this.table = this.$refs.table.bodyWrapper
  348. const that = this
  349. this.table.addEventListener('scroll', () => {
  350. that.scrollTop = this.table.scrollTop
  351. })
  352. },
  353. activated () {
  354. const { currentAirport, startDate, endDate } = this.$route.query
  355. if ((currentAirport ?? '') !== '') {
  356. this.formData.currentAirport = currentAirport
  357. }
  358. if ((startDate ?? '') !== '') {
  359. this.formData.flightDate[0] = startDate
  360. }
  361. if ((endDate ?? '') !== '') {
  362. this.formData.flightDate[1] = endDate
  363. }
  364. this.table.scrollTop = this.scrollTop
  365. this.getTableData()
  366. this.getWarningData()
  367. this.loopEvent = setInterval(this.getTableData, LOOP_INTERVAL.transferDepartureTable)
  368. },
  369. deactivated () {
  370. if (this.loopEvent) {
  371. clearInterval(this.loopEvent)
  372. this.loopEvent = null
  373. }
  374. },
  375. beforeDestroy () {
  376. if (this.loopEvent) {
  377. clearInterval(this.loopEvent)
  378. this.loopEvent = null
  379. }
  380. },
  381. methods: {
  382. async getWarningData () {
  383. try {
  384. // const res = await TempQuery({
  385. // id: SERVICE_ID.departureWarningId,
  386. // dataContent: []
  387. // })
  388. const res = await this.getQueryList(SERVICE_ID.departureWarningId, {}, 1, 999)
  389. if (Number(res.code) === 0) {
  390. const { listValues } = res.returnData
  391. this.WarningData = listValues
  392. } else {
  393. this.$message.error(res.message)
  394. }
  395. } catch (error) {
  396. this.$message.error('失败')
  397. }
  398. },
  399. resetLoopEvent () {
  400. this.loading = true
  401. this.hasSetTableScroll = false
  402. this.loopEvent && clearInterval(this.loopEvent)
  403. this.getTableData()
  404. this.loopEvent = setInterval(this.getTableData, LOOP_INTERVAL.transferDepartureTable)
  405. },
  406. headerCellClass ({ row, column }) {
  407. const classes = []
  408. const rule = this.tableDataSortRules[column.property]
  409. if (rule) {
  410. classes.push(rule)
  411. }
  412. return classes.join(' ')
  413. },
  414. tableRowClassName ({ row, rowIndex }) {
  415. const classes = []
  416. if (row.hasTakeOff) {
  417. classes.push('bgl-hui')
  418. if (rowIndex === this.leaveCount - 1) {
  419. classes.push('redBorder')
  420. }
  421. }
  422. return classes.join(' ')
  423. },
  424. changeView () {
  425. const query = {
  426. currentAirport: this.formData.currentAirport,
  427. startDate: this.startDate,
  428. endDate: this.endDate
  429. }
  430. this.$router.push({
  431. path: '/transfer/arrival',
  432. query
  433. })
  434. },
  435. airPortChange () {
  436. this.getAviationData()
  437. this.upAviationData()
  438. this.resetLoopEvent()
  439. },
  440. dateChangeHandler () {
  441. this.getAviationData()
  442. this.upAviationData()
  443. this.resetLoopEvent()
  444. },
  445. // 选择机场
  446. async getAirPortData () {
  447. try {
  448. // const res = await TempQuery({
  449. // id: SERVICE_ID.departureAirLtId,
  450. // dataContent: []
  451. // })
  452. const res = await this.getQueryListAuth(SERVICE_ID.departureAirLtId, {}, 1, 9999, 280)
  453. if (Number(res.code) === 0) {
  454. if (res.returnData?.listValues?.length) {
  455. if (!this.formData.currentAirport) {
  456. this.formData.currentAirport = res.returnData.listValues[0].planDepartureApt
  457. }
  458. this.AirportList = this._.orderBy(res.returnData.listValues, o => o.planDepartureApt)
  459. this.getAviationData()
  460. this.upAviationData()
  461. this.resetLoopEvent()
  462. } else {
  463. this.$message.warning('无航站数据权限')
  464. }
  465. } else {
  466. this.$message.error(res.message)
  467. }
  468. } catch (error) {
  469. this.$message.error('失败')
  470. }
  471. },
  472. // 选择航司
  473. async getAviationData () {
  474. try {
  475. // const res = await TempQuery({
  476. // id: SERVICE_ID.departureAviJoinLtId,
  477. // dataContent: [this.formData.currentAirport]
  478. // })
  479. const res = await this.getQueryListAuth(SERVICE_ID.departureAviJoinLtId, {}, 1, 9999, 281)
  480. if (Number(res.code) === 0) {
  481. this.carrierProps = res.returnData.listValues
  482. } else {
  483. this.$message.error(res.message)
  484. }
  485. } catch (error) {
  486. this.$message.error('失败')
  487. }
  488. },
  489. // 选择航司
  490. async upAviationData () {
  491. try {
  492. // const res = await TempQuery({
  493. // id: SERVICE_ID.departureAviLeaveLtId,
  494. // dataContent: [this.formData.currentAirport]
  495. // })
  496. const res = await this.getQueryListAuth(SERVICE_ID.departureAviLeaveLtId, {}, 1, 9999, 281)
  497. if (Number(res.code) === 0) {
  498. this.carrierPropsop = res.returnData.listValues
  499. } else {
  500. this.$message.error(res.message)
  501. }
  502. } catch (error) {
  503. this.$message.error('失败')
  504. }
  505. },
  506. // 获取表单下拉框数据
  507. // getFormData(params) {
  508. // this.relatedAirportQuery({
  509. // ...params,
  510. // type: 'OUT'
  511. // })
  512. // this.outgoingAirlineQuery(params)
  513. // this.craftTypeQuery(params)
  514. // this.flightAttrQuery(params)
  515. // },
  516. // 获取表格数据
  517. async getTableData () {
  518. if (!this.formData.currentAirport || !this.startDate || !this.endDate) {
  519. return
  520. }
  521. // const arrs1 = [this.formData.inboundCarrier.length === 0 ? '' : this.formData.inboundCarrier[0]]
  522. // const arrs2 = [this.formData.outgoingAirline.length === 0 ? '' : this.formData.outgoingAirline[0]]
  523. // const arr = [
  524. // this.formData.currentAirport,
  525. // this.startDate,
  526. // this.endDate,
  527. // ...arrs1,
  528. // ...arrs1,
  529. // ...arrs1,
  530. // ...arrs2,
  531. // ...arrs2,
  532. // ...arrs2
  533. // // this.formData.inboundCarrier,
  534. // // this.formData.outgoingAirline,
  535. // // JSON.stringify(this.formData.inboundCarrier),
  536. // // JSON.stringify(this.formData.outgoingAirline),
  537. // ]
  538. try {
  539. // const res = await TempQuery({
  540. // id: SERVICE_ID.departureTableLtId,
  541. // dataContent: [...arr]
  542. // })
  543. const res = await this.getQueryList(SERVICE_ID.departureTableLtId, { departureAirport: this.formData.currentAirport, startTime: this.startDate, endTime: this.endDate, inFlightNO: null, flightNO: null }, 1, 9999)
  544. if (Number(res.code) === 0) {
  545. this.initTableData(res.returnData.listValues)
  546. } else {
  547. }
  548. this.loading = false
  549. } catch (error) {
  550. console.log(error)
  551. if (this.loopEvent) {
  552. clearInterval(this.loopEvent)
  553. this.loopEvent = null
  554. }
  555. this.loading = false
  556. }
  557. },
  558. initTableData (tableData) {
  559. const currentTime = new Date()
  560. const curTime = this.formatTime(currentTime)
  561. this.baggageCount = 0
  562. tableData.forEach(item => {
  563. if (item['actualDepartureTime'] && !item['flightCanceled']) {
  564. const now = new Date()
  565. const actualDepartureTime = new Date(item.actualDepartureTime.replace('T', ' '))
  566. if (now > actualDepartureTime) {
  567. item['hasTakeOff'] = true
  568. } else {
  569. item['hasTakeOff'] = false
  570. }
  571. } else {
  572. item['hasTakeOff'] = false
  573. }
  574. if (!item['hasTakeOff'] && item['outTransferBaggageCount'] - item['outTransferredBaggageCount'] > 0) {
  575. this.WarningData.forEach(p => {
  576. const startTime = this.formatTime(timeInZone((p.startDate ?? '').replace('T', ' '), this.timeZone), 2)
  577. const endTime = this.formatTime(timeInZone((p.endDate ?? '').replace('T', ' '), this.timeZone), 2)
  578. const planTime = this.formatTime(
  579. timeInZone((item.actualDepartureTime ?? '').replace('T', ' '), this.timeZone),
  580. 2
  581. )
  582. const capTime = Math.ceil((planTime - curTime) / (1000 * 60))
  583. if (Number(startTime) - Number(curTime) < 0 && Number(endTime) - Number(curTime) > 0) {
  584. const newItem = _.cloneDeep(item)
  585. if (p.flightNO != '' && p.flightNO == item.flightNO) {
  586. if (p.warningDuration && capTime - p.warningDuration < 0 && capTime - p.alarmDuration > 0) {
  587. item['warningState'] = 1
  588. const returnedTarget = Object.assign(newItem, p)
  589. this.sendLog(returnedTarget)
  590. }
  591. if (p.alarmDuration && capTime - p.alarmDuration < 0) {
  592. item['warningState'] = 2
  593. const returnedTarget = Object.assign(newItem, p)
  594. this.sendLog(returnedTarget)
  595. }
  596. } else if (p.flightNO == '' && p.IATACode != '') {
  597. if (item.flightNO.substring(0, 2) == p.IATACode) {
  598. if (p.warningDuration && capTime - p.warningDuration < 0 && capTime - p.alarmDuration > 0) {
  599. item['warningState'] = 1
  600. const returnedTarget = Object.assign(newItem, p)
  601. this.sendLog(returnedTarget)
  602. }
  603. if (p.alarmDuration && capTime - p.alarmDuration < 0) {
  604. item['warningState'] = 2
  605. const returnedTarget = Object.assign(newItem, p)
  606. this.sendLog(returnedTarget)
  607. }
  608. }
  609. }
  610. }
  611. })
  612. }
  613. this.baggageCount = this.baggageCount + Number(item.outTransferBaggageCount)
  614. })
  615. this.tableData = this._.sortBy(tableData, ['actualDepartureTime', 'flightNO', 'actualLandingTime', 'preFlightNO'])
  616. setTableFilters(this.tableData, this.tableDataFilters)
  617. this.toOrderNum(this.baggageCount)
  618. this.$nextTick(() => {
  619. this.setTableScroll()
  620. })
  621. },
  622. formatTime (date, type = 1) {
  623. let time = null
  624. if (type == 1) {
  625. time = parseTime(date, '{y}-{m}-{d} {h}:{i}:{s}')
  626. } else {
  627. time = date
  628. }
  629. const newTimt = new Date(time)
  630. return newTimt.getTime()
  631. },
  632. async sendLog (obj) {
  633. try {
  634. const newObj = {
  635. logTime: parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}'),
  636. logInfo: JSON.stringify(obj),
  637. flightNO: obj.flightNO,
  638. flightDate: obj.flightDate,
  639. luggageSN: '',
  640. strategyUseID: obj.alarmStrategyID,
  641. event: 1
  642. }
  643. await GeneralDataReception({
  644. serviceId: SERVICE_ID.departureScId,
  645. dataContent: JSON.stringify(newObj)
  646. })
  647. } catch (error) {
  648. this.$message.error('失败')
  649. }
  650. },
  651. setTableScroll () {
  652. this.leaveCount = 0
  653. this.dealedTableData.forEach(row => {
  654. if (row['hasTakeOff'] && !row['flightCanceled']) {
  655. this.leaveCount++
  656. }
  657. })
  658. if (!this.singleDay || this.hasSetTableScroll || this.leaveCount === 0) {
  659. return
  660. }
  661. const table = this.$refs['table'].$el
  662. const scrollParent = table.querySelector('.el-table__body-wrapper')
  663. if (scrollParent.scrollHeight <= scrollParent.offsetHeight) {
  664. return
  665. }
  666. const lastRow = table.querySelectorAll('.el-table__body tr')[this.leaveCount - 1]
  667. setTimeout(() => {
  668. const scrollMid = lastRow.offsetTop + lastRow.offsetHeight - scrollParent.offsetHeight / 2
  669. const scrollMax = scrollParent.scrollHeight - scrollParent.offsetHeight
  670. if (scrollMid > 0) {
  671. const scrollHeight = Math.min(scrollMid, scrollMax)
  672. scrollParent.scrollTo(0, scrollHeight)
  673. }
  674. }, 0)
  675. this.hasSetTableScroll = true
  676. },
  677. setNumberTransform () {
  678. const numberItems = this.$refs.numberItem // 拿到数字的ref,计算元素数量
  679. const numberArr = this.orderNum.filter(item => !isNaN(item))
  680. // 结合CSS 对数字字符进行滚动,显示订单数量
  681. for (let index = 0; index < numberItems.length; index++) {
  682. const elem = numberItems[index]
  683. elem.style.transform = `translate(-50%, -${numberArr[index] * 10}%)`
  684. }
  685. },
  686. toOrderNum (num) {
  687. num = num.toString()
  688. if (num.length < 6) {
  689. num = '0' + num // 如未满八位数,添加"0"补位
  690. this.toOrderNum(num) // 递归添加"0"补位
  691. } else if (num.length >= 6) {
  692. this.orderNum = num.split('') // 将其便变成数据,渲染至滚动数组
  693. } else {
  694. // 订单总量数字超过八位显示异常
  695. this.$message.warning('总量数字过大')
  696. }
  697. this.setNumberTransform()
  698. },
  699. arraySpanMethod ({ row, column, rowIndex, columnIndex }) {
  700. for (let i = 0; i < 7; i++) {
  701. if (columnIndex === i) {
  702. const _row = this.spanArr[rowIndex]
  703. const _col = _row > 0 ? 1 : 0
  704. return {
  705. rowspan: _row,
  706. colspan: _col
  707. }
  708. }
  709. }
  710. },
  711. exportHandler (refName, tableName) {
  712. if (this.loading) {
  713. return
  714. }
  715. const table = this.$refs[refName].$el.cloneNode(true)
  716. const fileName = `${tableName}-${this.currentAirport}-${this.startDate}-${this.endDate}.xlsx`
  717. throttledExportToExcel(table, tableName, fileName, 2)
  718. }
  719. }
  720. }
  721. </script>
  722. <style
  723. lang="scss"
  724. scoped
  725. >
  726. .terminal-form-wrap {
  727. padding-top: 11px;
  728. padding-left: 5px;
  729. ::v-deep .form {
  730. display: flex;
  731. justify-content: space-between;
  732. .form-left {
  733. flex: 1;
  734. }
  735. .form-right {
  736. flex: 0 1 auto;
  737. }
  738. .el-form-item {
  739. margin-bottom: 0px;
  740. margin-right: 8px;
  741. button,
  742. input,
  743. optgroup,
  744. select,
  745. textarea {
  746. font-family: Helvetica, "Microsoft YaHei";
  747. font-size: 14px;
  748. }
  749. .el-switch__label {
  750. color: #303133;
  751. }
  752. .el-form-item__error {
  753. z-index: 10;
  754. }
  755. }
  756. .btn-img {
  757. position: relative;
  758. top: 6px;
  759. }
  760. }
  761. .box-item {
  762. position: relative;
  763. height: 50px;
  764. font-size: 18px;
  765. line-height: 32px;
  766. text-align: center;
  767. list-style: none;
  768. color: #2d7cff;
  769. writing-mode: vertical-lr;
  770. text-orientation: upright;
  771. /*文字禁止编辑*/
  772. -moz-user-select: none; /*火狐*/
  773. -webkit-user-select: none; /*webkit浏览器*/
  774. -ms-user-select: none; /*IE10*/
  775. -khtml-user-select: none; /*早期浏览器*/
  776. user-select: none;
  777. /* overflow: hidden; */
  778. p {
  779. line-height: 32px;
  780. writing-mode: horizontal-tb !important;
  781. text-orientation: none !important;
  782. /*文字禁止编辑*/
  783. -moz-user-select: none; /*火狐*/
  784. -webkit-user-select: none; /*webkit浏览器*/
  785. -ms-user-select: none; /*IE10*/
  786. -khtml-user-select: none; /*早期浏览器*/
  787. user-select: none;
  788. margin-top: 5px;
  789. }
  790. }
  791. /* 默认逗号设置 */
  792. .mark-item {
  793. width: 10px;
  794. height: 32px;
  795. margin-right: 5px;
  796. line-height: 10px;
  797. font-size: 18px;
  798. position: relative;
  799. & > span {
  800. position: absolute;
  801. width: 100%;
  802. bottom: 0;
  803. writing-mode: vertical-rl;
  804. text-orientation: upright;
  805. }
  806. }
  807. /*滚动数字设置*/
  808. .number-item {
  809. width: 41px;
  810. height: 42px;
  811. /* 背景图片 */
  812. // background: url(/images/text-bg-blue.png) no-repeat center center;
  813. // background-size: 100% 100%;
  814. // background: #ccc;
  815. list-style: none;
  816. margin-right: 5px;
  817. // background:rgba(250,250,250,1);
  818. border-radius: 4px;
  819. border: 3px solid rgb(221, 221, 221);
  820. & > span {
  821. position: relative;
  822. display: inline-block;
  823. margin-right: 10px;
  824. width: 100%;
  825. height: 100%;
  826. writing-mode: vertical-rl;
  827. text-orientation: upright;
  828. overflow: hidden;
  829. & > i {
  830. font-style: normal;
  831. position: absolute;
  832. top: 11px;
  833. left: 50%;
  834. transform: translate(-50%, -1%);
  835. transition: transform 1s ease-in-out;
  836. letter-spacing: 10px;
  837. }
  838. }
  839. }
  840. .number-item:last-child {
  841. margin-right: 0;
  842. }
  843. }
  844. .terminal-table {
  845. width: 100%;
  846. ::v-deep .table {
  847. width: 100%;
  848. .cell {
  849. padding: 0;
  850. text-align: center;
  851. font-size: 14px;
  852. font-family: Helvetica, "Microsoft YaHei";
  853. letter-spacing: 0;
  854. }
  855. .cell-click {
  856. cursor: pointer;
  857. color: #2d7cff;
  858. &.cell-clicked {
  859. color: purple;
  860. }
  861. }
  862. .el-table__header-wrapper,
  863. .el-table__fixed-header-wrapper {
  864. .cell {
  865. font-weight: bold;
  866. color: #101116;
  867. }
  868. .has-gutter {
  869. tr {
  870. .bgl-huang {
  871. background: #fcf0b1;
  872. }
  873. }
  874. }
  875. }
  876. .el-table__body-wrapper,
  877. .el-table__fixed-body-wrapper {
  878. tr.bgl-hui {
  879. background: #d2d6df;
  880. td {
  881. background: #d2d6df;
  882. }
  883. &.redBorder {
  884. position: relative;
  885. &::after {
  886. content: "";
  887. position: absolute;
  888. left: 0;
  889. bottom: 0;
  890. width: 100%;
  891. height: 2px;
  892. background: #e83f82;
  893. }
  894. }
  895. }
  896. }
  897. td.cell-toUnload {
  898. background: lightcoral !important;
  899. position: relative;
  900. &::after {
  901. content: "";
  902. display: block;
  903. width: 100%;
  904. height: 100%;
  905. position: absolute;
  906. top: 0;
  907. left: 0;
  908. border: 2px dashed red;
  909. }
  910. }
  911. td.cell-toUnloadNew {
  912. background: #fcf0b1 !important;
  913. position: relative;
  914. &::after {
  915. content: "";
  916. display: block;
  917. width: 100%;
  918. height: 100%;
  919. position: absolute;
  920. top: 0;
  921. left: 0;
  922. border: 2px dashed #e28913;
  923. }
  924. }
  925. .el-table__cell.is-hidden > * {
  926. visibility: visible;
  927. }
  928. }
  929. }
  930. </style>