index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <div class="station-view">
  3. <div class="station-header">
  4. <StationForm :international="international" />
  5. <div class="station-count">
  6. <CountBox
  7. :count-number="tableDataCount.waybillCount"
  8. label="预计装载总运单数"
  9. />
  10. <CountBox
  11. v-show="goodsCountFlag"
  12. :count-number="tableDataCount.goodsCount"
  13. label="预计装载总件数"
  14. />
  15. </div>
  16. <div class="station-settings">
  17. <TableSwitch v-model:flag="goodsCountFlag" label="显示件数" />
  18. <TableSwitch v-model:flag="UTCFlag" label="开启UTC" />
  19. <ColumnSet
  20. :table-columns="tableColumns"
  21. @checked-submit="columnChecked"
  22. />
  23. </div>
  24. </div>
  25. <div class="station-table">
  26. <el-auto-resizer>
  27. <template #default="{ height, width }">
  28. <el-table-v2
  29. :columns="filteredColumns"
  30. :data="tableData"
  31. :width="width"
  32. :height="height"
  33. :footer-height="60"
  34. :row-class="rowClass"
  35. fixed
  36. >
  37. <template #cell="slot: CellSlotProps">
  38. <div :class="cellClass(slot)">
  39. <span class="cell-text">
  40. {{ slot.rowData[slot.column.dataKey] }}
  41. </span>
  42. <div class="cell-background" />
  43. </div>
  44. </template>
  45. <template #footer>
  46. <div class="table-footer">
  47. <span class="table-footer-count"
  48. >航班总数:{{ tableDataCount.flightCount }}</span
  49. >
  50. <span class="table-footer-count"
  51. >货运航班总数:{{ tableDataCount.freightFlightCount }}</span
  52. >
  53. <span class="table-footer-count"
  54. >已装机总数:{{ tableDataCount.loadCount }}</span
  55. >
  56. <span class="table-footer-count"
  57. >已起飞总数:{{ tableDataCount.takeOffCount }}</span
  58. >
  59. </div>
  60. </template>
  61. </el-table-v2>
  62. </template>
  63. </el-auto-resizer>
  64. </div>
  65. </div>
  66. </template>
  67. <script lang="ts" setup>
  68. import { PropType } from 'vue'
  69. import type { CellSlotProps } from '../../hooks/useTableStyle'
  70. import StationForm from '../../components/StationForm/index.vue'
  71. import ColumnSet from '../../components/ColumnSet/index.vue'
  72. import CountBox from '../../components/CountBox/index.vue'
  73. import TableSwitch from '../../components/TableSwitch/index.vue'
  74. import useTableColumnSet from '../../hooks/useTableColumnSet'
  75. import useTableData from '../../hooks/useTableData'
  76. import useTableStyle from '../../hooks/useTableStyle'
  77. type StationViewName =
  78. | 'departure'
  79. | 'arrival'
  80. | 'internationalDeparture'
  81. | 'internationalArrival'
  82. const props = defineProps({
  83. stationViewName: {
  84. type: String as PropType<StationViewName>,
  85. required: true,
  86. },
  87. })
  88. const international = computed(() =>
  89. ['internationalDeparture', 'internationalArrival'].includes(
  90. props.stationViewName
  91. )
  92. )
  93. const goodsCountFlag = ref(true)
  94. const UTCFlag = ref(true)
  95. const { tableColumns, tableData } = useTableData(props.stationViewName)
  96. const { columnChecked, filteredColumns } = useTableColumnSet(tableColumns)
  97. const { rowClass, cellClass } = useTableStyle()
  98. const tableDataCount = reactive({
  99. waybillCount: 0,
  100. goodsCount: 0,
  101. flightCount: 0,
  102. freightFlightCount: 0,
  103. loadCount: 0,
  104. takeOffCount: 0,
  105. })
  106. watch(tableData, records => {
  107. tableDataCount.waybillCount = records.length
  108. tableDataCount.goodsCount = records.length
  109. tableDataCount.flightCount = records.length
  110. tableDataCount.freightFlightCount = records.length
  111. tableDataCount.loadCount = records.length
  112. tableDataCount.takeOffCount = records.length
  113. })
  114. </script>
  115. <style lang="scss" scoped>
  116. @import '../../style/station.scss';
  117. </style>