index.vue 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962
  1. <!--
  2. * @Author: zk
  3. * @Date: 2022-01-17 10:39:22
  4. * @LastEditTime: 2022-06-28 10:04:17
  5. * @LastEditors: your name
  6. * @Description: 中转进港
  7. -->
  8. <template>
  9. <div class="transfer-in">
  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" :clearable="false" 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(1)">
  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(1)">搜索</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="['ti_timeIcon']">
  90. <TimeZoneSelector />
  91. </el-form-item> -->
  92. <el-form-item>
  93. <TimeZoneSelector />
  94. </el-form-item>
  95. <!-- <el-form-item v-is="['ti_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 } from '@/api/temp'
  151. import { GeneralDataReception } from '@/api/temp'
  152. import TableHeaderCell from '@/components/TableHeaderCell'
  153. import { setTableFilters, exportToExcel, 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: 'arrivalInfo',
  176. label: '进港航班',
  177. width: 180,
  178. fixed: 'left',
  179. children: [
  180. {
  181. prop: 'preFlightNO',
  182. label: '航班号',
  183. desc: '进港航班编号',
  184. width: 80,
  185. filterable: true,
  186. sortable: true
  187. },
  188. {
  189. prop: 'preFlightDate',
  190. label: '航班日期',
  191. desc: '指航班计划起飞日期(不变的,机票上),不是预计起飞日期(预计起飞时间可能多个),也不是实际起飞日期(实际起飞等于最后预计)',
  192. width: 100
  193. },
  194. {
  195. prop: 'preAirport',
  196. label: '起飞航站',
  197. desc: '指进港航班的起飞机场三字码',
  198. width: 100,
  199. filterable: true,
  200. sortable: true
  201. },
  202. {
  203. prop: 'actualLandingTime',
  204. label: '降落时间',
  205. desc: '根据优先级别显示时间。优先级别:1.实际降落时间,2.预计降落时间,3.计划降落时间',
  206. width: 100
  207. },
  208. {
  209. prop: 'landingBuild',
  210. label: '降落航站楼',
  211. desc: '指航班降落后位于机场的哪个航站楼',
  212. width: 98,
  213. filterable: true,
  214. sortable: true
  215. },
  216. {
  217. prop: 'carousel',
  218. label: '行李转盘',
  219. desc: '指航班到达后行李提取的地方,仅显示最新信息',
  220. width: 100,
  221. filterable: true,
  222. sortable: true
  223. },
  224. {
  225. prop: 'standForLanding',
  226. label: '降落停机位',
  227. desc: '指航班的停机位代码,数据是变化的,仅显示最新信息',
  228. width: 98,
  229. filterable: true,
  230. sortable: true
  231. },
  232. {
  233. prop: 'inTransferBaggageCount',
  234. label: '中转行李数',
  235. desc: '指航班在本航站预计需要中转至对应航班的行李数量'
  236. }
  237. ]
  238. },
  239. {
  240. prop: 'departureInfo',
  241. label: '离港航班',
  242. children: [
  243. {
  244. prop: 'inTransferredBaggageCount',
  245. label: '已中转行李数',
  246. desc: '指航班在本航站实际已经中转至对应航班的行李数量',
  247. width: 100
  248. },
  249. {
  250. prop: 'flightNO',
  251. label: '航班号',
  252. desc: '指航班编号',
  253. width: 80,
  254. filterable: true,
  255. sortable: true
  256. },
  257. {
  258. prop: 'flightDate',
  259. label: '航班日期',
  260. desc: '指航班计划起飞日期(不变的,机票上),不是预计起飞日期(预计起飞时间可能多个),也不是实际起飞日期(实际起飞等于最后预计)',
  261. width: 100
  262. },
  263. {
  264. prop: 'actualDepartureTime',
  265. label: '起飞时间',
  266. desc: '指航班预计起飞时间,数据是变化的,仅显示最新结果',
  267. width: 100
  268. },
  269. {
  270. prop: 'targetAirport',
  271. label: '目的站',
  272. desc: '指航班执飞航段的目的航站,以航站三字码+航站简称显示',
  273. filterable: true,
  274. sortable: true
  275. },
  276. {
  277. prop: 'departureBuild',
  278. label: '起飞航站楼',
  279. desc: '指航班执飞航段的起飞航站的航站楼',
  280. width: 98,
  281. filterable: true,
  282. sortable: true
  283. },
  284. {
  285. prop: 'bordingGate',
  286. label: '起飞登机口',
  287. desc: '指航班的登机口代码,数据是变化的,仅显示最新信息',
  288. width: 98,
  289. filterable: true,
  290. sortable: true
  291. },
  292. {
  293. prop: 'standForDepartrue',
  294. label: '起飞停机位',
  295. desc: '指航班的停机位代码,数据是变化的,仅显示最新信息',
  296. width: 98,
  297. filterable: true,
  298. sortable: true
  299. },
  300. // {
  301. // prop: 'outTransferBaggageCount',
  302. // label: '中转进行李数',
  303. // desc: '指其它航班预计中转至本航班的行李数量',
  304. // width: 100
  305. // },
  306. // {
  307. // prop: 'outTransferredBaggageCount',
  308. // label: '已中转进行李数',
  309. // desc: '指其它航班实际已中转至本航班的行李数量',
  310. // width: 120
  311. // },
  312. {
  313. prop: 'timeDifference',
  314. label: '转运时间',
  315. desc: '指中转动作完成时间'
  316. }
  317. ]
  318. }
  319. ],
  320. loading: false,
  321. AirportList: [],
  322. carrierProps: [],
  323. carrierPropsop: [],
  324. loopEvent: null,
  325. arrivalCount: 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. watch: {
  342. dealedTableData: {
  343. handler (val) {
  344. this.spanArr = []
  345. let contactDot = this.contactDot
  346. val.forEach((item, index, arr) => {
  347. if (index === 0) {
  348. this.spanArr.push(1)
  349. } else {
  350. if (
  351. item['preFlightNO'] === arr[index - 1]['preFlightNO'] &&
  352. item['preFlightDate'] === arr[index - 1]['preFlightDate']
  353. ) {
  354. this.spanArr[contactDot] += 1
  355. this.spanArr.push(0)
  356. } else {
  357. this.spanArr.push(1)
  358. contactDot = index
  359. }
  360. }
  361. })
  362. },
  363. deep: true
  364. }
  365. },
  366. created () {
  367. // this.getAirPortData()
  368. },
  369. mounted () {
  370. this.$refs['form'].validateField('flightDate')
  371. this.getAirPortData()
  372. this.table = this.$refs.table.bodyWrapper
  373. const that = this
  374. this.table.addEventListener('scroll', () => {
  375. that.scrollTop = this.table.scrollTop
  376. })
  377. },
  378. activated () {
  379. const { currentAirport, startDate, endDate } = this.$route.query
  380. if ((currentAirport ?? '') !== '') {
  381. this.formData.currentAirport = currentAirport
  382. }
  383. if ((startDate ?? '') !== '') {
  384. this.formData.flightDate[0] = startDate
  385. }
  386. if ((endDate ?? '') !== '') {
  387. this.formData.flightDate[1] = endDate
  388. }
  389. this.table.scrollTop = this.scrollTop
  390. this.getTableData()
  391. this.getWarningData()
  392. this.loopEvent = setInterval(this.getTableData, LOOP_INTERVAL.transferArrivalTable)
  393. },
  394. deactivated () {
  395. if (this.loopEvent) {
  396. clearInterval(this.loopEvent)
  397. this.loopEvent = null
  398. }
  399. },
  400. beforeDestroy () {
  401. if (this.loopEvent) {
  402. clearInterval(this.loopEvent)
  403. this.loopEvent = null
  404. }
  405. },
  406. methods: {
  407. async getWarningData () {
  408. try {
  409. // const res = await TempQuery({
  410. // id: SERVICE_ID.departureWarningId,
  411. // dataContent: []
  412. // })
  413. const res = await this.getQueryList(SERVICE_ID.departureWarningId, {}, 1, 999)
  414. if (Number(res.code) === 0) {
  415. const { listValues } = res.returnData
  416. this.WarningData = listValues
  417. } else {
  418. this.$message.error(res.message)
  419. }
  420. } catch (error) {
  421. this.$message.error('失败')
  422. }
  423. },
  424. resetLoopEvent () {
  425. this.loading = true
  426. this.hasSetTableScroll = false
  427. this.loopEvent && clearInterval(this.loopEvent)
  428. this.getTableData()
  429. this.loopEvent = setInterval(this.getTableData, LOOP_INTERVAL.transferArrivalTable)
  430. },
  431. headerCellClass ({ row, column }) {
  432. const classes = []
  433. const rule = this.tableDataSortRules[column.property]
  434. if (rule) {
  435. classes.push(rule)
  436. }
  437. return classes.join(' ')
  438. },
  439. tableRowClassName ({ row, rowIndex }) {
  440. const classes = []
  441. if (row.hasArrived) {
  442. classes.push('bgl-hui')
  443. if (rowIndex === this.arrivalCount - 1) {
  444. classes.push('redBorder')
  445. }
  446. }
  447. return classes.join(' ')
  448. },
  449. changeView () {
  450. const query = {
  451. currentAirport: this.formData.currentAirport,
  452. startDate: this.startDate,
  453. endDate: this.endDate
  454. }
  455. this.$router.push({
  456. path: '/transfer/departure',
  457. query
  458. })
  459. },
  460. airPortChange () {
  461. this.getAviationData()
  462. this.upAviationData()
  463. this.resetLoopEvent()
  464. },
  465. dateChangeHandler () {
  466. this.getAviationData()
  467. this.upAviationData()
  468. this.resetLoopEvent()
  469. },
  470. // 选择机场
  471. async getAirPortData () {
  472. try {
  473. const res = await this.getQueryListAuth(SERVICE_ID.departureAirId, {}, 1, 9999, 280)
  474. if (Number(res.code) === 0) {
  475. if (res.returnData?.listValues?.length) {
  476. this.AirportList = this._.orderBy(res.returnData.listValues, o => o.planDepartureApt)
  477. if (!this.formData.currentAirport) {
  478. const defaultAirport = 'CAN'
  479. let currentAirport = res.returnData.listValues[0].planDepartureApt
  480. if (res.returnData.listValues.some(item => item.planDepartureApt === defaultAirport)) {
  481. currentAirport = defaultAirport
  482. }
  483. this.formData.currentAirport = currentAirport
  484. }
  485. this.getAviationData()
  486. this.upAviationData()
  487. this.resetLoopEvent()
  488. } else {
  489. this.$message.warning('无航站数据权限')
  490. }
  491. } else {
  492. this.$message.error(res.message)
  493. }
  494. } catch (error) {
  495. this.$message.error('失败')
  496. }
  497. },
  498. // 选择航司
  499. async getAviationData () {
  500. try {
  501. // const res = await TempQuery({
  502. // id: SERVICE_ID.departureAviJoinId,
  503. // dataContent: [this.formData.currentAirport]
  504. // })
  505. const res = await this.getQueryListAuth(SERVICE_ID.departureAviJoinId, {}, 1, 9999, 281)
  506. if (Number(res.code) === 0) {
  507. this.carrierProps = res.returnData.listValues
  508. } else {
  509. this.$message.error(res.message)
  510. }
  511. } catch (error) {
  512. this.$message.error('失败')
  513. }
  514. },
  515. // 选择航司
  516. async upAviationData () {
  517. try {
  518. // const res = await TempQuery({
  519. // id: SERVICE_ID.departureAviLeaveId,
  520. // dataContent: [this.formData.currentAirport]
  521. // })
  522. const res = await this.getQueryListAuth(SERVICE_ID.departureAviLeaveId, {}, 1, 9999, 281)
  523. if (Number(res.code) === 0) {
  524. this.carrierPropsop = res.returnData.listValues
  525. } else {
  526. this.$message.error(res.message)
  527. }
  528. } catch (error) {
  529. this.$message.error('失败')
  530. }
  531. },
  532. // 获取表单下拉框数据
  533. // getFormData(params) {
  534. // this.relatedAirportQuery({
  535. // ...params,
  536. // type: 'OUT'
  537. // })
  538. // this.outgoingAirlineQuery(params)
  539. // this.craftTypeQuery(params)
  540. // this.flightAttrQuery(params)
  541. // },
  542. // 获取表格数据
  543. async getTableData () {
  544. if (!this.formData.currentAirport || !this.startDate || !this.endDate) {
  545. return
  546. }
  547. // const arrs1 = [this.formData.inboundCarrier.length === 0 ? '' : this.formData.inboundCarrier[0]]
  548. // const arrs2 = [this.formData.outgoingAirline.length === 0 ? '' : this.formData.outgoingAirline[0]]
  549. // const arr = [
  550. // this.formData.currentAirport,
  551. // this.startDate,
  552. // this.endDate,
  553. // ...arrs1,
  554. // ...arrs1,
  555. // ...arrs1,
  556. // ...arrs2,
  557. // ...arrs2,
  558. // ...arrs2
  559. // // this.formData.inboundCarrier,
  560. // // this.formData.outgoingAirline,
  561. // // JSON.stringify(this.formData.inboundCarrier),
  562. // // JSON.stringify(this.formData.outgoingAirline),
  563. // ]
  564. try {
  565. // const res = await TempQuery({
  566. // id: SERVICE_ID.departureTableId,
  567. // dataContent: [...arr]
  568. // })
  569. const res = await this.getQueryList(SERVICE_ID.departureTableId, { departureAirport: this.formData.currentAirport, flightDateStart: this.startDate, flightDateEnd: this.endDate, inFlightNO: null, flightNO: null }, 1, 9999)
  570. if (Number(res.code) === 0) {
  571. this.initTableData(res.returnData.listValues)
  572. } else {
  573. }
  574. this.loading = false
  575. } catch (error) {
  576. if (this.loopEvent) {
  577. clearInterval(this.loopEvent)
  578. this.loopEvent = null
  579. }
  580. this.loading = false
  581. }
  582. },
  583. initTableData (tableData) {
  584. const currentTime = new Date()
  585. const curTime = this.formatTime(currentTime)
  586. this.baggageCount = 0
  587. tableData.forEach(item => {
  588. if (item['actualLandingTime'] && !item['flightCanceled']) {
  589. const now = new Date()
  590. const actualLandingTime = new Date(item['actualLandingTime'].replace('T', ' '))
  591. if (now > actualLandingTime) {
  592. item['hasArrived'] = true
  593. } else {
  594. item['hasArrived'] = false
  595. }
  596. } else {
  597. item['hasArrived'] = false
  598. }
  599. const o1 = item['inTransferBaggageCount']
  600. const o2 = item['inTransferredBaggageCount']
  601. const out1 = o1 != undefined || o1 != null ? o1 : 0
  602. const out2 = o2 != undefined || o2 != null ? o2 : 0
  603. if (item['hasArrived'] && out1 - out2 > 0) {
  604. this.WarningData.forEach(p => {
  605. const startTime = this.formatTime(timeInZone((p.startDate ?? '').replace('T', ' '), this.timeZone), 2)
  606. const endTime = this.formatTime(timeInZone((p.endDate ?? '').replace('T', ' '), this.timeZone), 2)
  607. const planTime = this.formatTime(
  608. timeInZone((item.actualDepartureTime ?? '').replace('T', ' '), this.timeZone),
  609. 2
  610. )
  611. const capTime = Math.ceil((planTime - curTime) / (1000 * 60))
  612. if (Number(startTime) - Number(curTime) < 0 && Number(endTime) - Number(curTime) > 0) {
  613. const newItem = _.cloneDeep(item)
  614. if (p.flightNO != '' && p.flightNO == item.flightNO) {
  615. if (p.warningDuration && capTime - p.warningDuration < 0 && capTime - p.alarmDuration > 0) {
  616. item['warningState'] = 1
  617. const returnedTarget = Object.assign(newItem, p)
  618. this.sendLog(returnedTarget)
  619. }
  620. if (p.alarmDuration && capTime - p.alarmDuration < 0) {
  621. item['warningState'] = 2
  622. const returnedTarget = Object.assign(newItem, p)
  623. this.sendLog(returnedTarget)
  624. }
  625. } else if (p.flightNO == '' && p.IATACode != '') {
  626. if (item.flightNO.substring(0, 2) == p.IATACode) {
  627. if (p.warningDuration && capTime - p.warningDuration < 0 && capTime - p.alarmDuration > 0) {
  628. item['warningState'] = 1
  629. const returnedTarget = Object.assign(newItem, p)
  630. this.sendLog(returnedTarget)
  631. }
  632. if (p.alarmDuration && capTime - p.alarmDuration < 0) {
  633. item['warningState'] = 2
  634. const returnedTarget = Object.assign(newItem, p)
  635. this.sendLog(returnedTarget)
  636. }
  637. }
  638. }
  639. }
  640. })
  641. }
  642. this.baggageCount = this.baggageCount + Number(item.inTransferBaggageCount)
  643. })
  644. this.tableData = this._.sortBy(tableData, ['actualLandingTime', 'preFlightNO', 'actualDepartureTime', 'flightNO'])
  645. setTableFilters(this.tableData, this.tableDataFilters)
  646. this.toOrderNum(this.baggageCount)
  647. this.$nextTick(() => {
  648. this.setTableScroll()
  649. })
  650. },
  651. formatTime (date, type = 1) {
  652. let time = null
  653. if (type == 1) {
  654. time = parseTime(date, '{y}-{m}-{d} {h}:{i}:{s}')
  655. } else {
  656. time = date
  657. }
  658. const newTimt = new Date(time)
  659. return newTimt.getTime()
  660. },
  661. async sendLog (obj) {
  662. try {
  663. const newObj = {
  664. logTime: parseTime(new Date(), '{y}-{m}-{d} {h}:{i}:{s}'),
  665. logInfo: JSON.stringify(obj),
  666. flightNO: obj.flightNO,
  667. flightDate: obj.flightDate,
  668. luggageSN: '',
  669. strategyUseID: obj.alarmStrategyID,
  670. event: 1
  671. }
  672. await GeneralDataReception({
  673. serviceId: SERVICE_ID.departureScId,
  674. dataContent: JSON.stringify(newObj)
  675. })
  676. } catch (error) {
  677. this.$message.error('失败')
  678. }
  679. },
  680. setTableScroll () {
  681. this.arrivalCount = 0
  682. this.dealedTableData.forEach(row => {
  683. if (row['hasArrived']) {
  684. this.arrivalCount++
  685. }
  686. })
  687. if (!this.singleDay || this.hasSetTableScroll || this.arrivalCount === 0) {
  688. return
  689. }
  690. const table = this.$refs['table'].$el
  691. const scrollParent = table.querySelector('.el-table__body-wrapper')
  692. if (scrollParent.scrollHeight <= scrollParent.offsetHeight) {
  693. return
  694. }
  695. const lastRow = table.querySelectorAll('.el-table__body tr')[this.arrivalCount - 1]
  696. setTimeout(() => {
  697. const scrollMid = lastRow.offsetTop + lastRow.offsetHeight - scrollParent.offsetHeight / 2
  698. const scrollMax = scrollParent.scrollHeight - scrollParent.offsetHeight
  699. if (scrollMid > 0) {
  700. const scrollHeight = Math.min(scrollMid, scrollMax)
  701. scrollParent.scrollTo(0, scrollHeight)
  702. }
  703. }, 0)
  704. this.hasSetTableScroll = true
  705. },
  706. setNumberTransform () {
  707. const numberItems = this.$refs.numberItem // 拿到数字的ref,计算元素数量
  708. const numberArr = this.orderNum.filter(item => !isNaN(item))
  709. // 结合CSS 对数字字符进行滚动,显示订单数量
  710. for (let index = 0; index < numberItems.length; index++) {
  711. const elem = numberItems[index]
  712. elem.style.transform = `translate(-50%, -${numberArr[index] * 10}%)`
  713. }
  714. },
  715. toOrderNum (num) {
  716. num = num.toString()
  717. if (num.length < 6) {
  718. num = '0' + num // 如未满八位数,添加"0"补位
  719. this.toOrderNum(num) // 递归添加"0"补位
  720. } else if (num.length >= 6) {
  721. this.orderNum = num.split('') // 将其便变成数据,渲染至滚动数组
  722. } else {
  723. // 订单总量数字超过八位显示异常
  724. this.$message.warning('总量数字过大')
  725. }
  726. this.setNumberTransform()
  727. },
  728. arraySpanMethod ({ row, column, rowIndex, columnIndex }) {
  729. for (let i = 0; i < 7; i++) {
  730. if (columnIndex === i) {
  731. const _row = this.spanArr[rowIndex]
  732. const _col = _row > 0 ? 1 : 0
  733. return {
  734. rowspan: _row,
  735. colspan: _col
  736. }
  737. }
  738. }
  739. },
  740. exportHandler (refName, tableName) {
  741. if (this.loading) {
  742. return
  743. }
  744. const table = this.$refs[refName].$el.cloneNode(true)
  745. const fileName = `${tableName}-${this.currentAirport}-${this.startDate}-${this.endDate}.xlsx`
  746. exportToExcel(table, tableName, fileName, 2)
  747. }
  748. }
  749. }
  750. </script>
  751. <style
  752. lang="scss"
  753. scoped
  754. >
  755. .terminal-form-wrap {
  756. padding-top: 11px;
  757. padding-left: 5px;
  758. ::v-deep .form {
  759. display: flex;
  760. justify-content: space-between;
  761. .form-left {
  762. flex: 1;
  763. }
  764. .form-right {
  765. flex: 0 1 auto;
  766. }
  767. .el-form-item {
  768. margin-bottom: 0px;
  769. margin-right: 8px;
  770. button,
  771. input,
  772. optgroup,
  773. select,
  774. textarea {
  775. font-family: Helvetica, "Microsoft YaHei";
  776. font-size: 14px;
  777. }
  778. .el-switch__label {
  779. color: #303133;
  780. }
  781. .el-form-item__error {
  782. z-index: 10;
  783. }
  784. }
  785. .btn-img {
  786. position: relative;
  787. top: 6px;
  788. }
  789. }
  790. .box-item {
  791. position: relative;
  792. height: 50px;
  793. font-size: 18px;
  794. line-height: 32px;
  795. text-align: center;
  796. list-style: none;
  797. color: #2f3480;
  798. writing-mode: vertical-lr;
  799. text-orientation: upright;
  800. /*文字禁止编辑*/
  801. -moz-user-select: none; /*火狐*/
  802. -webkit-user-select: none; /*webkit浏览器*/
  803. -ms-user-select: none; /*IE10*/
  804. -khtml-user-select: none; /*早期浏览器*/
  805. user-select: none;
  806. /* overflow: hidden; */
  807. p {
  808. line-height: 32px;
  809. writing-mode: horizontal-tb !important;
  810. text-orientation: none !important;
  811. /*文字禁止编辑*/
  812. -moz-user-select: none; /*火狐*/
  813. -webkit-user-select: none; /*webkit浏览器*/
  814. -ms-user-select: none; /*IE10*/
  815. -khtml-user-select: none; /*早期浏览器*/
  816. user-select: none;
  817. margin-top: 5px;
  818. }
  819. }
  820. /* 默认逗号设置 */
  821. .mark-item {
  822. width: 10px;
  823. height: 32px;
  824. margin-right: 5px;
  825. line-height: 10px;
  826. font-size: 18px;
  827. position: relative;
  828. & > span {
  829. position: absolute;
  830. width: 100%;
  831. bottom: 0;
  832. writing-mode: vertical-rl;
  833. text-orientation: upright;
  834. }
  835. }
  836. /*滚动数字设置*/
  837. .number-item {
  838. width: 41px;
  839. height: 42px;
  840. /* 背景图片 */
  841. // background: url(/images/text-bg-blue.png) no-repeat center center;
  842. // background-size: 100% 100%;
  843. // background: #ccc;
  844. list-style: none;
  845. margin-right: 5px;
  846. // background:rgba(250,250,250,1);
  847. border-radius: 4px;
  848. border: 3px solid rgb(221, 221, 221);
  849. & > span {
  850. position: relative;
  851. display: inline-block;
  852. margin-right: 10px;
  853. width: 100%;
  854. height: 100%;
  855. writing-mode: vertical-rl;
  856. text-orientation: upright;
  857. overflow: hidden;
  858. & > i {
  859. font-style: normal;
  860. position: absolute;
  861. top: 11px;
  862. left: 50%;
  863. transform: translate(-50%, -1%);
  864. transition: transform 1s ease-in-out;
  865. letter-spacing: 10px;
  866. }
  867. }
  868. }
  869. .number-item:last-child {
  870. margin-right: 0;
  871. }
  872. }
  873. .terminal-table {
  874. width: 100%;
  875. ::v-deep .table {
  876. width: 100%;
  877. .cell {
  878. padding: 0;
  879. text-align: center;
  880. font-size: 14px;
  881. font-family: Helvetica, "Microsoft YaHei";
  882. letter-spacing: 0;
  883. }
  884. .cell-click {
  885. cursor: pointer;
  886. color: #2f3480;
  887. &.cell-clicked {
  888. color: purple;
  889. }
  890. }
  891. .el-table__header-wrapper,
  892. .el-table__fixed-header-wrapper {
  893. .cell {
  894. font-weight: bold;
  895. color: #101116;
  896. }
  897. .has-gutter {
  898. tr {
  899. .bgl-huang {
  900. background: #fcf0b1;
  901. }
  902. }
  903. }
  904. }
  905. .el-table__body-wrapper,
  906. .el-table__fixed-body-wrapper {
  907. tr.bgl-hui {
  908. background: #d2d6df;
  909. td {
  910. background: #d2d6df;
  911. }
  912. &.redBorder {
  913. position: relative;
  914. &::after {
  915. content: "";
  916. position: absolute;
  917. left: 0;
  918. bottom: 0;
  919. width: 100%;
  920. height: 2px;
  921. background: #e83f82;
  922. }
  923. }
  924. }
  925. }
  926. td.cell-toUnload {
  927. background: lightcoral !important;
  928. position: relative;
  929. &::after {
  930. content: "";
  931. display: block;
  932. width: 100%;
  933. height: 100%;
  934. position: absolute;
  935. top: 0;
  936. left: 0;
  937. border: 2px dashed red;
  938. }
  939. }
  940. td.cell-toUnloadNew {
  941. background: #fcf0b1 !important;
  942. position: relative;
  943. &::after {
  944. content: "";
  945. display: block;
  946. width: 100%;
  947. height: 100%;
  948. position: absolute;
  949. top: 0;
  950. left: 0;
  951. border: 2px dashed #e28913;
  952. }
  953. }
  954. .el-table__cell.is-hidden > * {
  955. visibility: visible;
  956. }
  957. }
  958. }
  959. </style>