index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. <!--
  2. * @Author: zk
  3. * @Date: 2022-01-17 10:39:22
  4. * @LastEditTime: 2022-05-12 17:36:10
  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.PlanLandingApt"
  43. :value="item.PlanLandingApt"
  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 style="float: right">
  88. <el-form-item
  89. prop="search"
  90. @keyup.enter="onSubmit(1)"
  91. >
  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(1)"
  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. <el-dropdown>
  118. <img
  119. class="checkTime msgImg"
  120. src="../../../../assets/departure/ic_time.png"
  121. >
  122. <el-dropdown-menu
  123. slot="dropdown"
  124. class="time-zone"
  125. >
  126. <el-dropdown-item>国内Local/国际UTC</el-dropdown-item>
  127. <el-dropdown-item>Local</el-dropdown-item>
  128. <el-dropdown-item>UTC</el-dropdown-item>
  129. </el-dropdown-menu>
  130. </el-dropdown>
  131. </el-form-item>
  132. <el-form-item>
  133. <img
  134. class="msgImg"
  135. src="../../../../assets/departure/ic_setting.png"
  136. @click="show"
  137. >
  138. </el-form-item>
  139. <!-- <el-form-item>
  140. <el-button
  141. class="btn-square setBtn"
  142. type="primary"
  143. icon="el-icon-s-tools"
  144. size="mini"
  145. @click="show"
  146. />
  147. </el-form-item> -->
  148. </div>
  149. </el-form>
  150. </div>
  151. <!--表格-->
  152. <div
  153. v-loading="loading"
  154. class="departure-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. :data="tableData"
  162. class="table"
  163. :height="computedTableHeight"
  164. :header-cell-class-name="tableCellClassName"
  165. :row-class-name="tableRowClassName"
  166. show-summary
  167. :summary-method="summaryMethod"
  168. border
  169. stripe
  170. @row-click="rowClick"
  171. >
  172. <el-table-column
  173. v-for="(item, index) in tableColsCopy"
  174. :key="index"
  175. :prop="item.statCode"
  176. :label="item.statName"
  177. :width="item.width"
  178. :filters="tableDataFilters[item.statCode]"
  179. :filter-method="
  180. tableDataFilters[item.statCode] && filterHandler
  181. "
  182. />
  183. </el-table>
  184. </div>
  185. <!--列设置-->
  186. <Dialog
  187. :flag="dialogFlag"
  188. class="dialog-check-cols"
  189. >
  190. <div class="col-dialog">
  191. <div class="title">列设置</div>
  192. <div class="content">
  193. <el-tree
  194. :data="tableCols"
  195. :class="colsCheckClass"
  196. show-checkbox
  197. node-key="index"
  198. :default-expand-all="true"
  199. :props="{
  200. label: 'statName',
  201. children: 'children',
  202. }"
  203. :default-checked-keys="checkedKeysTemp"
  204. @check="handleCheck"
  205. />
  206. </div>
  207. <div class="foot right t30">
  208. <el-button
  209. size="medium"
  210. class="r24"
  211. type="primary"
  212. @click="onCheck"
  213. >确定</el-button>
  214. <el-button
  215. size="medium"
  216. @click="hide"
  217. >取消</el-button>
  218. </div>
  219. </div>
  220. </Dialog>
  221. </div>
  222. </template>
  223. <script>
  224. import Dialog from '@/layout/components/Dialog'
  225. import terminalMixin from '../../mixins/terminal'
  226. import formMixin from '../../mixins/form'
  227. import tableColsMixin from '../../mixins/tableCols'
  228. import { getQuery } from '@/api/flight'
  229. export default {
  230. name: 'DepartureTerminalView',
  231. components: { Dialog },
  232. mixins: [terminalMixin, formMixin, tableColsMixin],
  233. data() {
  234. return {
  235. orderNum: ['0', '0', '0', '0'], // 默认总数
  236. // 初始表头
  237. tableCols: [
  238. {
  239. statCode: 'FlightNO',
  240. statName: '航班号',
  241. width: 100
  242. },
  243. {
  244. statCode: 'FlightDate',
  245. statName: '执飞日期',
  246. width: 105
  247. },
  248. {
  249. statCode: 'arrivalTime',
  250. statName: '到港时间',
  251. width: 150
  252. },
  253. {
  254. statCode: 'departureTerminal',
  255. statName: '起飞航站'
  256. },
  257. {
  258. statCode: 'arrivalTerminal',
  259. statName: '到达航站'
  260. },
  261. {
  262. statCode: 'luggageCarousel',
  263. statName: '行李转盘'
  264. },
  265. {
  266. statCode: 'parkingSpace',
  267. statName: '停机位'
  268. },
  269. {
  270. statCode: 'checkIns',
  271. statName: '值机数'
  272. },
  273. {
  274. statCode: 'projectedLoad',
  275. statName: '预计装载'
  276. },
  277. {
  278. statCode: 'loadedQuantity',
  279. statName: '已装载'
  280. },
  281. {
  282. statCode: 'numberOfDestinationArrivals',
  283. statName: '到达'
  284. },
  285. {
  286. statCode: 'endPointNotReached',
  287. statName: '未到达'
  288. },
  289. {
  290. statCode: 'specialQuantity',
  291. statName: '特殊'
  292. },
  293. {
  294. statCode: 'numberOfClaims',
  295. statName: '理赔'
  296. },
  297. {
  298. statCode: 'uninstalled',
  299. statName: '已卸载'
  300. },
  301. {
  302. statCode: 'numberToBeUninstalled',
  303. statName: '待卸载'
  304. },
  305. {
  306. statCode: 'terminateArrivalQuantity',
  307. statName: '到达'
  308. },
  309. {
  310. statCode: 'terminateUnreachedQuantity',
  311. statName: '未到达'
  312. },
  313. {
  314. statCode: 'quantityShipped',
  315. statName: '已交运'
  316. },
  317. {
  318. statCode: 'undeliveredQuantity',
  319. statName: '未交运'
  320. },
  321. {
  322. statCode: 'numberOfContainers',
  323. statName: '容器'
  324. },
  325. {
  326. statCode: 'numberOfBulk',
  327. statName: '散装'
  328. }
  329. ],
  330. AirportList: [],
  331. tableDataFilters: {
  332. FlightNO: [],
  333. FlightDate: [],
  334. asarrivalTime: [],
  335. departureTerminal: [],
  336. arrivalTerminal: [],
  337. luggageCarousel: [],
  338. parkingSpace: [],
  339. numberOfContainers: []
  340. },
  341. loopEvent: null,
  342. leaveCount: 0,
  343. baggageCount: 0
  344. }
  345. },
  346. created() {
  347. this.getAirPortData()
  348. },
  349. mounted() {
  350. const that = this
  351. this.loopEvent = setInterval(function () {
  352. that.getTableData()
  353. }, 3000)
  354. },
  355. beforeDestroy() {
  356. clearInterval(this.loopEvent)
  357. },
  358. methods: {
  359. airPortChange() {
  360. this.getTableData()
  361. },
  362. // 选择机场
  363. async getAirPortData() {
  364. try {
  365. const res = await getQuery({
  366. id: 67,
  367. dataContent: []
  368. })
  369. if (Number(res.code) === 0) {
  370. this.AirportList = res.returnData
  371. this.formData.currentAirport = 'PEK'
  372. this.getTableData()
  373. } else {
  374. this.$message.error(res.message)
  375. }
  376. } catch (error) {
  377. console.log('出错了', error)
  378. }
  379. },
  380. tableRowClassName({ row, rowIndex }) {
  381. if (row.hasTakenOff === 0) {
  382. if (rowIndex === this.leaveCount - 1) {
  383. return 'bgl-hui redBorder'
  384. } else {
  385. return 'bgl-hui'
  386. }
  387. }
  388. },
  389. tableCellClassName({ row, column }) {
  390. if (
  391. column.property === 'transfer_all' ||
  392. column.property === 'departureAnomaly' ||
  393. column.property === 'riskWarning'
  394. ) {
  395. return 'bgl-huang'
  396. }
  397. },
  398. // 获取表单下拉框数据
  399. // getFormData(params) {
  400. // this.relatedAirportQuery({
  401. // ...params,
  402. // type: 'OUT'
  403. // })
  404. // this.outgoingAirlineQuery(params)
  405. // this.craftTypeQuery(params)
  406. // this.flightAttrQuery(params)
  407. // },
  408. // 获取表格数据
  409. async getTableData() {
  410. const arr = [this.formData.currentAirport, this.formData.startDate, this.formData.endDate]
  411. try {
  412. const res = await getQuery({
  413. id: 38,
  414. dataContent: [...arr, ...arr, ...arr]
  415. })
  416. if (Number(res.code) === 0) {
  417. this.initTableData(res.returnData)
  418. } else {
  419. console.log(res.message)
  420. }
  421. } catch (error) {
  422. clearInterval(this.loopEvent)
  423. console.log('出错了', error)
  424. }
  425. },
  426. initTableData(tableData) {
  427. this.leaveCount = 0
  428. this.baggageCount = 0
  429. tableData.forEach(item => {
  430. if (item.hasTakenOff === 0) {
  431. this.leaveCount++
  432. }
  433. // item["waitfanj"] = item["noCheckInNumber"] - item["unLoad"];
  434. this.baggageCount = this.baggageCount + item.projectedLoad
  435. })
  436. this.tableData = this._.sortBy(tableData, ['FlightDate', 'PlanDepartureTime'])
  437. this.setTableFilters(this.tableData, this.tableDataFilters)
  438. this.toOrderNum(this.baggageCount)
  439. // setInterval(() => {
  440. // this.baggageCount = this.baggageCount+1;
  441. // // 这里输入数字即可调用
  442. // }, 2000);
  443. },
  444. // 表格添加过滤条件
  445. setTableFilters(tableData = this.tableData, filters = this.tableDataFilters) {
  446. const tempSets = {}
  447. Object.keys(filters).forEach(key => {
  448. tempSets[key] = new Set()
  449. })
  450. tableData.forEach(item => {
  451. Object.keys(tempSets).forEach(key => {
  452. ;(item[key] ?? '') !== '' && tempSets[key].add(item[key])
  453. })
  454. })
  455. Object.keys(tempSets).forEach(key => {
  456. filters[key] = this._.orderBy(
  457. [...tempSets[key]].map(value => ({
  458. text: value,
  459. value
  460. })),
  461. o => o.value
  462. )
  463. })
  464. },
  465. filterHandler(value, row, column) {
  466. const property = column['property']
  467. return row[property] === value
  468. },
  469. setNumberTransform() {
  470. const numberItems = this.$refs.numberItem // 拿到数字的ref,计算元素数量
  471. const numberArr = this.orderNum.filter(item => !isNaN(item))
  472. // 结合CSS 对数字字符进行滚动,显示订单数量
  473. for (let index = 0; index < numberItems.length; index++) {
  474. const elem = numberItems[index]
  475. elem.style.transform = `translate(-50%, -${numberArr[index] * 10}%)`
  476. }
  477. },
  478. toOrderNum(num) {
  479. num = num.toString()
  480. if (num.length < 4) {
  481. num = '0' + num // 如未满八位数,添加"0"补位
  482. this.toOrderNum(num) // 递归添加"0"补位
  483. } else if (num.length === 4) {
  484. this.orderNum = num.split('') // 将其便变成数据,渲染至滚动数组
  485. } else {
  486. // 订单总量数字超过八位显示异常
  487. this.$message.warning('总量数字过大')
  488. }
  489. this.setNumberTransform()
  490. }
  491. }
  492. }
  493. </script>
  494. <style lang="scss" scoped>
  495. .departure-form {
  496. padding-top: 11px;
  497. padding-left: 5px;
  498. ::v-deep .form {
  499. .el-form-item {
  500. margin-bottom: 0px;
  501. margin-right: 8px;
  502. button,
  503. input,
  504. optgroup,
  505. select,
  506. textarea {
  507. font-family: Helvetica, 'Microsoft YaHei';
  508. font-size: 14px;
  509. }
  510. .el-switch__label {
  511. color: #303133;
  512. }
  513. .el-form-item__error {
  514. z-index: 10;
  515. }
  516. .el-button {
  517. &.btn-square {
  518. width: 30px;
  519. height: 30px;
  520. display: flex;
  521. align-items: center;
  522. justify-content: center;
  523. margin-top: 5px;
  524. }
  525. }
  526. }
  527. .checkTime {
  528. margin: 0 16px;
  529. }
  530. .msgImg {
  531. cursor: pointer;
  532. position: relative;
  533. top: 6px;
  534. }
  535. }
  536. .box-item {
  537. position: relative;
  538. height: 32px;
  539. font-size: 18px;
  540. line-height: 32px;
  541. text-align: center;
  542. list-style: none;
  543. color: #2d7cff;
  544. writing-mode: vertical-lr;
  545. text-orientation: upright;
  546. /*文字禁止编辑*/
  547. -moz-user-select: none; /*火狐*/
  548. -webkit-user-select: none; /*webkit浏览器*/
  549. -ms-user-select: none; /*IE10*/
  550. -khtml-user-select: none; /*早期浏览器*/
  551. user-select: none;
  552. /* overflow: hidden; */
  553. p {
  554. line-height: 32px;
  555. writing-mode: horizontal-tb !important;
  556. text-orientation: none !important;
  557. /*文字禁止编辑*/
  558. -moz-user-select: none; /*火狐*/
  559. -webkit-user-select: none; /*webkit浏览器*/
  560. -ms-user-select: none; /*IE10*/
  561. -khtml-user-select: none; /*早期浏览器*/
  562. user-select: none;
  563. margin-top: 5px;
  564. }
  565. }
  566. /* 默认逗号设置 */
  567. .mark-item {
  568. width: 10px;
  569. height: 32px;
  570. margin-right: 5px;
  571. line-height: 10px;
  572. font-size: 18px;
  573. position: relative;
  574. & > span {
  575. position: absolute;
  576. width: 100%;
  577. bottom: 0;
  578. writing-mode: vertical-rl;
  579. text-orientation: upright;
  580. }
  581. }
  582. /*滚动数字设置*/
  583. .number-item {
  584. width: 41px;
  585. height: 42px;
  586. /* 背景图片 */
  587. background: url(/images/text-bg-blue.png) no-repeat center center;
  588. background-size: 100% 100%;
  589. // background: #ccc;
  590. list-style: none;
  591. margin-right: 5px;
  592. // background:rgba(250,250,250,1);
  593. border-radius: 4px;
  594. border: 3px solid rgb(221, 221, 221);
  595. & > span {
  596. position: relative;
  597. display: inline-block;
  598. margin-right: 10px;
  599. width: 100%;
  600. height: 100%;
  601. writing-mode: vertical-rl;
  602. text-orientation: upright;
  603. overflow: hidden;
  604. & > i {
  605. font-style: normal;
  606. position: absolute;
  607. top: 11px;
  608. left: 50%;
  609. transform: translate(-50%, -1%);
  610. transition: transform 1s ease-in-out;
  611. letter-spacing: 10px;
  612. }
  613. }
  614. }
  615. .number-item:last-child {
  616. margin-right: 0;
  617. }
  618. }
  619. .departure-table {
  620. width: 100%;
  621. ::v-deep .table {
  622. width: 100%;
  623. .cell {
  624. padding: 0;
  625. text-align: center;
  626. font-size: 14px;
  627. font-family: Helvetica, 'Microsoft YaHei';
  628. letter-spacing: 0;
  629. }
  630. .el-table__header-wrapper {
  631. .cell {
  632. font-weight: bold;
  633. color: #101116;
  634. }
  635. .has-gutter {
  636. tr {
  637. .bgl-huang {
  638. background: #fcf0b1;
  639. }
  640. }
  641. }
  642. }
  643. .el-table__body-wrapper {
  644. tr.bgl-hui {
  645. background: #d2d6df;
  646. td {
  647. background: #d2d6df;
  648. }
  649. &.redBorder {
  650. position: relative;
  651. &::after {
  652. content: '';
  653. position: absolute;
  654. left: 0;
  655. bottom: 0;
  656. width: 100%;
  657. height: 2px;
  658. background: #e83f82;
  659. }
  660. }
  661. }
  662. }
  663. }
  664. }
  665. </style>