index.vue 9.4 KB

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