index.vue 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  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" class="info-item">
  10. <div>{{ item.label }}:</div>
  11. <el-tooltip
  12. :disabled="
  13. !computedFlightInfo(item) || !item.showOverflowTooltip
  14. "
  15. :content="computedFlightInfo(item)"
  16. effect="light"
  17. >
  18. <div>{{ computedFlightInfo(item) }}</div>
  19. </el-tooltip>
  20. </div>
  21. </div>
  22. <div v-if="index < flightInfoItems.length - 1" class="icon-box">
  23. <el-icon color="#ffffff" :size="22"><CaretRight /></el-icon>
  24. </div>
  25. </template>
  26. </div>
  27. </div>
  28. <div v-if="name.includes('Departure')" class="container-list">
  29. <SimpleTable
  30. :data="containerTableData"
  31. :columns="containerTableColumns"
  32. scrollbar-always-on
  33. :row-class-name="flightContainerRowClass"
  34. :cell-class-name="flightContainerCellClass"
  35. :column-props="{ formatter: tableFormatter }"
  36. sequence
  37. @cell-click="flightContainerCellClickHandler"
  38. />
  39. </div>
  40. </div>
  41. <div class="waybill-list-wrapper">
  42. <div class="waybill-list-header">
  43. <!-- <CommonSwitch v-model:flag="UTCFlag" label="开启UTC" /> -->
  44. <!-- <el-button
  45. class="button-sqaure"
  46. :icon="Refresh"
  47. color="#ac014d"
  48. @click="refreshHandler"
  49. /> -->
  50. <el-button
  51. class="button-sqaure"
  52. :icon="Download"
  53. color="#ac014d"
  54. @click="downloadHandler"
  55. />
  56. <ColumnSet
  57. class="button-sqaure"
  58. :table-columns="waybillTableColumns"
  59. @checked-submit="columnChecked"
  60. />
  61. <Search @search="search" @clear="clear" />
  62. </div>
  63. <div class="waybill-list">
  64. <SimpleTable
  65. ref="waybillTableRef"
  66. :data="waybillTableData"
  67. :columns="waybillTableColumns"
  68. :row-class-name="flightWaybillRowClass"
  69. :cell-class-name="flightWaybillCellClass"
  70. :column-props="{ formatter: tableFormatter }"
  71. @cell-click="flightWaybillCellClickHandler"
  72. />
  73. </div>
  74. </div>
  75. <ContainerWaybillDialog
  76. v-model:flag="dialogFlag"
  77. :name="name"
  78. :data-content="containerWaybillDataContent"
  79. />
  80. </div>
  81. </template>
  82. <script setup lang="ts">
  83. import Search from '@/components/search/index.vue'
  84. import { CaretRight, Download, Refresh } from '@element-plus/icons-vue'
  85. import ContainerWaybillDialog from './ContainerWaybillDialog.vue'
  86. import SimpleTable from '@/components/SimpleTable/index.vue'
  87. import CommonSwitch from '../../components/CommonSwitch/index.vue'
  88. import ColumnSet from '@/components/ColumnSet/index.vue'
  89. import { useTable } from '../../hooks/useTable'
  90. import { useTableColumnSet } from '@/hooks/useTableColumnSet'
  91. import { useTableExport } from '../../hooks/useTableExport'
  92. import { useTableStyle } from '../../hooks/useTableStyle'
  93. import { useTableCellClick } from '../../hooks/useTableCellClick'
  94. import { useFlightInfo } from './useFlightInfo'
  95. import { useLoop } from '@/hooks/useLoop'
  96. import { CommonTableFormatter, CommonValue } from '~/common'
  97. import { datetimeToTime } from '@/utils/validate'
  98. const props = defineProps({
  99. name: {
  100. type: String,
  101. required: true,
  102. },
  103. })
  104. const route = useRoute()
  105. const {
  106. flightNO,
  107. flightDate,
  108. // departureAirport,
  109. // landingAirport
  110. } = route.query
  111. // if (!flightNO || !flightDate) {
  112. // router.push('/')
  113. // }
  114. const dataContent = [
  115. flightDate,
  116. flightNO,
  117. // departureAirport,
  118. // landingAirport,
  119. ] as string[]
  120. const {
  121. flightInfoItems,
  122. flightInfo,
  123. computedFlightInfo,
  124. getFlightInfo,
  125. } = useFlightInfo(props.name, dataContent)
  126. const airLine = toRef(flightInfo, 'flightinfo')
  127. const {
  128. tableColumns: containerTableColumns,
  129. tableData: containerTableData,
  130. getTableData: getContainerTableData,
  131. } = useTable(`${props.name}Container`, Array(3).fill(dataContent).flat())
  132. const {
  133. tableColumns: waybillTableColumns,
  134. tableData: waybillTableData,
  135. getTableData: getWaybillTableData,
  136. } = useTable(`${props.name}Waybill`, dataContent)
  137. const tableFormatter: CommonTableFormatter = (
  138. row,
  139. column,
  140. cellValue,
  141. index
  142. ) => {
  143. if (column.property === 'execResult') {
  144. const execResult = Number(cellValue)
  145. if (Number.isNaN(execResult)) {
  146. return cellValue
  147. }
  148. return execResult ? '通过' : '未通过'
  149. }
  150. const value = String(cellValue ?? '').trim()
  151. if (
  152. column.property.includes('Time') ||
  153. [
  154. 'tally',
  155. 'pull',
  156. 'wait',
  157. 'stowage',
  158. 'depot',
  159. 'resure',
  160. 'planeDown',
  161. 'loadPlane',
  162. 'pullSure',
  163. ].includes(column.property)
  164. ) {
  165. return datetimeToTime(value, flightDate as CommonValue)
  166. }
  167. if (column.property === 'nodeCode') {
  168. if (props.name.includes('InternationalDeparture') && value === 'LS_CARGO') {
  169. return '实配'
  170. }
  171. return NODE_CODE[value] ?? value
  172. }
  173. return value
  174. }
  175. useLoop([getFlightInfo, getContainerTableData, getWaybillTableData], 'flight')
  176. const UTCFlag = ref(true)
  177. // const refreshHandler = () => {
  178. // ElMessage.info('开发中')
  179. // }
  180. const { columnChecked } = useTableColumnSet(waybillTableColumns)
  181. const waybillTableRef = ref<InstanceType<typeof SimpleTable> | null>(null)
  182. const { exportToExcel } = useTableExport()
  183. //点击下载按钮
  184. const downloadHandler = () => {
  185. const table = waybillTableRef.value!.table!
  186. exportToExcel({ table })
  187. }
  188. //清空搜索
  189. const clear = () => {}
  190. //点击搜索按钮
  191. const search = (text: string) => {
  192. console.log(text)
  193. }
  194. const {
  195. rowClass: flightContainerRowClass,
  196. cellClass: flightContainerCellClass,
  197. } = useTableStyle(`${props.name}Container`)
  198. const {
  199. rowClass: flightWaybillRowClass,
  200. cellClass: flightWaybillCellClass,
  201. } = useTableStyle(`${props.name}Waybill`)
  202. const {
  203. cellClickHandler: flightContainerCellClickHandler,
  204. dialogFlag,
  205. containerNO,
  206. } = useTableCellClick(`${props.name}Container`)
  207. const containerWaybillDataContent = computed(
  208. () => [flightDate, flightNO, unref(containerNO)] as string[]
  209. )
  210. const { cellClickHandler: flightWaybillCellClickHandler } = useTableCellClick(
  211. `${props.name}Waybill`
  212. )
  213. </script>
  214. <style lang="scss" scoped>
  215. .flight-view {
  216. width: 100%;
  217. height: 100%;
  218. display: flex;
  219. flex-direction: column;
  220. .flight-view-top {
  221. width: 100%;
  222. height: 345px;
  223. display: flex;
  224. .flight-info-wrapper {
  225. min-width: 1040px;
  226. flex: 1;
  227. height: 100%;
  228. background: #410425;
  229. box-sizing: border-box;
  230. padding: 18px 32px;
  231. overflow: hidden;
  232. display: flex;
  233. flex-direction: column;
  234. .air-line {
  235. font-size: 18px;
  236. font-weight: bold;
  237. color: #ffffff;
  238. width: 100%;
  239. margin-bottom: 16px;
  240. }
  241. .flight-info-box-wrapper {
  242. width: 100%;
  243. max-width: 976px;
  244. flex: 1;
  245. display: flex;
  246. justify-content: flex-start;
  247. justify-items: center;
  248. .info-box {
  249. width: calc(33.3% - 10px);
  250. background: #561638;
  251. padding: 10px 15px;
  252. .info-item {
  253. width: 100%;
  254. height: 30px;
  255. line-height: 30px;
  256. font-size: 14px;
  257. font-weight: 400;
  258. color: #ffffff;
  259. display: flex;
  260. .el-tooltip__trigger {
  261. flex: 1;
  262. overflow: hidden;
  263. white-space: nowrap;
  264. text-overflow: ellipsis;
  265. }
  266. }
  267. }
  268. .icon-box {
  269. display: flex;
  270. flex-direction: column;
  271. width: 60px;
  272. justify-content: center;
  273. align-items: center;
  274. }
  275. }
  276. }
  277. .container-list {
  278. width: 0;
  279. flex: 1;
  280. height: 100%;
  281. margin-left: 16px;
  282. .el-table :deep {
  283. .el-table__body .el-table__row {
  284. &.row-warning .el-table__cell {
  285. background-color: #f0c579;
  286. }
  287. }
  288. }
  289. }
  290. }
  291. .waybill-list-wrapper {
  292. height: 0;
  293. flex: 1;
  294. display: flex;
  295. flex-direction: column;
  296. .waybill-list-header :deep {
  297. height: 72px;
  298. display: flex;
  299. justify-content: flex-end;
  300. align-items: center;
  301. .button-sqaure {
  302. margin-left: 24px;
  303. width: 30px;
  304. height: 30px;
  305. border-radius: 4px;
  306. font-size: 16px;
  307. &:last-of-type {
  308. margin-right: 48px;
  309. }
  310. }
  311. }
  312. .waybill-list {
  313. height: 0;
  314. flex: 1;
  315. .el-table :deep {
  316. .el-table__body .el-table__row {
  317. &.row-warning .el-table__cell {
  318. background-color: #f0c579;
  319. }
  320. &.row-alarm .el-table__cell {
  321. background-color: #f38080;
  322. }
  323. }
  324. }
  325. }
  326. }
  327. }
  328. </style>