advancedHome.vue 38 KB

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