index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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. <div class="info-box">
  8. <div>起飞机场简称:{{ flightInfo.C0 }}</div>
  9. <div>日期:{{ flightInfo.C1 }}</div>
  10. <div>时间:{{ flightInfo.C2 }}</div>
  11. <div>停机位:{{ flightInfo.C3 }}</div>
  12. </div>
  13. <div class="iconBox">
  14. <el-icon color="#ffffff" :size="22"><CaretRight /></el-icon>
  15. </div>
  16. <div class="info-box">
  17. <div>特货信息/货物数:{{ flightInfo.C4 }}</div>
  18. <div>托运运单数/货物数:{{ flightInfo.C5 }}</div>
  19. <div>中转进运单/货物数:{{ flightInfo.C6 }}</div>
  20. <div>已配载集装器:{{ flightInfo.C7 }}</div>
  21. <div>货站已交接集装器:{{ flightInfo.C7 }}</div>
  22. <div>已装载集装器/运单/货物数:{{ flightInfo.C7 }}</div>
  23. <div>拉下集装器/运单/货物数:{{ flightInfo.C8 }}</div>
  24. <div>集装器数量:{{ flightInfo.C9 }}</div>
  25. </div>
  26. <div class="iconBox">
  27. <el-icon color="#ffffff" :size="22"><CaretRight /></el-icon>
  28. </div>
  29. <div class="info-box">
  30. <div>降落机场简称:{{ flightInfo.C10 }}</div>
  31. <div>日期:{{ flightInfo.C11 }}</div>
  32. <div>时间:{{ flightInfo.C12 }}</div>
  33. </div>
  34. </div>
  35. </div>
  36. <div v-if="isDeparture" class="container-list">
  37. <SimpleTable
  38. :data="containerTableData"
  39. :columns="containerTableColumns"
  40. :row-class-name="flightContainerRowClass"
  41. :cell-class-name="flightContainerCellClass"
  42. @cell-click="flightContainerCellClickHandler"
  43. />
  44. </div>
  45. </div>
  46. <div class="waybill-list-wrapper">
  47. <div class="waybill-list-header">
  48. <CommonSwitch v-model:flag="UTCFlag" label="开启UTC" />
  49. <el-button
  50. class="button-sqaure"
  51. :icon="Refresh"
  52. color="#ac014d"
  53. @click="refreshHandler"
  54. />
  55. <el-button
  56. class="button-sqaure"
  57. :icon="Download"
  58. color="#ac014d"
  59. @click="downloadHandler"
  60. />
  61. <ColumnSet
  62. class="button-sqaure"
  63. :table-columns="waybillTableColumns"
  64. @checked-submit="columnChecked"
  65. />
  66. <Search @search="search" @clear="clear" />
  67. </div>
  68. <div class="waybill-list">
  69. <SimpleTable
  70. ref="waybillTableRef"
  71. :data="waybillTableData"
  72. :columns="filteredWaybillColumns"
  73. :row-class-name="flightWaybillRowClass"
  74. :cell-class-name="flightWaybillCellClass"
  75. @cell-click="flightWaybillCellClickHandler"
  76. />
  77. </div>
  78. </div>
  79. </div>
  80. </template>
  81. <script setup lang="ts">
  82. import Search from '@/components/search/index.vue'
  83. import { CaretRight, Download, Refresh } from '@element-plus/icons-vue'
  84. import SimpleTable from '@/components/SimpleTable/index.vue'
  85. import CommonSwitch from '../../components/CommonSwitch/index.vue'
  86. import ColumnSet from '../../components/ColumnSet/index.vue'
  87. import { CommonData } from '~/common'
  88. import useTable from '../../hooks/useTable'
  89. import useTableColumnSet from '../../hooks/useTableColumnSet'
  90. import useTableExport from '../../hooks/useTableExport'
  91. import useTableStyle from '../../hooks/useTableStyle'
  92. import useTableCellClick from '../../hooks/useTableCellClick'
  93. import { Query } from '@/api/webApi'
  94. import { ElMessage } from 'element-plus'
  95. const props = defineProps({
  96. name: {
  97. type: String,
  98. required: true,
  99. },
  100. })
  101. const route = useRoute()
  102. const { flightNO, flightDate, departureAirport, landingAirport } = route.query
  103. // if (!flightNO || !flightDate) {
  104. // router.push('/')
  105. // }
  106. const dataContent = [
  107. flightNO,
  108. flightDate,
  109. departureAirport,
  110. landingAirport,
  111. ] as string[]
  112. const airLine = ref('SZX - CA4120 - NKG')
  113. const flightInfo = reactive<CommonData>({
  114. C0: '深圳机场',
  115. C1: '2021-12-24',
  116. C2: '19 : 30 : 25',
  117. C3: '012',
  118. C4: '0',
  119. C5: '0',
  120. C6: '0',
  121. C7: '0',
  122. C8: '0',
  123. C9: '0',
  124. C10: '南京机场',
  125. C11: '2021-12-24',
  126. C12: '22 : 25 : 25',
  127. })
  128. const getFlightInfo = async () => {
  129. try {
  130. const {
  131. code,
  132. returnData: { listValues },
  133. message,
  134. } = await Query({
  135. id: DATACONTENT_ID.flightInfo,
  136. dataContent,
  137. })
  138. if (Number(code) !== 0) {
  139. throw new Error(message ?? '失败')
  140. }
  141. if (!listValues.length) {
  142. ElMessage.error('未查询到航班信息')
  143. return
  144. }
  145. Object.assign(flightInfo, listValues[0])
  146. } catch (error) {
  147. console.error(error)
  148. }
  149. }
  150. // onMounted(() => {
  151. // getFlightInfo()
  152. // })
  153. const isDeparture = computed(() =>
  154. ['DepartureFlight', 'InternationalDepartureFlight'].includes(props.name)
  155. )
  156. const {
  157. tableColumns: containerTableColumns,
  158. tableData: containerTableData,
  159. } = useTable('flightContainer', dataContent)
  160. const {
  161. tableColumns: waybillTableColumns,
  162. tableData: waybillTableData,
  163. } = useTable('flightWaybill', dataContent)
  164. const UTCFlag = ref(true)
  165. const refreshHandler = () => {}
  166. const {
  167. filteredColumns: filteredWaybillColumns,
  168. columnChecked,
  169. } = useTableColumnSet(waybillTableColumns)
  170. //点击刷新按钮
  171. const refresh = data => {
  172. console.log(data)
  173. }
  174. const waybillTableRef = ref<InstanceType<typeof SimpleTable> | null>(null)
  175. const { exportToExcel } = useTableExport()
  176. //点击下载按钮
  177. const downloadHandler = () => {
  178. const table = waybillTableRef.value!.table!
  179. exportToExcel({ table })
  180. }
  181. //清空搜索
  182. const clear = () => {}
  183. //点击搜索按钮
  184. const search = (text: string) => {
  185. console.log(text)
  186. }
  187. const {
  188. rowClass: flightContainerRowClass,
  189. cellClass: flightContainerCellClass,
  190. } = useTableStyle('flightContainer')
  191. const {
  192. rowClass: flightWaybillRowClass,
  193. cellClass: flightWaybillCellClass,
  194. } = useTableStyle('flightWaybill')
  195. const { cellClickHandler: flightContainerCellClickHandler } = useTableCellClick(
  196. 'flightContainer'
  197. )
  198. const { cellClickHandler: flightWaybillCellClickHandler } = useTableCellClick(
  199. 'flightWaybill'
  200. )
  201. </script>
  202. <style lang="scss" scoped>
  203. .flight-view {
  204. width: 100%;
  205. height: 100%;
  206. display: flex;
  207. flex-direction: column;
  208. .flight-view-top {
  209. width: 100%;
  210. height: 345px;
  211. display: flex;
  212. .flight-info-wrapper {
  213. flex: 0 1 1040px;
  214. height: 100%;
  215. background: #410425;
  216. box-sizing: border-box;
  217. padding: 18px 32px;
  218. overflow: hidden;
  219. .air-line {
  220. font-size: 18px;
  221. font-weight: bold;
  222. color: #ffffff;
  223. width: 100%;
  224. margin-bottom: 16px;
  225. }
  226. .flight-info-box-wrapper {
  227. width: 100%;
  228. max-width: 976px;
  229. display: flex;
  230. justify-content: flex-start;
  231. justify-items: center;
  232. .info-box {
  233. width: calc(33.3% - 10px);
  234. background: #561638;
  235. padding: 10px 15px;
  236. box-sizing: border-box;
  237. font-size: 14px;
  238. font-weight: 400;
  239. color: #ffffff;
  240. line-height: 30px;
  241. }
  242. .iconBox {
  243. display: flex;
  244. flex-direction: column;
  245. width: 60px;
  246. justify-content: center;
  247. align-items: center;
  248. }
  249. }
  250. }
  251. .container-list {
  252. flex: 1;
  253. height: 100%;
  254. margin-left: 16px;
  255. .el-table :deep {
  256. .el-table__body .el-table__row {
  257. &.row-warning .el-table__cell {
  258. background-color: #f0c579;
  259. }
  260. }
  261. }
  262. }
  263. }
  264. .waybill-list-wrapper {
  265. height: 0;
  266. flex: 1;
  267. display: flex;
  268. flex-direction: column;
  269. .waybill-list-header :deep {
  270. height: 72px;
  271. display: flex;
  272. justify-content: flex-end;
  273. align-items: center;
  274. .button-sqaure {
  275. margin-left: 24px;
  276. width: 30px;
  277. height: 30px;
  278. border-radius: 4px;
  279. font-size: 16px;
  280. &:last-of-type {
  281. margin-right: 48px;
  282. }
  283. }
  284. }
  285. .waybill-list {
  286. height: 0;
  287. flex: 1;
  288. .el-table :deep {
  289. .el-table__body .el-table__row {
  290. &.row-warning .el-table__cell {
  291. background-color: #f0c579;
  292. }
  293. &.row-alarm .el-table__cell {
  294. background-color: #f38080;
  295. }
  296. }
  297. }
  298. }
  299. }
  300. }
  301. </style>