useAirportTable.ts 30 KB

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