advancedHome.vue 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300
  1. <template>
  2. <div class="advance">
  3. <div class="advance__head flex">
  4. <div class="flex-wrap interfaceLog_head_time">
  5. <div class="manageTitle">高级查询</div>
  6. <!-- <div class="interfaceLog_head_time_start mr10">
  7. <el-date-picker
  8. v-model="flightDate[0]"
  9. class="input-shadow"
  10. size="small"
  11. type="date"
  12. value-format="yyyy-MM-dd"
  13. placeholder="选择开始日期时间"
  14. @change="startDateChangeHandler"
  15. />
  16. </div>
  17. <div class="interfaceLog_head_time_end">
  18. <el-date-picker
  19. v-model="flightDate[1]"
  20. class="input-shadow"
  21. size="small"
  22. type="date"
  23. value-format="yyyy-MM-dd"
  24. placeholder="选择结束日期时间"
  25. @change="endDateChangeHandler"
  26. />
  27. </div> -->
  28. <el-date-picker
  29. v-model="flightDate"
  30. size="small"
  31. type="daterange"
  32. value-format="yyyy-MM-dd"
  33. start-placeholder="开始日期"
  34. end-placeholder="结束日期"
  35. :picker-options="dateRangePickerOptions"
  36. />
  37. </div>
  38. <Search
  39. ref="search"
  40. class="advanced-search"
  41. :is-title="false"
  42. :is-slot="true"
  43. :search-tooltip="'请输入航班号(示例:CA1234)或行李牌号(示例:1234567890)'"
  44. @getSearchData="getSearchData"
  45. @clearSearchData="clearSearchData"
  46. >
  47. <div class="flex-wrap">
  48. <button
  49. class="btnAn"
  50. @click="dialogShow"
  51. >高级查询</button>
  52. <!-- <div
  53. class="setting"
  54. @click="show"
  55. /> -->
  56. </div>
  57. </Search>
  58. </div>
  59. <!--表格-->
  60. <div
  61. v-loading="loading"
  62. element-loading-text="拼命加载中"
  63. element-loading-spinner="el-icon-loading"
  64. element-loading-background="rgba(0, 0, 0, 0.8)"
  65. class="advance__table"
  66. >
  67. <el-table
  68. ref="table"
  69. v-el-table-infinite-scroll="load"
  70. max-height="100%"
  71. class="table"
  72. :data="dealedTableData"
  73. border
  74. stripe
  75. fit
  76. height="calc(100vh - 158px)"
  77. style="width: 100%"
  78. show-summary
  79. :summary-method="summaryRow(tableData.length)"
  80. :header-cell-class-name="headerCellClass"
  81. :row-class-name="tableRowClassName"
  82. :cell-class-name="cellClass"
  83. :span-method="objectSpanMethod"
  84. @cell-click="cellClickHandler"
  85. >
  86. <el-table-column
  87. v-for="col in tableCols"
  88. :key="col.prop"
  89. :prop="col.prop"
  90. :label="col.label"
  91. :width="col.width"
  92. :fixed="col.fixed"
  93. :formatter="tableFormat"
  94. >
  95. <template #header>
  96. <TableHeaderCell
  97. :label="col.label"
  98. :filter-options="tableDataFilters[col.prop]"
  99. :filter-values.sync="filterValues[col.prop]"
  100. :sortable="col.sortable"
  101. :sort-rule.sync="tableDataSortRules[col.prop]"
  102. />
  103. </template>
  104. </el-table-column>
  105. </el-table>
  106. </div>
  107. <!--列设置-->
  108. <!-- <Dialog
  109. :flag="dialogFlag"
  110. class="dialog-check-cols"
  111. >
  112. <div class="col-dialog">
  113. <div class="title">列设置</div>
  114. <div class="content">
  115. <el-tree
  116. :data="tableCols"
  117. :class="colsCheckClass"
  118. show-checkbox
  119. node-key="index"
  120. :default-expand-all="true"
  121. :props="{
  122. label: 'label',
  123. children: 'children'
  124. }"
  125. :default-checked-keys="checkedKeysTemp"
  126. @check="handleCheck"
  127. />
  128. </div>
  129. <div class="foot right t30">
  130. <el-button
  131. size="medium"
  132. class="r24"
  133. type="primary"
  134. @click="onCheck"
  135. >确定</el-button>
  136. <el-button
  137. size="medium"
  138. @click="hide"
  139. >取消</el-button>
  140. </div>
  141. </div>
  142. </Dialog> -->
  143. <!--高级查询-->
  144. <Dialog
  145. width="852px"
  146. :flag="gjFlag"
  147. >
  148. <div
  149. ref="dialog"
  150. class="rowDialog"
  151. :tabindex="0"
  152. @keyup.enter="onCheckGj(true)"
  153. @keyup.self.esc="gjFlag=false"
  154. >
  155. <div class="title">高级查询</div>
  156. <div class="content">
  157. <el-form
  158. ref="form"
  159. :model="form"
  160. :rules="rules"
  161. label-width="100px"
  162. >
  163. <el-row :gutter="20">
  164. <el-col
  165. v-for="item in formItems"
  166. :key="item.prop"
  167. :span="item.span || 8"
  168. >
  169. <el-form-item
  170. :label="item.label"
  171. :prop="item.prop"
  172. >
  173. <template v-if="item.prop === 'flightDate'">
  174. <el-date-picker
  175. v-model="flightDate"
  176. size="small"
  177. type="daterange"
  178. value-format="yyyy-MM-dd"
  179. start-placeholder="开始日期"
  180. end-placeholder="结束日期"
  181. :picker-options="dateRangePickerOptions"
  182. @keyup.esc.native="dialogFocus"
  183. />
  184. </template>
  185. <template v-else-if="item.prop === 'status'">
  186. <el-select
  187. v-model="form.status"
  188. size="small"
  189. filterable
  190. default-first-option
  191. clearable
  192. @keyup.esc.native="dialogFocus"
  193. >
  194. <el-option
  195. v-for="option in statusList"
  196. :key="option.ID"
  197. :label="option.StatusName"
  198. :value="option.StatusCode"
  199. />
  200. </el-select>
  201. </template>
  202. <template v-else-if="item.prop === 'specialType'">
  203. <el-select
  204. v-model="form.specialType"
  205. size="small"
  206. filterable
  207. allow-create
  208. default-first-option
  209. clearable
  210. @keyup.esc.native="dialogFocus"
  211. >
  212. <el-option
  213. v-for="option in baggageTypeList"
  214. :key="option.specialType"
  215. :label="option.specialType"
  216. :value="option.specialType"
  217. />
  218. </el-select>
  219. </template>
  220. <template v-else-if="item.prop === 'unLoad'">
  221. <el-select
  222. v-model="form.unLoad"
  223. size="small"
  224. clearable
  225. @keyup.esc.native="dialogFocus"
  226. >
  227. <el-option
  228. label="已翻减"
  229. :value="1"
  230. />
  231. <el-option
  232. label="待翻减"
  233. :value="0"
  234. />
  235. </el-select>
  236. </template>
  237. <template v-else-if="item.prop === 'checkIn'">
  238. <el-select
  239. v-model="form.checkIn"
  240. size="small"
  241. clearable
  242. @keyup.esc.native="dialogFocus"
  243. >
  244. <el-option
  245. label="是"
  246. :value="1"
  247. />
  248. <el-option
  249. label="否"
  250. :value="0"
  251. />
  252. </el-select>
  253. </template>
  254. <template v-else-if="item.prop === 'active'">
  255. <el-select
  256. v-model="form.active"
  257. size="small"
  258. clearable
  259. @keyup.esc.native="dialogFocus"
  260. >
  261. <el-option
  262. label="是"
  263. :value="1"
  264. />
  265. <el-option
  266. label="否"
  267. :value="0"
  268. />
  269. </el-select>
  270. </template>
  271. <template v-else-if="item.prop === 'transferIn'">
  272. <el-select
  273. v-model="form.transferIn"
  274. size="small"
  275. clearable
  276. @keyup.esc.native="dialogFocus"
  277. >
  278. <el-option
  279. label="是"
  280. :value="1"
  281. />
  282. <el-option
  283. label="否"
  284. :value="0"
  285. />
  286. </el-select>
  287. </template>
  288. <template v-else-if="item.prop === 'canceled'">
  289. <el-select
  290. v-model="form.canceled"
  291. size="small"
  292. clearable
  293. @keyup.esc.native="dialogFocus"
  294. >
  295. <el-option
  296. label="是"
  297. :value="1"
  298. />
  299. <el-option
  300. label="否"
  301. :value="0"
  302. />
  303. </el-select>
  304. </template>
  305. <template v-else-if="item.prop === 'noBSM'">
  306. <el-select
  307. v-model="form.noBSM"
  308. size="small"
  309. clearable
  310. @keyup.esc.native="dialogFocus"
  311. >
  312. <el-option
  313. label="是"
  314. :value="0"
  315. />
  316. <el-option
  317. label="否"
  318. :value="1"
  319. />
  320. </el-select>
  321. </template>
  322. <template v-else>
  323. <el-popover
  324. v-model="item.hintVisible"
  325. placement="right"
  326. trigger="manual"
  327. >
  328. <span>{{ item.hintText }}</span>
  329. <el-input
  330. :ref="'input-' + item.prop"
  331. slot="reference"
  332. v-model="form[item.prop]"
  333. size="small"
  334. @focus="item.hintVisible = true"
  335. @blur="item.hintVisible = false"
  336. @keyup.esc.native="dialogFocus"
  337. />
  338. </el-popover>
  339. </template>
  340. </el-form-item>
  341. </el-col>
  342. </el-row>
  343. </el-form>
  344. </div>
  345. <div class="foot right t30">
  346. <el-button
  347. size="medium"
  348. class="r24"
  349. type="primary"
  350. @click="onCheckGj(true)"
  351. >确定</el-button>
  352. <el-button
  353. size="medium"
  354. @click="closeCheckGj"
  355. >取消</el-button>
  356. </div>
  357. </div>
  358. </Dialog>
  359. </div>
  360. </template>
  361. <script>
  362. import Search from '@/components/SearchWithTooltip'
  363. import Dialog from '@/layout/components/Dialog'
  364. import { parseTime } from '@/utils/index'
  365. import { Query, myQuery } from '@/api/dataIntegration'
  366. import { mapGetters } from 'vuex'
  367. import TableHeaderCell from '@/components/TableHeaderCell'
  368. import { setTableFilters } from '@/utils/table'
  369. export default {
  370. name: 'advanceHome',
  371. components: { Search, Dialog, TableHeaderCell },
  372. data() {
  373. return {
  374. loading: false,
  375. colDialogFlag: false,
  376. gjFlag: false,
  377. tableData: [
  378. // {
  379. // flightNO: '',
  380. // flightDate: '',
  381. // sourceAirport: '',
  382. // targetAirport: '',
  383. // passengerNameUpcase: '',
  384. // bagSN: '',
  385. // specialType: '',
  386. // checkIn: '',
  387. // deleted: '',
  388. // activated: '',
  389. // bagWeight: '',
  390. // latestStatus: '',
  391. // bagLocation: '',
  392. // transferFlightNO: ''
  393. // }
  394. ],
  395. page: -1,
  396. noMore: false,
  397. checkList: [],
  398. tableCols: [
  399. {
  400. prop: 'flightNO',
  401. label: '航班号',
  402. fixed: 'left',
  403. filterable: true,
  404. sortable: true
  405. },
  406. {
  407. prop: 'flightDate',
  408. label: '航班日期',
  409. fixed: 'left',
  410. width: 110,
  411. filterable: true,
  412. sortable: true
  413. },
  414. {
  415. prop: 'departureTime',
  416. label: '起飞时间',
  417. width: 150
  418. },
  419. {
  420. prop: 'sourceAirport',
  421. label: '起飞站',
  422. filterable: true,
  423. sortable: true
  424. },
  425. {
  426. prop: 'targetAirport',
  427. label: '目的地',
  428. filterable: true,
  429. sortable: true
  430. },
  431. {
  432. prop: 'passengerNameUpcase',
  433. label: '旅客姓名',
  434. width: 150,
  435. filterable: true,
  436. sortable: true
  437. },
  438. {
  439. prop: 'bagSN',
  440. label: '行李牌号',
  441. width: 110,
  442. filterable: true,
  443. sortable: true
  444. },
  445. {
  446. prop: 'specialType',
  447. label: '特殊行李类型',
  448. width: 115,
  449. filterable: true,
  450. sortable: true
  451. },
  452. {
  453. prop: 'deleted',
  454. label: '删除',
  455. filterable: true,
  456. sortable: true
  457. },
  458. {
  459. prop: 'activated',
  460. label: '激活',
  461. filterable: true,
  462. sortable: true
  463. },
  464. {
  465. prop: 'bagWeight',
  466. label: '重量'
  467. },
  468. {
  469. prop: 'latestStatus',
  470. label: '最新状态',
  471. width: 110,
  472. filterable: true,
  473. sortable: true
  474. },
  475. {
  476. prop: 'bagLocation',
  477. label: '最新位置',
  478. width: 110,
  479. filterable: true,
  480. sortable: true
  481. },
  482. {
  483. prop: 'U_Device_ID',
  484. label: '容器编号',
  485. width: 110,
  486. filterable: true,
  487. sortable: true
  488. },
  489. {
  490. prop: 'preFlightNO',
  491. label: '中转进航班',
  492. width: 110,
  493. filterable: true,
  494. sortable: true
  495. },
  496. {
  497. prop: 'transferFlightNO',
  498. label: '中转出航班',
  499. width: 110,
  500. filterable: true,
  501. sortable: true
  502. }
  503. ],
  504. flightDate: [parseTime(new Date(), '{y}-{m}-{d}'), parseTime(new Date(), '{y}-{m}-{d}')],
  505. dateRangePickerOptions: {
  506. onPick: this.dateRangePickHandler,
  507. disabledDate: this.dateRangeDisabled
  508. },
  509. form: {
  510. flightNO: '',
  511. destination: '',
  512. departureStation: '',
  513. baggageNO: '',
  514. specialType: '',
  515. U_Device_ID: '',
  516. passengerName: '',
  517. PNR: '',
  518. checkInSequence: '',
  519. transferArrival: '',
  520. transferDeparture: '',
  521. unLoad: '',
  522. checkIn: '',
  523. active: '',
  524. transferIn: '',
  525. canceled: '',
  526. status: '',
  527. noBSM: ''
  528. },
  529. formItems: [
  530. {
  531. prop: 'flightDate',
  532. label: '航班日期',
  533. span: 16
  534. },
  535. {
  536. prop: 'status',
  537. label: '当前状态'
  538. },
  539. {
  540. prop: 'flightNO',
  541. label: '航班号',
  542. hintText: '示例:CA1111',
  543. hintVisible: false
  544. },
  545. {
  546. prop: 'departureStation',
  547. label: '起飞站',
  548. hintText: '示例:PEK',
  549. hintVisible: false
  550. },
  551. {
  552. prop: 'destination',
  553. label: '目的地',
  554. hintText: '示例:CTU',
  555. hintVisible: false
  556. },
  557. {
  558. prop: 'baggageNO',
  559. label: '行李牌号',
  560. hintText: '示例:1234567890',
  561. hintVisible: false
  562. },
  563. {
  564. prop: 'specialType',
  565. label: '特殊行李类型'
  566. },
  567. {
  568. prop: 'U_Device_ID',
  569. label: '容器编号',
  570. hintText: '示例:AKE25810CA',
  571. hintVisible: false
  572. },
  573. {
  574. prop: 'passengerName',
  575. label: '旅客姓名',
  576. hintText: '示例:ZHAOWEI',
  577. hintVisible: false
  578. },
  579. {
  580. prop: 'PNR',
  581. label: 'PNR',
  582. hintText: '示例:PZR25X',
  583. hintVisible: false
  584. },
  585. {
  586. prop: 'checkInSequence',
  587. label: '值机序号',
  588. hintText: '示例:1',
  589. hintVisible: false
  590. },
  591. {
  592. prop: 'transferArrival',
  593. label: '中转进航班',
  594. hintText: '示例:CA1111',
  595. hintVisible: false
  596. },
  597. {
  598. prop: 'transferDeparture',
  599. label: '中转出航班',
  600. hintText: '示例:CA1111',
  601. hintVisible: false
  602. },
  603. {
  604. prop: 'unLoad',
  605. label: '翻减状态'
  606. },
  607. {
  608. prop: 'checkIn',
  609. label: '已值机'
  610. },
  611. {
  612. prop: 'active',
  613. label: '已激活'
  614. },
  615. {
  616. prop: 'transferIn',
  617. label: '中转行李'
  618. },
  619. {
  620. prop: 'canceled',
  621. label: '已取消'
  622. },
  623. {
  624. prop: 'noBSM',
  625. label: '无BSM'
  626. }
  627. ],
  628. statusList: [
  629. {
  630. ID: 0,
  631. StatusName: '安检',
  632. StatusCode: '安检'
  633. },
  634. {
  635. ID: 1,
  636. StatusName: '分拣',
  637. StatusCode: '分拣'
  638. },
  639. {
  640. ID: 2,
  641. StatusName: '装车',
  642. StatusCode: '装车'
  643. },
  644. {
  645. ID: 3,
  646. StatusName: '装机',
  647. StatusCode: '装机'
  648. },
  649. {
  650. ID: 4,
  651. StatusName: '到达',
  652. StatusCode: '到达'
  653. }
  654. ],
  655. baggageTypeList: [],
  656. dataContent: [],
  657. rules: {
  658. // 机器信息表单验证
  659. // flightNO: [
  660. // { required: true, message: "请输入有效航班号", trigger: "blur" },
  661. // ],
  662. },
  663. tableDataFilters: {},
  664. filterValues: {},
  665. tableDataSortRules: {},
  666. spanArr: [],
  667. contactDot: 0,
  668. scrollTop: 0,
  669. dom: null
  670. }
  671. },
  672. computed: {
  673. ...mapGetters(['clickedCells', 'queryForm']),
  674. dealedTableData() {
  675. const filtered = this.tableData.filter(item => {
  676. let flag = true
  677. Object.entries(this.filterValues).forEach(([key, arr]) => {
  678. if (arr.length && !arr.includes(item[key])) {
  679. flag = false
  680. }
  681. })
  682. return flag
  683. })
  684. const sortRules = Object.entries(this.tableDataSortRules).reduce(
  685. (pre, [key, value]) => {
  686. if (value) {
  687. pre[0].push(key)
  688. value = value === 'ascending' ? 'asc' : 'desc'
  689. pre[1].push(value)
  690. }
  691. return pre
  692. },
  693. [[], []]
  694. )
  695. return this._.orderBy(filtered, sortRules[0], sortRules[1])
  696. }
  697. },
  698. watch: {
  699. flightDate: {
  700. handler(val) {
  701. if (val === null) {
  702. this.flightDate = ['', '']
  703. }
  704. },
  705. deep: true
  706. },
  707. dealedTableData: {
  708. handler(val) {
  709. this.spanArr = []
  710. let contactDot = this.contactDot
  711. val.forEach((item, index, arr) => {
  712. if (index === 0) {
  713. this.spanArr.push(1)
  714. } else {
  715. if (
  716. item['flightNO'] === arr[index - 1]['flightNO'] &&
  717. item['flightDate'] === arr[index - 1]['flightDate'] &&
  718. item['passengerNameUpcase'] === arr[index - 1]['passengerNameUpcase'] &&
  719. item['checkInNO'] === arr[index - 1]['checkInNO'] &&
  720. item['bagWeight'] === arr[index - 1]['bagWeight']
  721. ) {
  722. this.spanArr[contactDot] += 1
  723. this.spanArr.push(0)
  724. } else {
  725. this.spanArr.push(1)
  726. contactDot = index
  727. }
  728. }
  729. })
  730. },
  731. deep: true
  732. }
  733. },
  734. created() {
  735. Object.values(this.tableCols).forEach(({ prop, filterable, sortable }) => {
  736. if (filterable) {
  737. this.$set(this.tableDataFilters, prop, [])
  738. this.$set(this.filterValues, prop, [])
  739. }
  740. if (sortable) {
  741. this.$set(this.tableDataSortRules, prop, '')
  742. }
  743. })
  744. // console.log(this.$store.state.app.queryForm)
  745. // 参数顺序 【航班开始日期,航班结束日期,航班号,航班号,行李牌号,行李牌号,起飞站,起飞站,目的站,目的站,特殊行李类型,特殊 行李类型,旅客姓名大写拼音,旅客姓名大写拼音,PNR,PNR,值机号,值机号】
  746. // const dataContent = [this.time[0], this.time[1]]
  747. // for (let i = 0; i < 18; i++) {
  748. // dataContent.push(null)
  749. // }
  750. // this.statItemsQueryByStatMain(dataContent);
  751. },
  752. mounted() {
  753. this.baggageTypeQuery()
  754. this.dom = this.$refs.table.bodyWrapper
  755. let that = this
  756. this.dom.addEventListener('scroll', () => {
  757. that.scrollTop = this.dom.scrollTop
  758. })
  759. },
  760. activated() {
  761. let queryFlag = false
  762. const query = this.$route.query
  763. const { startDate, endDate, singleJump } = query
  764. const queryEntries = Object.entries(query)
  765. if (queryEntries.length) {
  766. this.clearForm()
  767. }
  768. queryEntries.forEach(([key, value]) => {
  769. if (!['startDate', 'endDate', 'singleJump'].includes(key) && (value ?? '') !== '') {
  770. queryFlag = true
  771. this.form[key] = ['unLoad', 'checkIn', 'active', 'transferIn', 'canceled', 'noBSM'].includes(key)
  772. ? Number(value)
  773. : value
  774. }
  775. })
  776. if (startDate) {
  777. this.$set(this.flightDate, 0, startDate)
  778. }
  779. if (endDate) {
  780. this.$set(this.flightDate, 1, endDate)
  781. }
  782. // startDate && (this.flightDate[0] = startDate)
  783. // endDate && (this.flightDate[1] = endDate)
  784. if (queryFlag) {
  785. this.onCheckGj(singleJump)
  786. } else {
  787. this.dom = this.$refs.table.bodyWrapper
  788. this.dom.scrollTop = this.scrollTop
  789. }
  790. // else if (this.queryForm) {
  791. // Object.keys(this.form).forEach(key => {
  792. // this.form[key] = this.queryForm[key]
  793. // })
  794. // this.flightDate = this.queryForm.flightDate
  795. // this.onCheckGj()
  796. // }
  797. },
  798. updated() {
  799. // table数据更新
  800. this.$nextTick(() => {
  801. this.$refs.table.doLayout()
  802. })
  803. },
  804. beforeDestroy() {
  805. // console.log(this.$route.matched.filter(item => item.name && item.meta.title))
  806. if (this.$route.matched.filter(item => item.name && item.meta.title).length > 1) {
  807. this.$store.dispatch('app/setQueryForm', {
  808. ...this.form,
  809. flightDate: this.flightDate
  810. })
  811. } else {
  812. this.$store.dispatch('app/setQueryForm', null)
  813. }
  814. },
  815. methods: {
  816. load() {
  817. if (this.noMore || this.loading || this.page < 0) {
  818. return
  819. }
  820. this.statItemsQueryByStatMain(this.dataContent)
  821. },
  822. resetTable() {
  823. this.page = 0
  824. this.noMore = false
  825. this.tableData = []
  826. },
  827. dialogShow() {
  828. this.gjFlag = true
  829. this.$nextTick(() => {
  830. this.dialogFocus()
  831. })
  832. },
  833. dialogFocus() {
  834. this.$refs['dialog'].focus()
  835. },
  836. // startDateChangeHandler(val) {
  837. // this.flightDate[0] = val ?? ''
  838. // if (!val || !this.flightDate[1]) {
  839. // return
  840. // }
  841. // const startDate = new Date(val)
  842. // const endDate = new Date(this.flightDate[1])
  843. // if (startDate > endDate) {
  844. // this.flightDate.splice(1, 1, '')
  845. // this.$message.info('结束时间不能早于开始时间,请重新选择')
  846. // } else if (endDate - startDate > 2 * 24 * 60 * 60 * 1000) {
  847. // this.flightDate.splice(1, 1, '')
  848. // this.$message.info('时间跨度不能超过三天,请重新选择')
  849. // }
  850. // },
  851. // endDateChangeHandler(val) {
  852. // this.flightDate[1] = val ?? ''
  853. // if (!val || !this.flightDate[0]) {
  854. // return
  855. // }
  856. // const startDate = new Date(this.flightDate[0])
  857. // const endDate = new Date(val)
  858. // if (startDate > endDate) {
  859. // this.flightDate.splice(0, 1, '')
  860. // this.$message.info('开始时间不能晚于结束时间,请重新选择')
  861. // } else if (endDate - startDate > 2 * 24 * 60 * 60 * 1000) {
  862. // this.flightDate.splice(0, 1, '')
  863. // this.$message.info('时间跨度不能超过三天,请重新选择')
  864. // }
  865. // },
  866. dateRangePickHandler({ maxDate, minDate }) {
  867. if (!maxDate) {
  868. this.pickedDate = minDate
  869. } else {
  870. this.pickedDate = null
  871. }
  872. },
  873. dateRangeDisabled(date) {
  874. return this.pickedDate ? Math.abs(date - this.pickedDate) > 2 * 24 * 60 * 60 * 1000 : false
  875. },
  876. objectSpanMethod({ row, column, rowIndex, columnIndex }) {
  877. if (['passengerNameUpcase', 'bagWeight'].includes(column.property)) {
  878. const _row = this.spanArr[rowIndex]
  879. const _col = _row > 0 ? 1 : 0
  880. return {
  881. rowspan: _row,
  882. colspan: _col
  883. }
  884. }
  885. },
  886. // 给表头单元格加上 ascending 或 descending 使用 element 自带的排序箭头变色
  887. headerCellClass({ row, column, rowIndex, columnIndex }) {
  888. const classes = []
  889. const rule = this.tableDataSortRules[column.property]
  890. if (rule) {
  891. classes.push(rule)
  892. }
  893. return classes.join(' ')
  894. },
  895. tableRowClassName({ row, rowIndex }) {
  896. const classes = []
  897. if (row.deleted === 'DEL') {
  898. classes.push('bgl-deleted')
  899. }
  900. return classes.join(' ')
  901. },
  902. cellClass({ row, column, rowIndex, columnIndex }) {
  903. const classes = []
  904. if (['flightNO', 'bagSN', 'preFlightNO', 'transferFlightNO'].includes(column.property) && row[column.property]) {
  905. classes.push('cell-click')
  906. if (
  907. this.clickedCells.some(
  908. cell =>
  909. cell.pageName === 'advance' &&
  910. Object.entries(cell.row).every(([key, value]) => row[key] === value) &&
  911. cell.columnProp === column.property
  912. )
  913. ) {
  914. classes.push('cell-clicked')
  915. }
  916. }
  917. return classes.join(' ')
  918. },
  919. cellClickHandler(row, column, cell, event) {
  920. if (['flightNO', 'bagSN', 'preFlightNO', 'transferFlightNO'].includes(column.property)) {
  921. this.$store.dispatch('keepAlive/addClickedCell', {
  922. row,
  923. columnProp: column.property,
  924. pageName: 'advance'
  925. })
  926. }
  927. switch (column.property) {
  928. case 'flightNO':
  929. this.$router.push({
  930. path: '/advance/flightView',
  931. query: {
  932. flightNO: row.flightNO,
  933. flightDate: row.flightDate
  934. }
  935. })
  936. break
  937. case 'bagSN':
  938. this.$router.push({
  939. path: '/advance/baggageView',
  940. query: {
  941. flightNO: row.flightNO,
  942. flightDate: row.flightDate,
  943. bagSN: row.bagSN
  944. }
  945. })
  946. break
  947. case 'transferFlightNO':
  948. this.$router.push({
  949. path: '/advance/flightView',
  950. query: {
  951. flightNO: row.transferFlightNO,
  952. flightDate: row.transferFlightDate
  953. }
  954. })
  955. break
  956. case 'preFlightNO':
  957. this.$router.push({
  958. path: '/advance/flightView',
  959. query: {
  960. flightNO: row.preFlightNO,
  961. flightDate: row.preFlightDate
  962. }
  963. })
  964. break
  965. default:
  966. break
  967. }
  968. },
  969. tableFormat(row, column, cellValue) {
  970. switch (column.property) {
  971. case 'departureTime':
  972. return (cellValue ?? '').replace('T', ' ')
  973. case 'deleted':
  974. return cellValue === 'DEL' ? cellValue : ''
  975. case 'activated':
  976. return cellValue === 1 ? '激活' : '未激活'
  977. default:
  978. return cellValue ?? ''
  979. }
  980. },
  981. // 查询
  982. getSearchData(val) {
  983. this.clearForm()
  984. if (this.flightDate[0] === '' || this.flightDate[1] === '' || val === '') {
  985. this.$message.error('请先输入完整查询信息')
  986. } else {
  987. // 点击搜索后清除跳转携带的查询信息
  988. this.$route.query && this.$router.replace(this.$route.path)
  989. // let searchData = {dataContent:[this.time[0],this.time[1],val]}
  990. const az = /^[a-zA-Z]+$/
  991. const azNum = /^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]*$/
  992. // const top2 = /^[a-zA-Z]{2}\w*$/
  993. const top2 = /^([a-zA-Z][0-9])|([0-9][a-zA-Z])|([a-zA-Z]{2})/
  994. const num = /^[0-9]+$/
  995. const bagNo = /^[a-zA-Z]{2}[0-9]{6}$/
  996. // 纯字母则为旅客姓名
  997. if (az.test(val)) {
  998. this.form['passengerName'] = val
  999. this.onCheckGj(true)
  1000. } else if (azNum.test(val) && top2.test(val)) {
  1001. // 字母加数字且前两位为字母则为航班号
  1002. this.form['flightNO'] = val
  1003. this.onCheckGj(true)
  1004. } else if ((num.test(val) && val.length === 10) || bagNo.test(val)) {
  1005. // 纯数字且位数等于10则为行李牌号
  1006. this.form['baggageNO'] = val
  1007. this.onCheckGj(true)
  1008. } else {
  1009. this.$message.error('请先输入有效查询信息如航班号、旅客姓名首字母、行李牌号')
  1010. }
  1011. // this.sempleQueryByStatMain(searchData)
  1012. }
  1013. },
  1014. // 清除查询
  1015. clearSearchData() {
  1016. this.clearForm()
  1017. this.resetTable()
  1018. },
  1019. // 清除表单
  1020. clearForm() {
  1021. Object.keys(this.form).forEach(key => {
  1022. this.form[key] = ''
  1023. })
  1024. },
  1025. // 高级查询-确定
  1026. onCheckGj(singleJump) {
  1027. this.resetTable()
  1028. /* 参数顺序
  1029. 【航班开始日期,航班结束日期,航班号,航班号,行李牌号,行李牌号,起飞站,起飞站,目的站,目的站,特殊行李类型,特殊行李类型,旅客姓名大写拼音,旅客姓名大写拼音,
  1030. PNR,PNR,值机号,值机号,中转进航班,中转进航班,中转出航班,中转出航班,容器编号,容器编号,
  1031. 是否已翻减(null/OFF/其他),是否已翻减(null/OFF/其他),是否值机(null/0/1),是否值机(null/0/1),
  1032. 是否激活(null/0/1),是否激活(null/0/1),是否中转(null/0/1),是否中转(null/0/1),是否取消行李(null/0/1),是否取消行李(null/0/1)】 */
  1033. this.dataContent = []
  1034. const flightDate = this.flightDate
  1035. if (flightDate && flightDate.length) {
  1036. this.dataContent.push(flightDate[0])
  1037. this.dataContent.push(flightDate[1])
  1038. if (Object.values(this.form).every(value => value === '')) {
  1039. this.$message.error('请先输入查询信息')
  1040. } else {
  1041. const {
  1042. flightNO,
  1043. baggageNO,
  1044. departureStation,
  1045. destination,
  1046. specialType,
  1047. passengerName,
  1048. PNR,
  1049. checkInSequence,
  1050. transferArrival,
  1051. transferDeparture,
  1052. U_Device_ID,
  1053. unLoad,
  1054. checkIn,
  1055. active,
  1056. transferIn,
  1057. canceled,
  1058. status,
  1059. noBSM
  1060. } = this.form
  1061. this.setDataContent(
  1062. flightNO,
  1063. baggageNO,
  1064. departureStation,
  1065. destination,
  1066. specialType,
  1067. passengerName,
  1068. PNR,
  1069. checkInSequence,
  1070. transferArrival,
  1071. transferDeparture,
  1072. U_Device_ID,
  1073. unLoad,
  1074. checkIn,
  1075. active,
  1076. transferIn,
  1077. canceled,
  1078. status,
  1079. noBSM
  1080. )
  1081. this.statItemsQueryByStatMain(this.dataContent, singleJump)
  1082. this.gjFlag = false
  1083. }
  1084. } else {
  1085. this.$message.error('请先选择要查询的时间')
  1086. }
  1087. },
  1088. closeCheckGj() {
  1089. this.gjFlag = false
  1090. },
  1091. setDataContent(...dataContent) {
  1092. dataContent.forEach(target => {
  1093. target = typeof target === 'string' ? target.trim() : target
  1094. if ((target ?? '') !== '') {
  1095. this.dataContent.push(target, target)
  1096. } else {
  1097. this.dataContent.push(null, null)
  1098. }
  1099. })
  1100. },
  1101. // 数据查询
  1102. async statItemsQueryByStatMain(dataContent, singleJump) {
  1103. this.loading = true
  1104. try {
  1105. const {
  1106. code,
  1107. returnData: { listValues: result, needPage }
  1108. } = await Query({
  1109. id: DATACONTENT_ID.advacedQueryId,
  1110. needPage: ++this.page,
  1111. dataContent
  1112. })
  1113. if (Number(code) !== 0) {
  1114. this.page--
  1115. this.loading = false
  1116. this.$message.error('获取数据失败')
  1117. return
  1118. }
  1119. if (needPage === this.page && result.length) {
  1120. if (singleJump) {
  1121. if (result.length === 1) {
  1122. this.$router.push({
  1123. path: '/advance/baggageView',
  1124. query: {
  1125. bagSN: result[0].bagSN,
  1126. flightNO: result[0].flightNO,
  1127. flightDate: result[0].flightDate
  1128. }
  1129. })
  1130. } else {
  1131. const onlyFlight = result.reduce((pre, curr) => {
  1132. if (
  1133. pre === null ||
  1134. (curr.flightNO &&
  1135. curr.flightDate &&
  1136. curr.flightNO === pre.flightNO &&
  1137. curr.flightDate === pre.flightDate)
  1138. ) {
  1139. return {
  1140. flightNO: curr.flightNO,
  1141. flightDate: curr.flightDate
  1142. }
  1143. } else {
  1144. return {}
  1145. }
  1146. }, null)
  1147. if (onlyFlight.flightNO) {
  1148. this.$router.push({
  1149. path: '/advance/flightView',
  1150. query: onlyFlight
  1151. })
  1152. }
  1153. }
  1154. }
  1155. // const tableData = this._.sortBy(result, ['flightDate', 'departureTime', 'passengerNameUpcase', 'bagSN'])
  1156. this.tableData = [...this.tableData, ...result]
  1157. setTableFilters(this.tableData, this.tableDataFilters)
  1158. } else {
  1159. if (this.page === 1) {
  1160. this.$message.info('未查询到匹配结果')
  1161. }
  1162. this.page--
  1163. this.noMore = true
  1164. }
  1165. } catch (error) {
  1166. this.page--
  1167. console.log('出错了', error)
  1168. }
  1169. this.loading = false
  1170. },
  1171. // 特殊行李类型下拉选项查询
  1172. async baggageTypeQuery() {
  1173. try {
  1174. const result = await myQuery(DATACONTENT_ID.baggageTypeId)
  1175. this.baggageTypeList = result
  1176. } catch (error) {
  1177. console.log('出错了', error)
  1178. }
  1179. },
  1180. // 简单查询 废弃
  1181. // async sempleQueryByStatMain(dataContent) {
  1182. // try {
  1183. // const res = await getQuery({
  1184. // id: 31,
  1185. // dataContent
  1186. // })
  1187. // if (res.code == 0) {
  1188. // this.tableData = res.returnData
  1189. // } else {
  1190. // this.$message.error(res.message)
  1191. // }
  1192. // } catch (error) {
  1193. // console.log('出错了', error)
  1194. // }
  1195. // },
  1196. // 统计行数
  1197. summaryRow(num) {
  1198. return function () {
  1199. return ['合计', `共${num}件`]
  1200. }
  1201. }
  1202. }
  1203. }
  1204. </script>
  1205. <style lang="scss" scoped>
  1206. .advance {
  1207. padding: 8px;
  1208. &__head {
  1209. line-height: 32px;
  1210. margin-top: 8px;
  1211. margin-bottom: 16px;
  1212. .setting {
  1213. height: 32px;
  1214. width: 32px;
  1215. cursor: pointer;
  1216. background-size: 100% 100%;
  1217. background: url('../../../assets/baggage/ic_setting.png') no-repeat;
  1218. margin-left: 12px;
  1219. position: relative;
  1220. top: 2px;
  1221. }
  1222. .mr10 {
  1223. margin-right: 10px;
  1224. }
  1225. ::v-deep .interfaceLog_head_time {
  1226. .el-input__prefix {
  1227. left: 10px;
  1228. color: #101116;
  1229. }
  1230. .el-input--prefix .el-input__inner {
  1231. padding-left: 50px;
  1232. }
  1233. }
  1234. }
  1235. }
  1236. .advance__table {
  1237. width: 100%;
  1238. ::v-deep .table {
  1239. width: 100%;
  1240. .cell {
  1241. padding: 0;
  1242. text-align: center;
  1243. font-size: 14px;
  1244. font-family: Helvetica, 'Microsoft YaHei';
  1245. letter-spacing: 0;
  1246. }
  1247. .cell-click {
  1248. cursor: pointer;
  1249. color: #2d7cff;
  1250. &.cell-clicked {
  1251. color: purple;
  1252. }
  1253. }
  1254. .el-table__header-wrapper,
  1255. .el-table__fixed-header-wrapper {
  1256. .cell {
  1257. font-weight: bold;
  1258. color: #101116;
  1259. }
  1260. .has-gutter {
  1261. tr {
  1262. .bgl-huang {
  1263. background: #fcf0b1;
  1264. }
  1265. }
  1266. }
  1267. }
  1268. .el-table__body-wrapper,
  1269. .el-table__fixed-body-wrapper {
  1270. tr.bgl-deleted {
  1271. background: #d2d6df;
  1272. td {
  1273. background: #d2d6df;
  1274. font-style: italic;
  1275. }
  1276. }
  1277. }
  1278. }
  1279. }
  1280. .el-table tbody tr:hover > td {
  1281. background-color: red !important;
  1282. }
  1283. .el-table__body tr.hover-row.current-row > td,
  1284. .el-table__body tr.hover-row.el-table__row--striped.current-row > td,
  1285. .el-table__body tr.hover-row.el-table__row--striped > td,
  1286. .el-table__body tr.hover-row > td {
  1287. background-color: red;
  1288. }
  1289. .rowDialog::v-deep .el-form > .el-row > .el-col:nth-child(1) .el-date-editor {
  1290. width: 100%;
  1291. }
  1292. </style>