index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <div class="flight-view">
  3. <div class="flight-view-top">
  4. <div class="flight-info-wrapper">
  5. <div class="air-line">{{ airLine }}</div>
  6. <div class="flight-info-box-wrapper">
  7. <template v-for="(group, index) in flightInfoItems" :key="index">
  8. <div class="info-box">
  9. <div v-for="(item, i) in group" :key="i">
  10. {{ item.label }}:{{ computedFlightInfo(item) }}
  11. </div>
  12. </div>
  13. <div v-if="index < flightInfoItems.length - 1" class="icon-box">
  14. <el-icon color="#ffffff" :size="22"><CaretRight /></el-icon>
  15. </div>
  16. </template>
  17. </div>
  18. </div>
  19. <div v-if="name.includes('Departure')" class="container-list">
  20. <SimpleTable
  21. :data="containerTableData"
  22. :columns="containerTableColumns"
  23. :row-class-name="flightContainerRowClass"
  24. :cell-class-name="flightContainerCellClass"
  25. @cell-click="flightContainerCellClickHandler"
  26. />
  27. </div>
  28. </div>
  29. <div class="waybill-list-wrapper">
  30. <div class="waybill-list-header">
  31. <CommonSwitch v-model:flag="UTCFlag" label="开启UTC" />
  32. <el-button
  33. class="button-sqaure"
  34. :icon="Refresh"
  35. color="#ac014d"
  36. @click="refreshHandler"
  37. />
  38. <el-button
  39. class="button-sqaure"
  40. :icon="Download"
  41. color="#ac014d"
  42. @click="downloadHandler"
  43. />
  44. <ColumnSet
  45. class="button-sqaure"
  46. :table-columns="waybillTableColumns"
  47. @checked-submit="columnChecked"
  48. />
  49. <Search @search="search" @clear="clear" />
  50. </div>
  51. <div class="waybill-list">
  52. <SimpleTable
  53. ref="waybillTableRef"
  54. :data="waybillTableData"
  55. :columns="filteredWaybillColumns"
  56. :row-class-name="flightWaybillRowClass"
  57. :cell-class-name="flightWaybillCellClass"
  58. @cell-click="flightWaybillCellClickHandler"
  59. />
  60. </div>
  61. </div>
  62. </div>
  63. </template>
  64. <script setup lang="ts">
  65. import Search from '@/components/search/index.vue'
  66. import { CaretRight, Download, Refresh } from '@element-plus/icons-vue'
  67. import SimpleTable from '@/components/SimpleTable/index.vue'
  68. import CommonSwitch from '../../components/CommonSwitch/index.vue'
  69. import ColumnSet from '../../components/ColumnSet/index.vue'
  70. import useTable from '../../hooks/useTable'
  71. import useTableColumnSet from '../../hooks/useTableColumnSet'
  72. import useTableExport from '../../hooks/useTableExport'
  73. import useTableStyle from '../../hooks/useTableStyle'
  74. import useTableCellClick from '../../hooks/useTableCellClick'
  75. import { ElMessage } from 'element-plus'
  76. import useFlightInfo from './useFlightInfo'
  77. const props = defineProps({
  78. name: {
  79. type: String,
  80. required: true,
  81. },
  82. })
  83. const route = useRoute()
  84. const {
  85. flightNO,
  86. flightDate,
  87. // departureAirport,
  88. // landingAirport
  89. } = route.query
  90. // if (!flightNO || !flightDate) {
  91. // router.push('/')
  92. // }
  93. const dataContent = [
  94. flightDate,
  95. flightNO,
  96. // departureAirport,
  97. // landingAirport,
  98. ] as string[]
  99. const { flightInfoItems, flightInfo, computedFlightInfo } = useFlightInfo(
  100. props.name,
  101. dataContent
  102. )
  103. const airLine = toRef(flightInfo, 'flightinfo')
  104. const {
  105. tableColumns: containerTableColumns,
  106. tableData: containerTableData,
  107. } = useTable(`${props.name}Container`, dataContent)
  108. const {
  109. tableColumns: waybillTableColumns,
  110. tableData: waybillTableData,
  111. } = useTable(`${props.name}Waybill`, dataContent)
  112. const UTCFlag = ref(true)
  113. const refreshHandler = () => {
  114. ElMessage.info('开发中')
  115. }
  116. const {
  117. filteredColumns: filteredWaybillColumns,
  118. columnChecked,
  119. } = useTableColumnSet(waybillTableColumns)
  120. const waybillTableRef = ref<InstanceType<typeof SimpleTable> | null>(null)
  121. const { exportToExcel } = useTableExport()
  122. //点击下载按钮
  123. const downloadHandler = () => {
  124. const table = waybillTableRef.value!.table!
  125. exportToExcel({ table })
  126. }
  127. //清空搜索
  128. const clear = () => {}
  129. //点击搜索按钮
  130. const search = (text: string) => {
  131. console.log(text)
  132. }
  133. const {
  134. rowClass: flightContainerRowClass,
  135. cellClass: flightContainerCellClass,
  136. } = useTableStyle(`${props.name}Container`)
  137. const {
  138. rowClass: flightWaybillRowClass,
  139. cellClass: flightWaybillCellClass,
  140. } = useTableStyle(`${props.name}Waybill`)
  141. const { cellClickHandler: flightContainerCellClickHandler } = useTableCellClick(
  142. `${props.name}Container`
  143. )
  144. const { cellClickHandler: flightWaybillCellClickHandler } = useTableCellClick(
  145. `${props.name}Waybill`
  146. )
  147. </script>
  148. <style lang="scss" scoped>
  149. .flight-view {
  150. width: 100%;
  151. height: 100%;
  152. display: flex;
  153. flex-direction: column;
  154. .flight-view-top {
  155. width: 100%;
  156. height: 345px;
  157. display: flex;
  158. .flight-info-wrapper {
  159. flex: 1 1 1040px;
  160. height: 100%;
  161. background: #410425;
  162. box-sizing: border-box;
  163. padding: 18px 32px;
  164. overflow: hidden;
  165. display: flex;
  166. flex-direction: column;
  167. .air-line {
  168. font-size: 18px;
  169. font-weight: bold;
  170. color: #ffffff;
  171. width: 100%;
  172. margin-bottom: 16px;
  173. }
  174. .flight-info-box-wrapper {
  175. width: 100%;
  176. max-width: 976px;
  177. flex: 1;
  178. display: flex;
  179. justify-content: flex-start;
  180. justify-items: center;
  181. .info-box {
  182. width: calc(33.3% - 10px);
  183. background: #561638;
  184. padding: 10px 15px;
  185. box-sizing: border-box;
  186. font-size: 14px;
  187. font-weight: 400;
  188. color: #ffffff;
  189. line-height: 30px;
  190. }
  191. .icon-box {
  192. display: flex;
  193. flex-direction: column;
  194. width: 60px;
  195. justify-content: center;
  196. align-items: center;
  197. }
  198. }
  199. }
  200. .container-list {
  201. flex: 1;
  202. height: 100%;
  203. margin-left: 16px;
  204. .el-table :deep {
  205. .el-table__body .el-table__row {
  206. &.row-warning .el-table__cell {
  207. background-color: #f0c579;
  208. }
  209. }
  210. }
  211. }
  212. }
  213. .waybill-list-wrapper {
  214. height: 0;
  215. flex: 1;
  216. display: flex;
  217. flex-direction: column;
  218. .waybill-list-header :deep {
  219. height: 72px;
  220. display: flex;
  221. justify-content: flex-end;
  222. align-items: center;
  223. .button-sqaure {
  224. margin-left: 24px;
  225. width: 30px;
  226. height: 30px;
  227. border-radius: 4px;
  228. font-size: 16px;
  229. &:last-of-type {
  230. margin-right: 48px;
  231. }
  232. }
  233. }
  234. .waybill-list {
  235. height: 0;
  236. flex: 1;
  237. .el-table :deep {
  238. .el-table__body .el-table__row {
  239. &.row-warning .el-table__cell {
  240. background-color: #f0c579;
  241. }
  242. &.row-alarm .el-table__cell {
  243. background-color: #f38080;
  244. }
  245. }
  246. }
  247. }
  248. }
  249. }
  250. </style>