index.vue 17 KB

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