useAirportTable.ts 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140
  1. import { Query } from '@/api/webApi'
  2. import { ellipsisCell } from '@/components/SimpleTable/customRender'
  3. import { CommonData, CommonTableColumn, CommonValue } from '~/common'
  4. import { parseTime } from '@/utils/validate'
  5. interface SimpleColumn {
  6. columnName: string
  7. columnLabel: string
  8. [x: string]: any
  9. }
  10. const columnGroupsMap: {
  11. [x: string]: {
  12. groupName: string
  13. children: SimpleColumn[]
  14. }[]
  15. } = {
  16. DepartureAirport: [
  17. {
  18. groupName: '航班相关',
  19. children: [
  20. {
  21. columnName: 'IATACode',
  22. columnLabel: '航司',
  23. needFilters: 1,
  24. fixed: true,
  25. },
  26. {
  27. columnName: 'flightNO',
  28. columnLabel: '航班号',
  29. needFilters: 1,
  30. fixed: true,
  31. },
  32. {
  33. columnName: 'flightDate',
  34. columnLabel: '执飞日期',
  35. fixed: true,
  36. },
  37. {
  38. columnName: 'planDepartureTime',
  39. columnLabel: '计划起飞\n时间',
  40. fixed: true,
  41. },
  42. {
  43. columnName: 'endLoadTime',
  44. columnLabel: '结载时间',
  45. fixed: true,
  46. },
  47. {
  48. columnName: 'acDepartureTime',
  49. columnLabel: '实际起飞\n时间',
  50. fixed: true,
  51. },
  52. {
  53. columnName: 'target',
  54. columnLabel: '航程',
  55. width: 100,
  56. needFilters: 1,
  57. fixed: true,
  58. },
  59. {
  60. columnName: 'planeType',
  61. columnLabel: '机型',
  62. needFilters: 1,
  63. fixed: true,
  64. },
  65. {
  66. columnName: 'flightType',
  67. columnLabel: '航班类型',
  68. needFilters: 1,
  69. fixed: true,
  70. },
  71. {
  72. columnName: 'takeOffStand',
  73. columnLabel: '停机位',
  74. fixed: true,
  75. },
  76. // {
  77. // columnName: 'lastflightNO',
  78. // columnLabel: '前序航班',
  79. // fixed: true,
  80. // defaultHidden: true,
  81. // },
  82. // {
  83. // columnName: 'acLandingTime',
  84. // columnLabel: '实际降落\n时间',
  85. // width: 73,
  86. // },
  87. {
  88. columnName: 'jiahuo',
  89. columnLabel: '一个码标记',
  90. needCount: 1,
  91. countMode: 'notNull',
  92. },
  93. ],
  94. },
  95. {
  96. groupName: '运单相关',
  97. children: [
  98. {
  99. columnName: 'speCargoInfo',
  100. columnLabel: '特货信息',
  101. customRender: ellipsisCell,
  102. },
  103. {
  104. columnName: 'preLoad',
  105. columnLabel: '运单申报\n(运单/件)',
  106. },
  107. // {
  108. // columnName: 'transIn',
  109. // columnLabel: '中转进\n(运单/件)',
  110. // },
  111. ],
  112. },
  113. {
  114. groupName: '货站相关',
  115. children: [
  116. {
  117. columnName: 'receiveSure',
  118. columnLabel: '收运核单\n(运单/件/重量)',
  119. },
  120. {
  121. columnName: 'receiveSureTime',
  122. columnLabel: '收运核单\n时间',
  123. },
  124. // {
  125. // columnName: 'receiveSure_No',
  126. // columnLabel: '核单不通过\n(运单/件/重量)',
  127. // },
  128. // {
  129. // columnName: 'receiveSureTime_No',
  130. // columnLabel: '核单不通过\n时间',
  131. // },
  132. {
  133. columnName: 'checks',
  134. columnLabel: '收运核查\n(拒运/查验)',
  135. defaultHidden: true,
  136. },
  137. {
  138. columnName: 'checkTime',
  139. columnLabel: '收运核查\n时间',
  140. defaultHidden: true,
  141. },
  142. {
  143. columnName: 'securityYes',
  144. columnLabel: '安检放行\n(运单/件)',
  145. },
  146. {
  147. columnName: 'securityTime',
  148. columnLabel: '安检放行\n时间',
  149. },
  150. {
  151. columnName: 'addCargo',
  152. columnLabel: '加货\n(运单/板卡/件/重量)',
  153. },
  154. {
  155. columnName: 'addCargoTime',
  156. columnLabel: '加货时间',
  157. },
  158. // {
  159. // columnName: 'wait',
  160. // columnLabel: '待运区\n(板卡/件)',
  161. // },
  162. // {
  163. // columnName: 'waitTime',
  164. // columnLabel: '待运区时间',
  165. // },
  166. {
  167. columnName: 'stowage',
  168. columnLabel: '预配载\n(板卡/件)',
  169. },
  170. {
  171. columnName: 'stowageTime',
  172. columnLabel: '预配载时间',
  173. },
  174. ],
  175. },
  176. {
  177. groupName: '地服相关',
  178. children: [
  179. // {
  180. // columnName: 'planJoinTime',
  181. // columnLabel: '计划交接\n时间',
  182. // },
  183. // {
  184. // columnName: 'requestDepotJoin',
  185. // columnLabel: '发起货站交接\n(板卡/件)',
  186. // },
  187. // {
  188. // columnName: 'requestDepotJoinTime',
  189. // columnLabel: '发起货站交接\n时间',
  190. // },
  191. // {
  192. // columnName: 'depotJoin',
  193. // columnLabel: '货站交接\n(板卡/件)',
  194. // },
  195. // {
  196. // columnName: 'depotJoinTime',
  197. // columnLabel: '货站交接\n时间',
  198. // },
  199. {
  200. columnName: 'resure',
  201. columnLabel: '交接复核\n(板卡/件)',
  202. },
  203. {
  204. columnName: 'resureTime',
  205. columnLabel: '交接复核\n时间',
  206. },
  207. // {
  208. // columnName: 'planeDown',
  209. // columnLabel: '机下交接\n(板卡/件)',
  210. // columnDescribe: '根据交接复核计算所得',
  211. // },
  212. {
  213. columnName: 'planeDownTime',
  214. columnLabel: '机下交接\n时间',
  215. },
  216. // {
  217. // columnName: 'loadPlaneSure',
  218. // columnLabel: '装机\n(板卡/件)',
  219. // },
  220. {
  221. columnName: 'loadPlaneSureTime',
  222. columnLabel: '装机完成\n时间',
  223. defaultHidden: true,
  224. },
  225. // {
  226. // columnName: 'loadPlane',
  227. // columnLabel: '关闭舱门\n(板卡/件)',
  228. // },
  229. {
  230. columnName: 'loadPlaneTime',
  231. columnLabel: '关闭舱门\n时间',
  232. },
  233. {
  234. columnName: 'register',
  235. columnLabel: '拉下登记\n(板卡/件)',
  236. },
  237. {
  238. columnName: 'pullRegisterTime',
  239. columnLabel: '拉下登记\n时间',
  240. },
  241. {
  242. columnName: 'pullSure',
  243. columnLabel: '拉回确认\n(板卡/件)',
  244. },
  245. {
  246. columnName: 'pullSureTime',
  247. columnLabel: '拉回确认\n时间',
  248. },
  249. {
  250. columnName: 'returns',
  251. columnLabel: '退运\n(板卡/件)',
  252. },
  253. {
  254. columnName: 'returnTime',
  255. columnLabel: '退运时间',
  256. },
  257. ],
  258. },
  259. ],
  260. ArrivalAirport: [
  261. {
  262. groupName: '航班相关',
  263. children: [
  264. {
  265. columnName: 'IATACode',
  266. columnLabel: '航司',
  267. needFilters: 1,
  268. width: 50,
  269. },
  270. {
  271. columnName: 'flightNO',
  272. columnLabel: '航班号',
  273. needFilters: 1,
  274. width: 60,
  275. },
  276. {
  277. columnName: 'flightDate',
  278. columnLabel: '执飞日期',
  279. },
  280. {
  281. columnName: 'planLandingTime',
  282. columnLabel: '计划降落\n时间',
  283. },
  284. {
  285. columnName: 'acLandingTime',
  286. columnLabel: '实际降落\n时间',
  287. },
  288. {
  289. columnName: 'target',
  290. columnLabel: '航程',
  291. width: 100,
  292. needFilters: 1,
  293. },
  294. {
  295. columnName: 'planeType',
  296. columnLabel: '机型',
  297. needFilters: 1,
  298. width: 50,
  299. },
  300. {
  301. columnName: 'flightType',
  302. columnLabel: '航班类型',
  303. needFilters: 1,
  304. },
  305. {
  306. columnName: 'landingStand',
  307. columnLabel: '停机位',
  308. },
  309. {
  310. columnName: 'speCargoInfo',
  311. columnLabel: '特货信息',
  312. customRender: ellipsisCell,
  313. },
  314. // {
  315. // columnName: 'preUnLoad',
  316. // columnLabel: '预计卸载数\n(运单/件)',
  317. // },
  318. // {
  319. // columnName: 'transOut',
  320. // columnLabel: '中转出\n(运单/件)',
  321. // },
  322. // {
  323. // columnName: 'receiveDiff',
  324. // columnLabel: '收货差异\n(板卡/件)',
  325. // },
  326. ],
  327. },
  328. {
  329. groupName: '地服相关',
  330. children: [
  331. // {
  332. // columnName: 'unloadBill',
  333. // columnLabel: '卸机单\n(板/箱/卡)',
  334. // },
  335. // {
  336. // columnName: 'unloadBillTime',
  337. // columnLabel: '卸机单确认\n时间',
  338. // },
  339. {
  340. columnName: 'unLoad',
  341. columnLabel: '卸机\n(板/箱/卡)',
  342. },
  343. {
  344. columnName: 'unLoadTime',
  345. columnLabel: '卸机时间',
  346. },
  347. {
  348. columnName: 'planeDown',
  349. columnLabel: '库区到达\n(板/箱/卡)',
  350. },
  351. {
  352. columnName: 'planeDownTime_IN',
  353. columnLabel: '库区到达\n时间',
  354. },
  355. ],
  356. },
  357. {
  358. groupName: '货站相关',
  359. children: [
  360. {
  361. columnName: 'depotJoin',
  362. columnLabel: '货站交接\n(板/箱/卡)',
  363. },
  364. {
  365. columnName: 'depotJoinTime_IN',
  366. columnLabel: '货站交接\n时间',
  367. },
  368. {
  369. columnName: 'tally',
  370. columnLabel: '理货\n(运单/件/重量)',
  371. width: 120,
  372. },
  373. {
  374. columnName: 'tallyTime_in',
  375. columnLabel: '理货时间',
  376. },
  377. {
  378. columnName: 'outWarehouse',
  379. columnLabel: '出库\n(运单/件/重量)',
  380. width: 120,
  381. },
  382. {
  383. columnName: 'outWarehouseTime',
  384. columnLabel: '出库时间',
  385. },
  386. ],
  387. },
  388. ],
  389. InternationalDepartureAirport: [
  390. {
  391. groupName: '航班相关',
  392. children: [
  393. {
  394. columnName: 'IATACode',
  395. columnLabel: '航司',
  396. needFilters: 1,
  397. fixed: true,
  398. },
  399. {
  400. columnName: 'flightNO',
  401. columnLabel: '航班号',
  402. needFilters: 1,
  403. fixed: true,
  404. },
  405. {
  406. columnName: 'flightDate',
  407. columnLabel: '执飞日期',
  408. fixed: true,
  409. },
  410. {
  411. columnName: 'planDepartureTime',
  412. columnLabel: '计划起飞\n时间',
  413. fixed: true,
  414. },
  415. {
  416. columnName: 'endLoadTime',
  417. columnLabel: '结载时间',
  418. fixed: true,
  419. },
  420. {
  421. columnName: 'acDepartureTime',
  422. columnLabel: '实际起飞\n时间',
  423. fixed: true,
  424. },
  425. {
  426. columnName: 'target',
  427. columnLabel: '航程',
  428. width: 100,
  429. needFilters: 1,
  430. fixed: true,
  431. },
  432. {
  433. columnName: 'planeType',
  434. columnLabel: '机型',
  435. needFilters: 1,
  436. fixed: true,
  437. },
  438. {
  439. columnName: 'flightType',
  440. columnLabel: '航班类型',
  441. needFilters: 1,
  442. fixed: true,
  443. },
  444. {
  445. columnName: 'takeOffStand',
  446. columnLabel: '停机位',
  447. fixed: true,
  448. },
  449. // {
  450. // columnName: 'lastflightNO',
  451. // columnLabel: '前序航班',
  452. // fixed: true,
  453. // },
  454. // {
  455. // columnName: 'acLandingTime',
  456. // columnLabel: '实际降落\n时间',
  457. // width: 73,
  458. // },
  459. {
  460. columnName: 'speCargoInfo',
  461. columnLabel: '特货信息',
  462. customRender: ellipsisCell,
  463. },
  464. // {
  465. // columnName: 'transIn',
  466. // columnLabel: '中转进\n(运单/件)',
  467. // },
  468. // {
  469. // columnName: 'returns1',
  470. // columnLabel: '退运\n(板卡/件)',
  471. // },
  472. ],
  473. },
  474. {
  475. groupName: '货站相关',
  476. children: [
  477. // {
  478. // columnName: 'preLoad',
  479. // columnLabel: '运单申报\n(运单/件)',
  480. // },
  481. {
  482. columnName: 'enterPark',
  483. columnLabel: '入园\n(运单/件)',
  484. labelClassName: 'bg-purple',
  485. },
  486. {
  487. columnName: 'enterParkTime',
  488. columnLabel: '入园时间',
  489. labelClassName: 'bg-purple',
  490. },
  491. {
  492. columnName: 'enterCustoms',
  493. columnLabel: '海关中控\n(运单/件)',
  494. labelClassName: 'bg-purple',
  495. defaultHidden: true,
  496. },
  497. {
  498. columnName: 'enterCustomsTime',
  499. columnLabel: '海关中控\n时间',
  500. labelClassName: 'bg-purple',
  501. defaultHidden: true,
  502. },
  503. {
  504. columnName: 'passCustoms',
  505. columnLabel: '海关放行\n(运单/件)',
  506. labelClassName: 'bg-purple',
  507. },
  508. {
  509. columnName: 'passCustomsTime',
  510. columnLabel: '海关放行\n时间',
  511. labelClassName: 'bg-purple',
  512. },
  513. // {
  514. // columnName: 'nopassCustoms',
  515. // columnLabel: '海关不通过\n(运单/件)',
  516. // },
  517. // {
  518. // columnName: 'nopassCustomsTime',
  519. // columnLabel: '海关不通过\n时间',
  520. // },
  521. {
  522. columnName: 'receiveSure1',
  523. columnLabel: '运抵货站\n(运单/件)',
  524. // labelClassName: 'bg-purple',
  525. },
  526. {
  527. columnName: 'receiveSureTime',
  528. columnLabel: '运抵货站\n时间',
  529. // labelClassName: 'bg-purple',
  530. },
  531. // {
  532. // columnName: 'returns2',
  533. // columnLabel: '退运\n(板卡/件)',
  534. // },
  535. // {
  536. // columnName: 'returnTime',
  537. // columnLabel: '退运时间',
  538. // },
  539. {
  540. columnName: 'securityYes',
  541. columnLabel: '安检放行\n(运单/件)',
  542. },
  543. {
  544. columnName: 'securityTime',
  545. columnLabel: '安检放行\n时间',
  546. },
  547. {
  548. columnName: 'receiveSure2',
  549. columnLabel: '收运核单\n(运单/件)',
  550. },
  551. {
  552. columnName: 'receiveSureResultTime',
  553. columnLabel: '收运核单\n时间',
  554. },
  555. // {
  556. // columnName: 'receiveSure_No',
  557. // columnLabel: '核单不通过\n(运单/件)',
  558. // },
  559. // {
  560. // columnName: 'receiveSureTime_No',
  561. // columnLabel: '核单不通过\n时间',
  562. // },
  563. {
  564. columnName: 'tally_out',
  565. columnLabel: '理货\n(板卡/运单/件)',
  566. },
  567. {
  568. columnName: 'tallyTime_out',
  569. columnLabel: '理货时间',
  570. },
  571. // {
  572. // columnName: 'planJoinTime',
  573. // columnLabel: '计划交接\n时间',
  574. // },
  575. // {
  576. // columnName: 'wait',
  577. // columnLabel: '待运区\n(板卡/件)',
  578. // },
  579. // {
  580. // columnName: 'waitTime',
  581. // columnLabel: '待运区\n时间',
  582. // },
  583. {
  584. columnName: "concat(requestDepotJoinBoard,'/',requestDepotJoin)",
  585. columnLabel: '发起货站交接\n(板卡/件)',
  586. },
  587. {
  588. columnName: 'requestDepotJoinTime',
  589. columnLabel: '发起货站交接\n时间',
  590. },
  591. ],
  592. },
  593. {
  594. groupName: '地服相关',
  595. children: [
  596. // {
  597. // columnName: 'depotJoin',
  598. // columnLabel: '货站交接\n(板卡/件)',
  599. // },
  600. // {
  601. // columnName: 'depotJoinTime',
  602. // columnLabel: '货站交接\n时间',
  603. // },
  604. {
  605. columnName: 'resure',
  606. columnLabel: '交接复核\n(板卡/件)',
  607. },
  608. {
  609. columnName: 'resureTime',
  610. columnLabel: '交接复核\n时间',
  611. },
  612. // {
  613. // columnName: 'planeDown',
  614. // columnLabel: '机下交接\n(板卡/件)',
  615. // columnDescribe: '根据交接复核计算所得',
  616. // },
  617. {
  618. columnName: 'planeDownTime',
  619. columnLabel: '机下交接\n时间',
  620. },
  621. // {
  622. // columnName: "concat(loadPlaneSureBoard,'/',loadPlaneSure)",
  623. // columnLabel: '装机\n(板卡/件)',
  624. // },
  625. {
  626. columnName: 'loadPlaneSureTime',
  627. columnLabel: '装机完成\n时间',
  628. defaultHidden: true,
  629. },
  630. // {
  631. // columnName: 'loadPlane',
  632. // columnLabel: '关闭舱门\n(板卡/件)',
  633. // },
  634. {
  635. columnName: 'loadPlaneTime',
  636. columnLabel: '关闭舱门\n时间',
  637. },
  638. {
  639. columnName: 'register',
  640. columnLabel: '拉下登记\n(板卡/运单/件)',
  641. },
  642. {
  643. columnName: 'pullregisterTime',
  644. columnLabel: '拉下登记\n时间',
  645. },
  646. {
  647. columnName: 'stowage',
  648. columnLabel: '实配\n(板卡/件/运单/重量)',
  649. },
  650. {
  651. columnName: 'stowageTime',
  652. columnLabel: '实配时间',
  653. },
  654. // {
  655. // columnName: 'pullSure',
  656. // columnLabel: '拉回确认\n(板卡/件)',
  657. // },
  658. // {
  659. // columnName: 'pullSureTime',
  660. // columnLabel: '拉回确认\n时间',
  661. // },
  662. ],
  663. },
  664. ],
  665. InternationalArrivalAirport: [
  666. {
  667. groupName: '航班相关',
  668. children: [
  669. {
  670. columnName: 'IATACode',
  671. columnLabel: '航司',
  672. needFilters: 1,
  673. fixed: true,
  674. },
  675. {
  676. columnName: 'flightNO',
  677. columnLabel: '航班号',
  678. needFilters: 1,
  679. fixed: true,
  680. },
  681. {
  682. columnName: 'flightDate',
  683. columnLabel: '执飞日期',
  684. fixed: true,
  685. },
  686. {
  687. columnName: 'planLandingTime',
  688. columnLabel: '计划降落\n时间',
  689. fixed: true,
  690. },
  691. {
  692. columnName: 'acLandingTime',
  693. columnLabel: '实际降落\n时间',
  694. fixed: true,
  695. },
  696. {
  697. columnName: 'target',
  698. columnLabel: '航程',
  699. width: 100,
  700. needFilters: 1,
  701. fixed: true,
  702. },
  703. {
  704. columnName: 'planeType',
  705. columnLabel: '机型',
  706. needFilters: 1,
  707. fixed: true,
  708. },
  709. {
  710. columnName: 'flightType',
  711. columnLabel: '航班类型',
  712. needFilters: 1,
  713. fixed: true,
  714. },
  715. {
  716. columnName: 'landingStand',
  717. columnLabel: '停机位',
  718. fixed: true,
  719. },
  720. {
  721. columnName: 'speCargoInfo',
  722. columnLabel: '特货信息',
  723. customRender: ellipsisCell,
  724. },
  725. // {
  726. // columnName: 'preUnLoad',
  727. // columnLabel: '预计卸载数\n(运单/件)',
  728. // },
  729. // {
  730. // columnName: 'transOut',
  731. // columnLabel: '中转出\n(运单/件)',
  732. // },
  733. // {
  734. // columnName: 'receiveDiff',
  735. // columnLabel: '收货差异\n(板卡/件)',
  736. // },
  737. ],
  738. },
  739. {
  740. groupName: '地服相关',
  741. children: [
  742. // {
  743. // columnName: 'unloadBill',
  744. // columnLabel: '卸机单\n(板/箱/卡)',
  745. // },
  746. // {
  747. // columnName: 'unloadBillTime',
  748. // columnLabel: '卸机时间',
  749. // },
  750. {
  751. columnName: 'unLoad',
  752. columnLabel: '卸机\n(板/箱/卡)',
  753. },
  754. {
  755. columnName: 'unLoadTime',
  756. columnLabel: '卸机时间',
  757. },
  758. {
  759. columnName: 'planeDown',
  760. columnLabel: '机下交接\n(板/箱/卡)',
  761. },
  762. {
  763. columnName: 'planeDownTime_IN',
  764. columnLabel: '机下交接\n时间',
  765. },
  766. ],
  767. },
  768. {
  769. groupName: '货站相关',
  770. children: [
  771. {
  772. columnName: 'depotJoin',
  773. columnLabel: '货站交接\n(板/箱/卡)',
  774. },
  775. {
  776. columnName: 'depotJoinTime_IN',
  777. columnLabel: '货站交接\n时间',
  778. },
  779. {
  780. columnName: 'tally',
  781. columnLabel: '理货\n(板卡/运单/件/重量)',
  782. },
  783. {
  784. columnName: 'tallyTime_in',
  785. columnLabel: '理货时间',
  786. },
  787. {
  788. columnName: "concat(passCustomsList_in,'/',passCustoms_in)",
  789. columnLabel: '海关放行\n(运单/件)',
  790. labelClassName: 'bg-purple',
  791. },
  792. {
  793. columnName: 'passCustomsTime_in',
  794. columnLabel: '海关放行\n时间',
  795. labelClassName: 'bg-purple',
  796. },
  797. {
  798. columnName: 'outWarehouse',
  799. columnLabel: '出库\n(运单/件/重量)',
  800. },
  801. {
  802. columnName: 'outWarehouseTime',
  803. columnLabel: '出库时间',
  804. },
  805. // {
  806. // columnName: "concat(punishCustomsList_in,'/',punishCustoms_in)",
  807. // columnLabel: '海关罚没\n(运单/件)',
  808. // },
  809. // {
  810. // columnName: 'punishCustomsTime_in',
  811. // columnLabel: '海关罚没\n时间',
  812. // },
  813. ],
  814. },
  815. ],
  816. InternationalTransferDepartureAirport: [
  817. {
  818. groupName: '航班相关',
  819. children: [
  820. {
  821. columnName: 'IATACode',
  822. columnLabel: '航司',
  823. needFilters: 1,
  824. fixed: true,
  825. },
  826. {
  827. columnName: 'flightNO',
  828. columnLabel: '航班号',
  829. needFilters: 1,
  830. fixed: true,
  831. },
  832. {
  833. columnName: 'flightDate',
  834. columnLabel: '执飞日期',
  835. fixed: true,
  836. },
  837. {
  838. columnName: 'planDepartureTime',
  839. columnLabel: '计划起飞\n时间',
  840. fixed: true,
  841. },
  842. {
  843. columnName: 'acDepartureTime',
  844. columnLabel: '实际起飞\n时间',
  845. fixed: true,
  846. },
  847. {
  848. columnName: 'target',
  849. columnLabel: '航程',
  850. width: 100,
  851. needFilters: 1,
  852. fixed: true,
  853. },
  854. {
  855. columnName: 'planeType',
  856. columnLabel: '机型',
  857. needFilters: 1,
  858. fixed: true,
  859. },
  860. {
  861. columnName: 'flightType',
  862. columnLabel: '航班类型',
  863. needFilters: 1,
  864. fixed: true,
  865. },
  866. {
  867. columnName: 'takeOffStand',
  868. columnLabel: '停机位',
  869. fixed: true,
  870. },
  871. {
  872. columnName: 'speCargoInfo',
  873. columnLabel: '特货信息',
  874. customRender: ellipsisCell,
  875. },
  876. ],
  877. },
  878. {
  879. groupName: '货站相关',
  880. children: [
  881. {
  882. columnName: 'enterPark',
  883. columnLabel: '入园\n(运单/件)',
  884. labelClassName: 'bg-purple',
  885. },
  886. {
  887. columnName: 'enterParkTime',
  888. columnLabel: '入园时间',
  889. labelClassName: 'bg-purple',
  890. },
  891. {
  892. columnName: 'enterCustoms',
  893. columnLabel: '海关中控\n(运单/件)',
  894. labelClassName: 'bg-purple',
  895. defaultHidden: true,
  896. },
  897. {
  898. columnName: 'enterCustomsTime',
  899. columnLabel: '海关中控\n时间',
  900. labelClassName: 'bg-purple',
  901. defaultHidden: true,
  902. },
  903. {
  904. columnName: 'passCustoms',
  905. columnLabel: '海关放行\n(运单/件)',
  906. labelClassName: 'bg-purple',
  907. },
  908. {
  909. columnName: 'passCustomsTime',
  910. columnLabel: '海关放行\n时间',
  911. labelClassName: 'bg-purple',
  912. },
  913. {
  914. columnName: 'receiveSure1',
  915. columnLabel: '运抵货站\n(运单/件)',
  916. },
  917. {
  918. columnName: 'receiveSureTime',
  919. columnLabel: '运抵货站\n时间',
  920. },
  921. {
  922. columnName: 'securityYes',
  923. columnLabel: '安检放行\n(运单/件)',
  924. },
  925. {
  926. columnName: 'securityTime',
  927. columnLabel: '安检放行\n时间',
  928. },
  929. {
  930. columnName: 'receiveSure2',
  931. columnLabel: '收运核单\n(运单/件)',
  932. },
  933. {
  934. columnName: 'receiveSureResultTime',
  935. columnLabel: '收运核单\n时间',
  936. },
  937. {
  938. columnName: 'tally_out',
  939. columnLabel: '理货\n(板卡/运单/件)',
  940. },
  941. {
  942. columnName: 'tallyTime_out',
  943. columnLabel: '理货时间',
  944. },
  945. ],
  946. },
  947. {
  948. groupName: '地服相关',
  949. children: [
  950. {
  951. columnName: 'stowage',
  952. columnLabel: '实配\n(板卡/件/运单/重量)',
  953. },
  954. {
  955. columnName: 'stowageTime',
  956. columnLabel: '实配时间',
  957. },
  958. ],
  959. },
  960. ],
  961. }
  962. const headerClassMap = {
  963. 航班相关: 'bg-yellow',
  964. 运单相关: 'bg-purple',
  965. 货站相关: 'bg-green',
  966. 地服相关: 'bg-cyan',
  967. }
  968. const computedWidth = (column: SimpleColumn) => {
  969. let width = 0
  970. column.columnLabel.split('\n').forEach(line => {
  971. const len = line.length
  972. let realLength = 0
  973. for (let i = 0; i < len; i++) {
  974. realLength += line.charCodeAt(i) > 255 ? 2 : 1
  975. }
  976. if (width < realLength * 9) {
  977. width = realLength * 9
  978. }
  979. })
  980. // 筛选/排序按钮宽度
  981. // if (column.needFilters || column.needSort) {
  982. // width += 8
  983. // }
  984. width += 8
  985. // border
  986. return width + 1
  987. }
  988. function getAddend(planeType: string, name: string) {
  989. const minute =
  990. LOAD_WARNING_MAP[
  991. name.includes('International') ? 'internationalDeparture' : 'departure'
  992. ][planeType]
  993. if (minute) {
  994. return minute * -1 * 60 * 1000
  995. }
  996. return null
  997. }
  998. function computedTime(originalTime: CommonValue, addend: number | null) {
  999. if ((originalTime ?? '') === '' || addend === null) {
  1000. return null
  1001. }
  1002. let datetime = 0
  1003. if (typeof originalTime === 'string') {
  1004. datetime = new Date(originalTime).getTime()
  1005. }
  1006. if (typeof originalTime === 'number') {
  1007. datetime = originalTime
  1008. }
  1009. datetime += addend
  1010. return parseTime(new Date(datetime), '{y}-{m}-{d} {h}:{i}:{s}')
  1011. }
  1012. export function useAirportTable(name: string, formData: CommonData) {
  1013. const tableColumns = ref<CommonTableColumn[]>([])
  1014. const tableData = ref<CommonData[]>([])
  1015. const getTableColumns = () => {
  1016. const groups = columnGroupsMap[name]
  1017. tableColumns.value = groups.reduce(
  1018. (columns: CommonTableColumn[], group) => {
  1019. group.children.forEach(column => {
  1020. columns.push({
  1021. key: column.columnName,
  1022. dataKey: column.columnName,
  1023. title: column.columnLabel,
  1024. columnDescribe: '',
  1025. dataType: '',
  1026. listqueryTemplateID: null,
  1027. needCount: ['航班相关'].includes(group.groupName) ? 0 : 1,
  1028. countMode: column.columnLabel.includes('/') ? 'split' : 'notNull',
  1029. needFilters: null,
  1030. needGroup: null,
  1031. needSearch: null,
  1032. needShow: 1,
  1033. needSort: 1,
  1034. orderNumber: null,
  1035. queryTemplateColumnSetID: null,
  1036. queryTemplateID: null,
  1037. width:
  1038. name.includes('Departure') || name.includes('International')
  1039. ? computedWidth(column)
  1040. : undefined,
  1041. flexGrow: 1,
  1042. align: 'center',
  1043. labelClassName: headerClassMap[group.groupName] ?? '',
  1044. groupName: group.groupName,
  1045. ...column,
  1046. })
  1047. })
  1048. return columns
  1049. },
  1050. []
  1051. )
  1052. }
  1053. const flightTypeMap = ['货机', '客机', '其他']
  1054. const getTableData = async () => {
  1055. try {
  1056. const {
  1057. startDate,
  1058. endDate,
  1059. flightState,
  1060. flightWarning,
  1061. waybillType,
  1062. } = formData
  1063. const dataContent = [
  1064. startDate,
  1065. endDate,
  1066. // flightState,
  1067. // flightWarning
  1068. ]
  1069. // if (name.includes('International')) {
  1070. // dataContent.push(waybillType)
  1071. // }
  1072. const {
  1073. code,
  1074. returnData: { columnSet, listValues },
  1075. message,
  1076. } = await Query<CommonData>({
  1077. id: DATACONTENT_ID[name.slice(0, 1).toLowerCase() + name.slice(1)],
  1078. dataContent,
  1079. })
  1080. if (Number(code) !== 0) {
  1081. throw new Error(message || '失败')
  1082. }
  1083. // tableColumns.value = columnSet.map(column => ({
  1084. // key: column.columnName,
  1085. // dataKey: column.columnName,
  1086. // title: column.columnLabel,
  1087. // width: column.columnLabel.length * 50,
  1088. // flexGrow: 1,
  1089. // align: 'center',
  1090. // ...column,
  1091. // }))
  1092. tableData.value = listValues.map(row => {
  1093. // if (name === 'DepartureAirport') {
  1094. // row.securityYes =
  1095. // typeof row.addCargo === 'string'
  1096. // ? row.addCargo.split('/').slice(0, 2).join('/')
  1097. // : null
  1098. // row.securityTime = row.addCargoTime
  1099. // }
  1100. row.flightType =
  1101. typeof row.flightType === 'number'
  1102. ? flightTypeMap[row.flightType] ?? '其他'
  1103. : '其他'
  1104. if (
  1105. (name === 'DepartureAirport' ||
  1106. name === 'InternationalDepartureAirport') &&
  1107. row.flightType === '货机'
  1108. ) {
  1109. row.endLoadTime = computedTime(
  1110. row.planDepartureTime,
  1111. getAddend(`${row.planeType}`, name)
  1112. )
  1113. }
  1114. return {
  1115. ...row,
  1116. rowKey: `${row.IATACode}-${row.flightNO}-${row.flightDate}`,
  1117. }
  1118. })
  1119. } catch (error) {
  1120. console.error(error)
  1121. }
  1122. }
  1123. onMounted(() => {
  1124. getTableColumns()
  1125. })
  1126. return {
  1127. tableColumns,
  1128. tableData,
  1129. getTableData,
  1130. }
  1131. }