index.vue 18 KB

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