useAirportTable.ts 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957
  1. import { Query } from '@/api/webApi'
  2. import { CommonData, CommonTableColumn } from '~/common'
  3. interface SimpleColumn {
  4. columnName: string
  5. columnLabel: string
  6. [x: string]: any
  7. }
  8. const columnGroupsMap: {
  9. [x: string]: {
  10. groupName: string
  11. children: SimpleColumn[]
  12. }[]
  13. } = {
  14. DepartureAirport: [
  15. {
  16. groupName: '航班相关',
  17. children: [
  18. {
  19. columnName: 'IATACode',
  20. columnLabel: '航司',
  21. needFilters: 1,
  22. },
  23. {
  24. columnName: 'flightNO',
  25. columnLabel: '航班号',
  26. needFilters: 1,
  27. },
  28. {
  29. columnName: 'flightDate',
  30. columnLabel: '执飞日期',
  31. width: 73,
  32. },
  33. {
  34. columnName: 'planDepartureTime',
  35. columnLabel: '起飞时间',
  36. width: 73,
  37. },
  38. {
  39. columnName: 'target',
  40. columnLabel: '目的站',
  41. needFilters: 1,
  42. },
  43. {
  44. columnName: 'takeOffStand',
  45. columnLabel: '停机位',
  46. },
  47. {
  48. columnName: 'lastflightNO',
  49. columnLabel: '前序航班',
  50. },
  51. {
  52. columnName: 'acLandingTime',
  53. columnLabel: '实际降落\n时间',
  54. width: 73,
  55. },
  56. ],
  57. },
  58. {
  59. groupName: '货站相关',
  60. children: [
  61. {
  62. columnName: 'speCargoInfo',
  63. columnLabel: '特货信息',
  64. },
  65. {
  66. columnName: 'transIn',
  67. columnLabel: '中转进\n(运单/件)',
  68. },
  69. {
  70. columnName: 'returns',
  71. columnLabel: '退运\n(板卡/件)',
  72. },
  73. ],
  74. },
  75. {
  76. groupName: '地服相关',
  77. children: [
  78. {
  79. columnName: 'preLoad',
  80. columnLabel: '运单申报\n(运单/件)',
  81. },
  82. {
  83. columnName: 'receiveSure',
  84. columnLabel: '收运核单\n(运单/件/重量)',
  85. },
  86. {
  87. columnName: 'receiveSureTime',
  88. columnLabel: '收运核单\n时间',
  89. },
  90. {
  91. columnName: 'receiveSure_No',
  92. columnLabel: '核单不通过\n(运单/件/重量)',
  93. },
  94. {
  95. columnName: 'receiveSureTime_No',
  96. columnLabel: '核单不通过\n时间',
  97. },
  98. {
  99. columnName: 'checks',
  100. columnLabel: '查验\n(拒运/查验)',
  101. },
  102. {
  103. columnName: 'checkTime',
  104. columnLabel: '查验时间',
  105. },
  106. {
  107. columnName: 'securityYes',
  108. columnLabel: '安检放行\n(运单/件)',
  109. },
  110. {
  111. columnName: 'securityTime',
  112. columnLabel: '安检放行\n时间',
  113. },
  114. {
  115. columnName: 'addCargo',
  116. columnLabel: '加货\n(运单/板卡/件/重量)',
  117. },
  118. {
  119. columnName: 'addCargoTime',
  120. columnLabel: '加货时间',
  121. },
  122. // {
  123. // columnName: 'wait',
  124. // columnLabel: '待运区\n(板卡/件)',
  125. // },
  126. // {
  127. // columnName: 'waitTime',
  128. // columnLabel: '待运区时间',
  129. // },
  130. {
  131. columnName: 'stowage',
  132. columnLabel: '预配载\n(板卡/件)',
  133. },
  134. {
  135. columnName: 'stowageTime',
  136. columnLabel: '预配载时间',
  137. },
  138. // {
  139. // columnName: 'planJoinTime',
  140. // columnLabel: '计划交接\n时间',
  141. // },
  142. // {
  143. // columnName: 'requestDepotJoin',
  144. // columnLabel: '发起货站交接\n(板卡/件)',
  145. // },
  146. // {
  147. // columnName: 'requestDepotJoinTime',
  148. // columnLabel: '发起货站交接\n时间',
  149. // },
  150. {
  151. columnName: 'depotJoin',
  152. columnLabel: '货站交接\n(板卡/件)',
  153. },
  154. {
  155. columnName: 'depotJoinTime',
  156. columnLabel: '货站交接\n时间',
  157. },
  158. {
  159. columnName: 'resure',
  160. columnLabel: '运输前复核\n(板卡/件)',
  161. },
  162. {
  163. columnName: 'resureTime',
  164. columnLabel: '运输前复核\n时间',
  165. },
  166. {
  167. columnName: 'planeDown',
  168. columnLabel: '机下交接\n(板卡/件)',
  169. columnDescribe: '根据运输前复核计算所得',
  170. },
  171. {
  172. columnName: 'planeDownTime',
  173. columnLabel: '机下交接\n时间',
  174. },
  175. // {
  176. // columnName: 'loadPlaneSure',
  177. // columnLabel: '装机\n(板卡/件)',
  178. // },
  179. {
  180. columnName: 'loadPlaneSureTime',
  181. columnLabel: '装机时间',
  182. },
  183. // {
  184. // columnName: 'loadPlane',
  185. // columnLabel: '关闭舱门\n(板卡/件)',
  186. // },
  187. {
  188. columnName: 'loadPlaneTime',
  189. columnLabel: '关闭舱门\n时间',
  190. },
  191. {
  192. columnName: 'register',
  193. columnLabel: '拉下登记\n(板卡/件)',
  194. },
  195. {
  196. columnName: 'pullRegisterTime',
  197. columnLabel: '拉下登记\n时间',
  198. },
  199. {
  200. columnName: 'pullSure',
  201. columnLabel: '拉回确认\n(板卡/件)',
  202. },
  203. {
  204. columnName: 'pullSureTime',
  205. columnLabel: '拉回确认\n时间',
  206. },
  207. ],
  208. },
  209. ],
  210. InternationalDepartureAirport: [
  211. {
  212. groupName: '航班相关',
  213. children: [
  214. {
  215. columnName: 'IATACode',
  216. columnLabel: '航司',
  217. needFilters: 1,
  218. },
  219. {
  220. columnName: 'flightNO',
  221. columnLabel: '航班号',
  222. needFilters: 1,
  223. },
  224. {
  225. columnName: 'flightDate',
  226. columnLabel: '执飞日期',
  227. width: 73,
  228. },
  229. {
  230. columnName: 'planDepartureTime',
  231. columnLabel: '起飞时间',
  232. width: 73,
  233. },
  234. {
  235. columnName: 'target',
  236. columnLabel: '目的站',
  237. needFilters: 1,
  238. },
  239. {
  240. columnName: 'takeOffStand',
  241. columnLabel: '停机位',
  242. },
  243. {
  244. columnName: 'lastflightNO',
  245. columnLabel: '前序航班',
  246. },
  247. {
  248. columnName: 'acLandingTime',
  249. columnLabel: '实际降落\n时间',
  250. width: 73,
  251. },
  252. ],
  253. },
  254. {
  255. groupName: '货站相关',
  256. children: [
  257. {
  258. columnName: 'speCargoInfo',
  259. columnLabel: '特货信息',
  260. },
  261. {
  262. columnName: 'preLoad',
  263. columnLabel: '预计装载数\n(运单/件)',
  264. },
  265. {
  266. columnName: 'transIn',
  267. columnLabel: '中转进\n(运单/件)',
  268. },
  269. {
  270. columnName: 'returns1',
  271. columnLabel: '退运\n(板卡/件)',
  272. },
  273. ],
  274. },
  275. {
  276. groupName: '地服相关',
  277. children: [
  278. {
  279. columnName: 'enterPark',
  280. columnLabel: '入园\n(运单/件)',
  281. },
  282. {
  283. columnName: 'enterParkTime',
  284. columnLabel: '入园时间',
  285. },
  286. {
  287. columnName: 'enterCustoms',
  288. columnLabel: '进入海关\n(运单/件)',
  289. },
  290. {
  291. columnName: 'enterCustomsTime',
  292. columnLabel: '进入海关时间',
  293. },
  294. {
  295. columnName: 'passCustoms',
  296. columnLabel: '海关放行\n(运单/件)',
  297. },
  298. {
  299. columnName: 'passCustomsTime',
  300. columnLabel: '海关放行\n时间',
  301. },
  302. {
  303. columnName: 'nopassCustoms',
  304. columnLabel: '海关不通过\n(运单/件)',
  305. },
  306. {
  307. columnName: 'nopassCustomsTime',
  308. columnLabel: '海关不通过\n时间',
  309. },
  310. {
  311. columnName: 'receiveSure1',
  312. columnLabel: '运抵货站\n(运单/件)',
  313. },
  314. {
  315. columnName: 'receiveSureTime',
  316. columnLabel: '运抵货站\n时间',
  317. },
  318. {
  319. columnName: 'returns2',
  320. columnLabel: '退运\n(板卡/件)',
  321. },
  322. {
  323. columnName: 'returnTime',
  324. columnLabel: '退运时间',
  325. },
  326. {
  327. columnName: 'securityYes',
  328. columnLabel: '安检放行\n(运单/件)',
  329. },
  330. {
  331. columnName: 'securityTime',
  332. columnLabel: '安检放行\n时间',
  333. },
  334. {
  335. columnName: 'receiveSure2',
  336. columnLabel: '收运核单\n(运单/件)',
  337. },
  338. {
  339. columnName: 'receiveSureResultTime',
  340. columnLabel: '收运核单\n时间',
  341. },
  342. {
  343. columnName: 'receiveSure_No',
  344. columnLabel: '核单不通过\n(运单/件)',
  345. },
  346. {
  347. columnName: 'receiveSureTime_No',
  348. columnLabel: '核单不通过\n时间',
  349. },
  350. {
  351. columnName: 'tally_out',
  352. columnLabel: '理货\n(板卡/运单/件)',
  353. },
  354. {
  355. columnName: 'tallyTime_out',
  356. columnLabel: '理货时间',
  357. },
  358. {
  359. columnName: 'planJoinTime',
  360. columnLabel: '计划交接\n时间',
  361. },
  362. {
  363. columnName: 'wait',
  364. columnLabel: '待运区\n(板卡/件)',
  365. },
  366. {
  367. columnName: 'waitTime',
  368. columnLabel: '待运区\n时间',
  369. },
  370. {
  371. columnName: 'stowage',
  372. columnLabel: '预配载\n(板卡/件)',
  373. },
  374. {
  375. columnName: 'stowageTime',
  376. columnLabel: '预配载时间',
  377. },
  378. {
  379. columnName: "concat(requestDepotJoinBoard,'/',requestDepotJoin)",
  380. columnLabel: '发起货站交接\n(板卡/件)',
  381. },
  382. {
  383. columnName: 'requestDepotJoinTime',
  384. columnLabel: '发起货站交接\n时间',
  385. },
  386. {
  387. columnName: 'depotJoin',
  388. columnLabel: '货站交接\n(板卡/件)',
  389. },
  390. {
  391. columnName: 'depotJoinTime',
  392. columnLabel: '货站交接\n时间',
  393. },
  394. {
  395. columnName: 'resure',
  396. columnLabel: '运输前复核\n(板卡/件)',
  397. },
  398. {
  399. columnName: 'resureTime',
  400. columnLabel: '运输前复核\n时间',
  401. },
  402. {
  403. columnName: 'planeDown',
  404. columnLabel: '机下交接\n(板卡/件)',
  405. },
  406. {
  407. columnName: 'planeDownTime',
  408. columnLabel: '机下交接\n时间',
  409. },
  410. {
  411. columnName: "concat(loadPlaneSureBoard,'/',loadPlaneSure)",
  412. columnLabel: '装机单确认\n(板卡/件)',
  413. },
  414. {
  415. columnName: 'loadPlaneSureTime',
  416. columnLabel: '装机单确认\n时间',
  417. },
  418. {
  419. columnName: 'loadPlane',
  420. columnLabel: '装机\n(板卡/件)',
  421. },
  422. {
  423. columnName: 'loadPlaneTime',
  424. columnLabel: '装机时间',
  425. },
  426. {
  427. columnName: 'register',
  428. columnLabel: '拉下登记\n(板卡/运单/件)',
  429. },
  430. {
  431. columnName: 'pullregisterTime',
  432. columnLabel: '拉下登记\n时间',
  433. },
  434. ],
  435. },
  436. ],
  437. ArrivalAirport: [
  438. {
  439. groupName: '航班相关',
  440. children: [
  441. {
  442. columnName: 'IATACode',
  443. columnLabel: '航司',
  444. needFilters: 1,
  445. },
  446. {
  447. columnName: 'flightNO',
  448. columnLabel: '航班号',
  449. needFilters: 1,
  450. },
  451. {
  452. columnName: 'flightDate',
  453. columnLabel: '执飞日期',
  454. },
  455. {
  456. columnName: 'planLandingTime',
  457. columnLabel: '降落时间',
  458. },
  459. {
  460. columnName: 'target',
  461. columnLabel: '目的站',
  462. needFilters: 1,
  463. },
  464. {
  465. columnName: 'landingStand',
  466. columnLabel: '停机位',
  467. },
  468. ],
  469. },
  470. {
  471. groupName: '货站相关',
  472. children: [
  473. {
  474. columnName: 'speCargoInfo',
  475. columnLabel: '特货信息',
  476. },
  477. {
  478. columnName: 'preUnLoad',
  479. columnLabel: '预计卸载数\n(运单/件)',
  480. },
  481. {
  482. columnName: 'transOut',
  483. columnLabel: '中转出\n(运单/件)',
  484. },
  485. {
  486. columnName: 'receiveDiff',
  487. columnLabel: '收货差异\n(板卡/件)',
  488. },
  489. ],
  490. },
  491. {
  492. groupName: '地服相关',
  493. children: [
  494. // {
  495. // columnName: 'unloadBill',
  496. // columnLabel: '卸机单\n(板/箱/卡)',
  497. // },
  498. // {
  499. // columnName: 'unloadBillTime',
  500. // columnLabel: '卸机单确认\n时间',
  501. // },
  502. {
  503. columnName: 'unLoad',
  504. columnLabel: '卸机\n(板/箱/卡)',
  505. },
  506. {
  507. columnName: 'unLoadTime',
  508. columnLabel: '卸机时间',
  509. },
  510. {
  511. columnName: 'planeDown',
  512. columnLabel: '机下交接\n(板/箱/卡)',
  513. columnDescribe: '根据运输前复核计算所得',
  514. },
  515. {
  516. columnName: 'planeDownTime_IN',
  517. columnLabel: '机下交接\n时间',
  518. },
  519. {
  520. columnName: 'depotJoin',
  521. columnLabel: '货站交接\n(板/箱/卡)',
  522. },
  523. {
  524. columnName: 'depotJoinTime_IN',
  525. columnLabel: '货站交接\n时间',
  526. },
  527. {
  528. columnName: 'tally',
  529. columnLabel: '理货\n(板卡/运单/件/重量)',
  530. },
  531. {
  532. columnName: 'tallyTime_in',
  533. columnLabel: '理货时间',
  534. },
  535. {
  536. columnName: 'outWarehouse',
  537. columnLabel: '出库\n(批/运单/件)',
  538. },
  539. {
  540. columnName: 'outWarehouseTime',
  541. columnLabel: '出库时间',
  542. },
  543. ],
  544. },
  545. ],
  546. InternationalArrivalAirport: [
  547. {
  548. groupName: '航班相关',
  549. children: [
  550. {
  551. columnName: 'IATACode',
  552. columnLabel: '航司',
  553. needFilters: 1,
  554. },
  555. {
  556. columnName: 'flightNO',
  557. columnLabel: '航班号',
  558. needFilters: 1,
  559. },
  560. {
  561. columnName: 'flightDate',
  562. columnLabel: '执飞日期',
  563. },
  564. {
  565. columnName: 'planLandingTime',
  566. columnLabel: '降落时间',
  567. },
  568. {
  569. columnName: 'target',
  570. columnLabel: '目的站',
  571. needFilters: 1,
  572. },
  573. {
  574. columnName: 'landingStand',
  575. columnLabel: '停机位',
  576. },
  577. ],
  578. },
  579. {
  580. groupName: '货站相关',
  581. children: [
  582. {
  583. columnName: 'speCargoInfo',
  584. columnLabel: '特货信息',
  585. },
  586. {
  587. columnName: 'preUnLoad',
  588. columnLabel: '预计卸载数\n(运单/件)',
  589. },
  590. {
  591. columnName: 'transOut',
  592. columnLabel: '中转出\n(运单/件)',
  593. },
  594. {
  595. columnName: 'receiveDiff',
  596. columnLabel: '收货差异\n(板卡/件)',
  597. },
  598. ],
  599. },
  600. {
  601. groupName: '地服相关',
  602. children: [
  603. // {
  604. // columnName: 'unloadBill',
  605. // columnLabel: '卸机单\n(板/箱/卡)',
  606. // },
  607. // {
  608. // columnName: 'unloadBillTime',
  609. // columnLabel: '卸机时间',
  610. // },
  611. {
  612. columnName: 'unLoad',
  613. columnLabel: '卸机\n(板/箱/卡)',
  614. },
  615. {
  616. columnName: 'unLoadTime',
  617. columnLabel: '卸机时间',
  618. },
  619. {
  620. columnName: 'planeDown',
  621. columnLabel: '机下交接\n(板/箱/卡)',
  622. },
  623. {
  624. columnName: 'planeDownTime_IN',
  625. columnLabel: '机下交接\n时间',
  626. },
  627. {
  628. columnName: 'depotJoin',
  629. columnLabel: '货站交接\n(板/箱/卡)',
  630. },
  631. {
  632. columnName: 'depotJoinTime_IN',
  633. columnLabel: '货站交接\n时间',
  634. },
  635. {
  636. columnName: 'tally',
  637. columnLabel: '理货\n(板卡/运单/件/重量)',
  638. },
  639. {
  640. columnName: 'tallyTime_in',
  641. columnLabel: '理货时间',
  642. },
  643. {
  644. columnName: "concat(passCustomsList_in,'/',passCustoms_in)",
  645. columnLabel: '海关放行\n(运单/件)',
  646. },
  647. {
  648. columnName: 'passCustomsTime_in',
  649. columnLabel: '海关放行\n时间',
  650. },
  651. {
  652. columnName: 'outWarehouse',
  653. columnLabel: '出库\n(批/运单/件)',
  654. },
  655. {
  656. columnName: 'outWarehouseTime',
  657. columnLabel: '出库时间',
  658. },
  659. {
  660. columnName: "concat(punishCustomsList_in,'/',punishCustoms_in)",
  661. columnLabel: '海关罚没\n(运单/件)',
  662. },
  663. {
  664. columnName: 'punishCustomsTime_in',
  665. columnLabel: '海关罚没\n时间',
  666. },
  667. ],
  668. },
  669. ],
  670. }
  671. const simulateTableDataMap = {
  672. DepartureAirport: Array.from({ length: 3 }, (_, i) => ({
  673. flightNO: 'ZH3423',
  674. flightDate: '2022/09/10',
  675. planDepartureTime: '22/09/10 12:01',
  676. landingAirport: '-NGK-PEK',
  677. takeOffStand: '84',
  678. inFlightNO: 'HU2451',
  679. planLandingTime: '2022/09/10 11:01',
  680. C1: '锂2/冷1',
  681. C2: '365/536',
  682. C3: '1/2',
  683. C4: '0/0',
  684. C5: '364/534/1254KG',
  685. C5_time: '12:02',
  686. C5_1: '364/534/1254KG',
  687. C5_1_time: '12:02',
  688. C6: '0/7',
  689. C6_time: '12:02',
  690. C7: '364/534',
  691. C7_time: '12:02',
  692. C8: '8/365/536/1254KG',
  693. C8_time: '12:02',
  694. C9: '8/536',
  695. C9_time: '12:02',
  696. C10: '8/536',
  697. C10_time: '12:02',
  698. C11: '11:45',
  699. C12_0: '8/536',
  700. C12_0_time: '12:02',
  701. C12: i === 1 ? '4/243' : '8/536',
  702. C12_time: '12:02',
  703. C13: i === 2 ? '5/357' : '8/536',
  704. C13_time: '12:02',
  705. C14: '8/536',
  706. C14_time: '12:02',
  707. C15_0: '8/536',
  708. C15_0_time: '12:02',
  709. C15: '8/536',
  710. C15_time: '12:02',
  711. C16: '358/5',
  712. C16_time: '12:02',
  713. C17: '0/5',
  714. C17_time: '12:02',
  715. })),
  716. InternationalDepartureAirport: Array.from({ length: 3 }, (_, i) => ({
  717. flightNO: 'ZH3423',
  718. flightDate: '2022/09/10',
  719. planDepartureTime: '22/09/10 12:01',
  720. landingAirport: '-NGK-PEK',
  721. takeOffStand: '84',
  722. inFlightNO: 'HU2451',
  723. planLandingTime: '2022/09/10 11:01',
  724. C1: '锂2/冷1',
  725. C2: '365/536',
  726. C3: '1/2',
  727. C4: '0/0',
  728. C5: '364/534',
  729. C5_time: '12:02',
  730. C6: '364/534',
  731. C6_time: '12:02',
  732. C7: '364/534',
  733. C7_time: '12:02',
  734. C8: '0/7',
  735. C8_time: '12:02',
  736. C9: '8/536',
  737. C9_time: '12:02',
  738. C10: '8/536',
  739. C10_time: '12:02',
  740. C11: '8/536',
  741. C11_time: '12:02',
  742. C12: '8/536',
  743. C12_time: '12:02',
  744. C13: '8/536',
  745. C13_time: '12:02',
  746. C14: '8/365/536',
  747. C14_time: '12:02',
  748. C15: '11:45',
  749. C16: '8/536',
  750. C16_time: '12:02',
  751. C17: '8/536',
  752. C17_time: '12:02',
  753. C18: '8/536',
  754. C18_time: '12:02',
  755. C19: '8/536',
  756. C19_time: '12:02',
  757. C20: '8/536',
  758. C20_time: '12:02',
  759. C21: '8/536',
  760. C21_time: '12:02',
  761. C22: '8/536',
  762. C22_time: '12:02',
  763. C23: '8/536',
  764. C23_time: '12:02',
  765. C24: '8/365/536',
  766. C24_time: '12:02',
  767. })),
  768. ArrivalAirport: Array.from({ length: 3 }, (_, i) => ({
  769. flightNO: 'ZH3423',
  770. flightDate: '2022/09/10',
  771. planLandingTime: '22/09/10 12:01',
  772. landingAirport: 'NKG-PEK-',
  773. landingStand: '84',
  774. C1: '锂2/冷1',
  775. C2: '363/543',
  776. C3: '0/0',
  777. C4: i === 0 ? '0/6' : '0/0',
  778. C5_0: '8/8/8',
  779. C5_0_time: '12:02',
  780. C5: '8/8/8',
  781. C5_time: '12:02',
  782. C6: '8/8/8',
  783. C6_time: '12:02',
  784. C7: '8/8/8',
  785. C7_time: '12:02',
  786. C8: '8/363/537/1254KG',
  787. C8_time: '12:02',
  788. C9: '3/363/537',
  789. C9_time: '12:02',
  790. })),
  791. InternationalArrivalAirport: Array.from({ length: 3 }, (_, i) => ({
  792. flightNO: 'ZH3423',
  793. flightDate: '2022/09/10',
  794. planLandingTime: '22/09/10 12:01',
  795. landingAirport: 'NKG-PEK-',
  796. landingStand: '84',
  797. C1: '锂2/冷1',
  798. C2: '363/543',
  799. C3: '0/0',
  800. C4: i === 0 ? '0/6' : '0/0',
  801. C5: '8/8/8',
  802. C6: '8/8/8',
  803. C6_time: '12:02',
  804. C7: '8/8/8',
  805. C7_time: '12:02',
  806. C8: '8/8/8',
  807. C8_time: '12:02',
  808. C9: '8/363/537/1254KG',
  809. C9_time: '12:02',
  810. C10: '8/536',
  811. C10_time: '12:02',
  812. C11: '1/8/536',
  813. C11_time: '12:02',
  814. C12: '8/536',
  815. C12_time: '12:02',
  816. })),
  817. }
  818. const headerClassMap = ['bg-yellow', 'bg-green', 'bg-cyan']
  819. const computedWidth = (column: SimpleColumn) => {
  820. let width = 0
  821. column.columnLabel.split('\n').forEach(line => {
  822. const len = line.length
  823. let realLength = 0
  824. for (let i = 0; i < len; i++) {
  825. realLength += line.charCodeAt(i) > 255 ? 2 : 1
  826. }
  827. if (width < realLength * 8) {
  828. width = realLength * 8
  829. }
  830. })
  831. if (column.needFilters || column.needSort) {
  832. width += 8
  833. }
  834. // border
  835. return width + 1
  836. }
  837. export function useAirportTable(name: string, formData: CommonData) {
  838. const tableColumns = ref<CommonTableColumn[]>([])
  839. const tableData = ref<CommonData[]>([])
  840. const getTableColumns = () => {
  841. const groups = columnGroupsMap[name]
  842. tableColumns.value = groups.reduce(
  843. (columns: CommonTableColumn[], group, groupIndex) => {
  844. group.children.forEach(column => {
  845. columns.push({
  846. key: column.columnName,
  847. dataKey: column.columnName,
  848. title: column.columnLabel,
  849. columnDescribe: '',
  850. dataType: '',
  851. listqueryTemplateID: null,
  852. needCount: null,
  853. needFilters: null,
  854. needGroup: null,
  855. needSearch: null,
  856. needShow: 1,
  857. needSort: null,
  858. orderNumber: null,
  859. queryTemplateColumnSetID: null,
  860. queryTemplateID: null,
  861. width: computedWidth(column),
  862. flexGrow: 1,
  863. align: 'center',
  864. headerClass: headerClassMap[groupIndex],
  865. groupName: group.groupName,
  866. ...column,
  867. })
  868. })
  869. return columns
  870. },
  871. []
  872. )
  873. }
  874. const getTableData = async () => {
  875. try {
  876. const {
  877. startDate,
  878. endDate,
  879. flightStatus,
  880. flightWarning,
  881. waybillType,
  882. } = formData
  883. const dataContent = [
  884. startDate + ':00',
  885. endDate + ':59',
  886. // flightStatus,
  887. // flightWarning
  888. ]
  889. // if (name.includes('International')) {
  890. // dataContent.push(waybillType)
  891. // }
  892. const {
  893. code,
  894. returnData: { columnSet, listValues },
  895. message,
  896. } = await Query<CommonData>({
  897. id: DATACONTENT_ID[name.slice(0, 1).toLowerCase() + name.slice(1)],
  898. dataContent,
  899. })
  900. if (Number(code) !== 0) {
  901. throw new Error(message || '失败')
  902. }
  903. // tableColumns.value = columnSet.map(column => ({
  904. // key: column.columnName,
  905. // dataKey: column.columnName,
  906. // title: column.columnLabel,
  907. // width: column.columnLabel.length * 50,
  908. // flexGrow: 1,
  909. // align: 'center',
  910. // ...column,
  911. // }))
  912. tableData.value = listValues
  913. } catch (error) {
  914. console.error(error)
  915. }
  916. }
  917. const getSimulateTableData = () => {
  918. tableData.value = simulateTableDataMap[name]
  919. }
  920. let queryLoop: number | null = null
  921. const startQuery = async () => {
  922. await getTableData()
  923. queryLoop = window.setTimeout(
  924. startQuery,
  925. LOOP_INTERVAL[name.slice(0, 1).toLowerCase() + name.slice(1)]
  926. )
  927. }
  928. const stopQuery = () => {
  929. if (queryLoop) {
  930. clearTimeout(queryLoop)
  931. queryLoop = null
  932. }
  933. }
  934. watch(formData, data => {
  935. stopQuery()
  936. if (data.startDate && data.endDate) {
  937. startQuery()
  938. }
  939. })
  940. onUnmounted(stopQuery)
  941. onMounted(() => {
  942. getTableColumns()
  943. // getSimulateTableData()
  944. })
  945. return {
  946. tableColumns,
  947. tableData,
  948. }
  949. }