index.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689
  1. <!--
  2. * @Author: zk
  3. * @Date: 2022-01-17 10:39:22
  4. * @LastEditTime: 2022-05-25 17:55:08
  5. * @LastEditors: your name
  6. * @Description: 离港01
  7. -->
  8. <template>
  9. <div class="departure-one">
  10. <!--功能区-表单-->
  11. <div class="departure-form">
  12. <el-form
  13. ref="form"
  14. :inline="true"
  15. :model="formData"
  16. :rules="rules"
  17. class="form"
  18. >
  19. <el-form-item prop="currentAirport">
  20. <!-- <el-cascader
  21. v-model="formData.currentAirport"
  22. style="width:144px;margin-left:10px"
  23. placeholder="全部机场"
  24. size="small"
  25. :options="currentAirportList"
  26. :props="currentAirportProps"
  27. collapse-tags
  28. clearable
  29. filterable
  30. @change="setCurrentAirport"
  31. /> -->
  32. <el-select
  33. v-model="formData.currentAirport"
  34. size="small"
  35. filterable
  36. placeholder="请选择机场"
  37. @change="airPortChange"
  38. >
  39. <el-option
  40. v-for="(item,index) in AirportList"
  41. :key="index"
  42. :label="item.PlanDepartureApt"
  43. :value="item.PlanDepartureApt"
  44. />
  45. </el-select>
  46. </el-form-item>
  47. <el-form-item prop="startDate">
  48. <el-date-picker
  49. v-model="formData.startDate"
  50. style="width:216px;"
  51. size="small"
  52. type="date"
  53. value-format="yyyy-MM-dd"
  54. placeholder="开始时间"
  55. @change="setStartDate"
  56. />
  57. </el-form-item>
  58. <el-form-item prop="endDate">
  59. <el-date-picker
  60. v-model="formData.endDate"
  61. style="width:216px;"
  62. size="small"
  63. type="date"
  64. value-format="yyyy-MM-dd"
  65. placeholder="结束时间"
  66. @change="setEndDate"
  67. />
  68. </el-form-item>
  69. <el-form-item>
  70. <div class="box-item">
  71. <p>预计装载总数:</p>
  72. <li
  73. v-for="(item,index) in orderNum"
  74. :key="index"
  75. :class="{'number-item': !isNaN(item), 'mark-item': isNaN(item) }"
  76. >
  77. <span v-if="!isNaN(item)">
  78. <i ref="numberItem">0123456789</i>
  79. </span>
  80. <span
  81. v-else
  82. class="comma"
  83. >{{ item }}</span>
  84. </li>
  85. </div>
  86. </el-form-item>
  87. <div
  88. style="float:right"
  89. @keyup.enter="onSubmit(0)"
  90. >
  91. <el-form-item prop="search">
  92. <el-input
  93. v-model="formData.search"
  94. style="width:240px;margin-left:105px;"
  95. size="small"
  96. placeholder="请输入内容"
  97. prefix-icon="el-icon-search"
  98. clearable
  99. @clear="inputClear"
  100. />
  101. </el-form-item>
  102. <el-form-item>
  103. <el-button
  104. size="small"
  105. type="primary"
  106. @click="onSubmit(0)"
  107. >搜索</el-button>
  108. </el-form-item>
  109. <!-- <el-form-item>
  110. <el-switch
  111. v-model="formData.switch"
  112. style="margin-left:40px;"
  113. active-text="显示中转"
  114. />
  115. </el-form-item> -->
  116. <el-form-item v-is="['i_timeIcon']">
  117. <TimeZoneSelector />
  118. </el-form-item>
  119. <el-form-item>
  120. <img
  121. class="btn-img"
  122. src="../../../../assets/baggage/ic_setting.png"
  123. @click="show"
  124. >
  125. </el-form-item>
  126. <!-- <el-form-item>
  127. <el-button
  128. class="btn-square setBtn"
  129. type="primary"
  130. icon="el-icon-s-tools"
  131. size="mini"
  132. @click="show"
  133. />
  134. </el-form-item> -->
  135. </div>
  136. </el-form>
  137. </div>
  138. <!--表格-->
  139. <div
  140. v-loading="loading"
  141. class="departure-table"
  142. element-loading-text="拼命加载中"
  143. element-loading-spinner="el-icon-loading"
  144. element-loading-background="rgba(0, 0, 0, 0.8)"
  145. >
  146. <el-table
  147. ref="table"
  148. class="table"
  149. height="calc(100vh - 177px)"
  150. :data="filteredTableData"
  151. :header-cell-class-name="headerCellClassName"
  152. :row-class-name="tableRowClassName"
  153. show-summary
  154. :summary-method="summaryMethod"
  155. :cell-class-name="cellClass"
  156. border
  157. stripe
  158. fit
  159. @cell-click="cellClickHandler"
  160. >
  161. <el-table-column
  162. v-for="col in tableColsCopy"
  163. :key="col.prop"
  164. :prop="col.prop"
  165. :label="col.label"
  166. :width="col.width"
  167. :formatter="tableFormat"
  168. >
  169. <template slot="header">
  170. <el-tooltip
  171. :content="col.label"
  172. placement="top"
  173. >
  174. <div class="table-header-cell">
  175. <span>{{ col.label }}</span>
  176. <template v-if="tableDataFilters[col.prop]">
  177. <TableHeaderCellWithFilter
  178. :label="col.label"
  179. :filter-options="tableDataFilters[col.prop]"
  180. :filter-value.sync="filterValues[col.prop]"
  181. />
  182. </template>
  183. </div>
  184. </el-tooltip>
  185. </template>
  186. </el-table-column>
  187. </el-table>
  188. </div>
  189. <!--列设置-->
  190. <Dialog
  191. :flag="dialogFlag"
  192. class="dialog-check-cols"
  193. >
  194. <div class="col-dialog">
  195. <div class="title">列设置</div>
  196. <div class="content">
  197. <el-tree
  198. :data="tableCols"
  199. :class="colsCheckClass"
  200. show-checkbox
  201. node-key="index"
  202. :default-expand-all="true"
  203. :props="{
  204. label: 'label',
  205. children: 'children'
  206. }"
  207. :default-checked-keys="checkedKeysTemp"
  208. @check="handleCheck"
  209. />
  210. </div>
  211. <div class="foot right t30">
  212. <el-button
  213. size="medium"
  214. class="r24"
  215. type="primary"
  216. @click="onCheck"
  217. >确定</el-button>
  218. <el-button
  219. size="medium"
  220. @click="hide"
  221. >取消</el-button>
  222. </div>
  223. </div>
  224. </Dialog>
  225. </div>
  226. </template>
  227. <script>
  228. import Dialog from '@/layout/components/Dialog'
  229. import TimeZoneSelector from '@/components/TimeZoneSelector'
  230. import terminalMixin from '../../mixins/terminal'
  231. import formMixin from '../../mixins/form'
  232. import tableColsMixin from '../../mixins/tableCols'
  233. import timeZoneMixin from '../../mixins/timeZone'
  234. import { getQuery } from '@/api/flight'
  235. import TableHeaderCellWithFilter from '@/components/TableHeaderCellWithFilter'
  236. import { setTableFilters } from '@/utils/table'
  237. export default {
  238. name: 'DepartureTerminalView',
  239. components: { Dialog, TimeZoneSelector, TableHeaderCellWithFilter },
  240. mixins: [terminalMixin, formMixin, tableColsMixin, timeZoneMixin],
  241. data() {
  242. return {
  243. orderNum: ['0', '0', '0', '0', '0', '0'], // 默认总数
  244. // 初始表头
  245. tableCols: [
  246. {
  247. prop: 'FlightNO',
  248. label: '航班号',
  249. width: 80
  250. },
  251. {
  252. prop: 'FlightDate',
  253. label: '执飞日期',
  254. width: 105
  255. },
  256. {
  257. prop: 'PlanDepartureTime',
  258. label: '预计起飞时间',
  259. width: 150
  260. },
  261. {
  262. prop: 'TargetAirport',
  263. label: '目的站'
  264. },
  265. {
  266. prop: 'DepartureBuild',
  267. label: '航站楼'
  268. },
  269. {
  270. prop: 'BordingGate',
  271. label: '登机口'
  272. },
  273. {
  274. prop: 'StandForDepartrue',
  275. label: '停机位'
  276. },
  277. {
  278. prop: 'checkInTravellerNumber',
  279. label: '托运旅客'
  280. },
  281. {
  282. prop: 'checkInNumber',
  283. label: '值机数'
  284. },
  285. {
  286. prop: 'unActive',
  287. label: '未激活'
  288. },
  289. {
  290. prop: 'preLoad',
  291. label: '预计装载'
  292. },
  293. {
  294. prop: 'checkNumber',
  295. label: '安检'
  296. },
  297. {
  298. prop: 'sortNumber',
  299. label: '分拣'
  300. },
  301. {
  302. prop: 'loadNumber',
  303. label: '装车'
  304. },
  305. {
  306. prop: 'loadNumberCopy',
  307. label: '装机'
  308. },
  309. {
  310. prop: 'tounLoad',
  311. label: '待翻减'
  312. },
  313. {
  314. prop: 'unLoad',
  315. label: '已翻减'
  316. },
  317. {
  318. prop: 'noCheckInNumber',
  319. label: '取消托运'
  320. },
  321. {
  322. prop: 'noBSM',
  323. label: '无BSM'
  324. },
  325. {
  326. prop: 'riskWarning',
  327. label: '风险预警'
  328. },
  329. {
  330. prop: 'departureAnomaly',
  331. label: '离港异常'
  332. },
  333. {
  334. prop: 'midIn',
  335. label: '中转进行李'
  336. }
  337. ],
  338. AirportList: [],
  339. tableDataFilters: {
  340. FlightNO: [],
  341. FlightDate: [],
  342. PlanDepartureTime: [],
  343. TargetAirport: [],
  344. BordingGate: [],
  345. StandForDepartrue: [],
  346. DepartureBuild: []
  347. },
  348. filterValues: {
  349. FlightNO: '',
  350. FlightDate: '',
  351. PlanDepartureTime: '',
  352. TargetAirport: '',
  353. BordingGate: '',
  354. StandForDepartrue: '',
  355. DepartureBuild: ''
  356. },
  357. loopEvent: null,
  358. leaveCount: 0,
  359. baggageCount: 0
  360. }
  361. },
  362. computed: {
  363. filteredTableData() {
  364. return this.tableData.filter(item => {
  365. let flag = true
  366. Object.entries(this.filterValues).forEach(([key, value]) => {
  367. if (value !== '' && item[key] !== value) {
  368. flag = false
  369. }
  370. })
  371. return flag
  372. })
  373. }
  374. },
  375. created() {
  376. this.getAirPortData()
  377. },
  378. mounted() {
  379. const that = this
  380. this.loopEvent = setInterval(function () {
  381. that.getTableData()
  382. }, 3000)
  383. },
  384. beforeDestroy() {
  385. clearInterval(this.loopEvent)
  386. },
  387. methods: {
  388. airPortChange() {
  389. this.getTableData()
  390. },
  391. async getAirPortData() {
  392. try {
  393. const res = await getQuery({
  394. id: 65,
  395. dataContent: []
  396. })
  397. if (Number(res.code) === 0) {
  398. this.AirportList = this._.orderBy(res.returnData, o => o.PlanDepartureApt)
  399. this.formData.currentAirport = 'PEK'
  400. this.getTableData()
  401. } else {
  402. this.$message.error(res.message)
  403. }
  404. } catch (error) {
  405. console.log('出错了', error)
  406. }
  407. },
  408. tableRowClassName({ row, rowIndex }) {
  409. if (row.flightStatus === 'DLY') {
  410. return 'bgl-huang'
  411. }
  412. if (row.hasTakenOff === 0) {
  413. if (rowIndex === this.leaveCount - 1) {
  414. return 'bgl-hui redBorder'
  415. } else {
  416. return 'bgl-hui'
  417. }
  418. }
  419. },
  420. headerCellClassName({ row, column }) {
  421. if (['riskWarning', 'departureAnomaly', 'midIn'].includes(column.property)) {
  422. return 'bgl-huang'
  423. }
  424. },
  425. // 获取表单下拉框数据
  426. // getFormData(params) {
  427. // this.relatedAirportQuery({
  428. // ...params,
  429. // type: 'OUT'
  430. // })
  431. // this.outgoingAirlineQuery(params)
  432. // this.craftTypeQuery(params)
  433. // this.flightAttrQuery(params)
  434. // },
  435. // 获取表格数据
  436. async getTableData() {
  437. if (!this.formData.currentAirport) {
  438. return
  439. }
  440. const arr = [this.formData.currentAirport, this.formData.startDate, this.formData.endDate]
  441. try {
  442. const res = await getQuery({
  443. id: 66,
  444. dataContent: [...arr, ...arr, ...arr]
  445. })
  446. if (Number(res.code) === 0) {
  447. this.initTableData(res.returnData)
  448. } else {
  449. console.log(res.message)
  450. }
  451. } catch (error) {
  452. clearInterval(this.loopEvent)
  453. console.log('出错了', error)
  454. }
  455. },
  456. initTableData(tableData) {
  457. this.leaveCount = 0
  458. this.baggageCount = 0
  459. tableData.forEach(item => {
  460. if (item.hasTakenOff === 0) {
  461. this.leaveCount++
  462. }
  463. item['waitfanj'] = item['noCheckInNumber'] - item['unLoad']
  464. item['loadNumberCopy'] = item['loadNumber']
  465. this.baggageCount = this.baggageCount + item.preLoad
  466. })
  467. this.tableData = this._.sortBy(tableData, ['hasTakenOff', 'PlanDepartureTime'])
  468. setTableFilters(this.tableData, this.tableDataFilters)
  469. this.toOrderNum(this.baggageCount)
  470. // setInterval(() => {
  471. // this.baggageCount = this.baggageCount+1;
  472. // // 这里输入数字即可调用
  473. // }, 2000);
  474. },
  475. filterHandler(value, row, column) {
  476. const property = column['property']
  477. return row[property] === value
  478. },
  479. setNumberTransform() {
  480. const numberItems = this.$refs.numberItem // 拿到数字的ref,计算元素数量
  481. const numberArr = this.orderNum.filter(item => !isNaN(item))
  482. // 结合CSS 对数字字符进行滚动,显示订单数量
  483. for (let index = 0; index < numberItems.length; index++) {
  484. const elem = numberItems[index]
  485. elem.style.transform = `translate(-50%, -${numberArr[index] * 10}%)`
  486. }
  487. },
  488. toOrderNum(num) {
  489. num = num.toString()
  490. if (num.length < 6) {
  491. num = '0' + num // 如未满八位数,添加"0"补位
  492. this.toOrderNum(num) // 递归添加"0"补位
  493. } else if (num.length >= 6) {
  494. this.orderNum = num.split('') // 将其便变成数据,渲染至滚动数组
  495. } else {
  496. // 订单总量数字超过八位显示异常
  497. this.$message.warning('总量数字过大')
  498. }
  499. this.setNumberTransform()
  500. }
  501. }
  502. }
  503. </script>
  504. <style lang="scss" scoped>
  505. .departure-form {
  506. padding-top: 11px;
  507. padding-left: 5px;
  508. ::v-deep .form {
  509. .el-form-item {
  510. margin-bottom: 0px;
  511. margin-right: 8px;
  512. button,
  513. input,
  514. optgroup,
  515. select,
  516. textarea {
  517. font-family: Helvetica, 'Microsoft YaHei';
  518. font-size: 14px;
  519. }
  520. .el-switch__label {
  521. color: #303133;
  522. }
  523. .el-form-item__error {
  524. z-index: 10;
  525. }
  526. .el-button {
  527. &.btn-square {
  528. width: 30px;
  529. height: 30px;
  530. display: flex;
  531. align-items: center;
  532. justify-content: center;
  533. margin-top: 5px;
  534. }
  535. }
  536. }
  537. .btn-img {
  538. cursor: pointer;
  539. position: relative;
  540. top: 6px;
  541. }
  542. }
  543. .box-item {
  544. position: relative;
  545. height: 32px;
  546. font-size: 18px;
  547. line-height: 32px;
  548. text-align: center;
  549. list-style: none;
  550. color: #2d7cff;
  551. writing-mode: vertical-lr;
  552. text-orientation: upright;
  553. /*文字禁止编辑*/
  554. -moz-user-select: none; /*火狐*/
  555. -webkit-user-select: none; /*webkit浏览器*/
  556. -ms-user-select: none; /*IE10*/
  557. -khtml-user-select: none; /*早期浏览器*/
  558. user-select: none;
  559. /* overflow: hidden; */
  560. p {
  561. line-height: 32px;
  562. writing-mode: horizontal-tb !important;
  563. text-orientation: none !important;
  564. /*文字禁止编辑*/
  565. -moz-user-select: none; /*火狐*/
  566. -webkit-user-select: none; /*webkit浏览器*/
  567. -ms-user-select: none; /*IE10*/
  568. -khtml-user-select: none; /*早期浏览器*/
  569. user-select: none;
  570. margin-top: 5px;
  571. }
  572. }
  573. /* 默认逗号设置 */
  574. .mark-item {
  575. width: 10px;
  576. height: 32px;
  577. margin-right: 5px;
  578. line-height: 10px;
  579. font-size: 18px;
  580. position: relative;
  581. & > span {
  582. position: absolute;
  583. width: 100%;
  584. bottom: 0;
  585. writing-mode: vertical-rl;
  586. text-orientation: upright;
  587. }
  588. }
  589. /*滚动数字设置*/
  590. .number-item {
  591. width: 41px;
  592. height: 42px;
  593. /* 背景图片 */
  594. background: url(/images/text-bg-blue.png) no-repeat center center;
  595. background-size: 100% 100%;
  596. // background: #ccc;
  597. list-style: none;
  598. margin-right: 5px;
  599. // background:rgba(250,250,250,1);
  600. border-radius: 4px;
  601. border: 3px solid rgb(221, 221, 221);
  602. & > span {
  603. position: relative;
  604. display: inline-block;
  605. margin-right: 10px;
  606. width: 100%;
  607. height: 100%;
  608. writing-mode: vertical-rl;
  609. text-orientation: upright;
  610. overflow: hidden;
  611. & > i {
  612. font-style: normal;
  613. position: absolute;
  614. top: 11px;
  615. left: 50%;
  616. transform: translate(-50%, -1%);
  617. transition: transform 1s ease-in-out;
  618. letter-spacing: 10px;
  619. }
  620. }
  621. }
  622. .number-item:last-child {
  623. margin-right: 0;
  624. }
  625. }
  626. .departure-table {
  627. width: 100%;
  628. ::v-deep .table {
  629. width: 100%;
  630. .cell {
  631. padding: 0;
  632. text-align: center;
  633. font-size: 14px;
  634. font-family: Helvetica, 'Microsoft YaHei';
  635. letter-spacing: 0;
  636. }
  637. .cell-click {
  638. cursor: pointer;
  639. color: #2d7cff;
  640. &.cell-clicked {
  641. color: purple;
  642. }
  643. }
  644. .el-table__header-wrapper {
  645. .cell {
  646. font-weight: bold;
  647. color: #101116;
  648. }
  649. .has-gutter {
  650. tr {
  651. .bgl-huang {
  652. background: #fcf0b1;
  653. }
  654. }
  655. }
  656. }
  657. .el-table__body-wrapper {
  658. tr.bgl-hui {
  659. td {
  660. background: #d2d6df;
  661. }
  662. &.redBorder {
  663. position: relative;
  664. &::after {
  665. content: '';
  666. position: absolute;
  667. left: 0;
  668. bottom: 0;
  669. width: 100%;
  670. height: 2px;
  671. background: #e83f82;
  672. }
  673. }
  674. }
  675. tr.bgl-huang td {
  676. background: #fcf0b1;
  677. }
  678. .cell-warning {
  679. background: orange;
  680. }
  681. }
  682. }
  683. }
  684. </style>