useAirportTable.ts 23 KB

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