baggageView.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <div v-loading="loading" element-loading-text="拼命加载中" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)" class="baggageView">
  3. <el-scrollbar style="height: 100%">
  4. <div v-infinite-scroll="load" class="baggageView-content">
  5. <div v-for="(item,index) in tableData" :key="index" class="baggageView-list">
  6. <div class="part2">
  7. <div class="part2_info">
  8. <div class="title">
  9. <div class="fightNo">{{ item.carrierFlights || item.inflightNo }}</div>
  10. <div class="fightDate">{{ item.carrierFlightsDate || item.inflightDate }}</div>
  11. <div class="fightLine">{{ item.outAirport }}{{ item.takeoff_terminal }} -- {{item.landAirport}}{{ item.target_terminal }}</div>
  12. <div class="fightTime">{{ item.takeTime }} -- {{ item.landTime }}</div>
  13. </div>
  14. <div class="baggage-track-chart">
  15. <div class="step-line">
  16. <div v-for="(line, index) in 6" :key="index" :class="['step-line-segment', { 'step-line-active': activeStepLine(index,item.bagStatus) }]"></div>
  17. </div>
  18. <div v-for="(p, index) in item.bagStatus" :key="index" :class="{ 'step-item': true, 'active-item': p.timeValue }">
  19. <div class="step-circle">
  20. <span class="step-name">{{ p.nodeName }}</span>
  21. </div>
  22. <div v-if="p.timeValue || p.stateValue || p.loclValue" class="step-info">
  23. <div :class="statusClasses(p.stateValue)">{{ p.stateValue }}</div>
  24. <span class="step-time">{{ p.timeValue }}</span>
  25. <div class="step-location">{{ p.loclValue }}</div>
  26. </div>
  27. <div v-else class="step-info">无</div>
  28. </div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </el-scrollbar>
  35. </div>
  36. </template>
  37. <script>
  38. import pf from '@/layout/mixin/publicFunc'
  39. export default {
  40. name: 'BaggageView',
  41. mixins: [pf],
  42. props: {
  43. queryObj: {
  44. type: Object,
  45. default: () => { }
  46. },
  47. tagObj: {
  48. type: Object,
  49. default: () => { }
  50. }
  51. },
  52. data () {
  53. return {
  54. stepNodes: [
  55. {
  56. nodeCode: 'CHECKIN',
  57. nodeName: '值机',
  58. timeProp: 'checkInDate',
  59. timeValue: '',
  60. loclProp: 'checkInLocation',
  61. loclValue: '',
  62. stateProp: 'checkState',
  63. stateValue: '',
  64. },
  65. {
  66. nodeCode: 'SECURITY',
  67. nodeName: '安检',
  68. timeProp: 'security_check_time',
  69. timeValue: '',
  70. loclProp: 'security_location',
  71. loclValue: '',
  72. stateProp: 'securityInspectionResults',
  73. stateValue: '',
  74. },
  75. {
  76. nodeCode: 'SORT',
  77. nodeName: '分拣',
  78. timeProp: 'sorting_time',
  79. timeValue: '',
  80. loclProp: 'sorting_location',
  81. loclValue: '',
  82. stateProp: 'sortState',
  83. stateValue: '',
  84. },
  85. {
  86. nodeCode: 'LOAD',
  87. nodeName: '装车',
  88. timeProp: 'loading_time',
  89. timeValue: '',
  90. loclProp: 'installationAddress',
  91. loclValue: '',
  92. stateProp: 'loadState',
  93. stateValue: '',
  94. },
  95. {
  96. nodeCode: 'INFL',
  97. nodeName: '装机',
  98. timeProp: 'installation_time',
  99. timeValue: '',
  100. loclProp: 'installation_location',
  101. loclValue: '',
  102. stateProp: 'normal',
  103. stateValue: '',
  104. },
  105. {
  106. nodeCode: 'UNLOAD',
  107. nodeName: '卸机',
  108. timeProp: 'unloadtime',
  109. timeValue: '',
  110. loclProp: 'unloadLocation',
  111. loclValue: '',
  112. stateProp: 'normal',
  113. stateValue: '',
  114. },
  115. {
  116. nodeCode: 'ARRIVED',
  117. nodeName: '到达',
  118. timeProp: 'arrivedtime',
  119. timeValue: '',
  120. loclProp: 'arrviedLocation',
  121. loclValue: '',
  122. stateProp: 'normal',
  123. stateValue: '',
  124. }
  125. ],
  126. tableData: [],
  127. page: 0,
  128. pageSize: 20,
  129. dataContent: {},
  130. loading: false,
  131. noMore: false
  132. }
  133. },
  134. computed: {
  135. activeStepLine () {
  136. return function (index, arrs) {
  137. return (arrs[index].stateValue || arrs[index].loclValue || arrs[index].timeValue) && (arrs[index + 1].stateValue || arrs[index + 1].loclValue || arrs[index + 1].timeValue)
  138. }
  139. },
  140. statusClasses () {
  141. return function (status) {
  142. const classes = ['step-status']
  143. if (typeof status === 'string') {
  144. if (status.includes('正常') || status.includes('通过')) {
  145. classes.push('step-status-normal')
  146. } else {
  147. classes.push('step-status-abnormal')
  148. }
  149. }
  150. return classes
  151. }
  152. },
  153. },
  154. watch: {
  155. tagObj: {
  156. handler (obj) {
  157. this.dataContent = obj
  158. this.restTable()
  159. this.load()
  160. },
  161. deep: true
  162. },
  163. queryObj: {
  164. handler (obj) {
  165. this.dataContent = obj
  166. this.restTable()
  167. this.load()
  168. },
  169. deep: true
  170. },
  171. },
  172. created () {
  173. this.dataContent = this.queryObj
  174. },
  175. methods: {
  176. //获取行李信息
  177. async getLuggageList (id, dataContent = this.dataContent, page, pageSize) {
  178. try {
  179. this.loading = true
  180. const { code, returnData } = await this.getQueryList(id, dataContent, page, pageSize)
  181. if (code == 0) {
  182. if (returnData.length === 0) {
  183. this.page--;
  184. this.noMore = true;
  185. this.loading = false;
  186. }
  187. returnData.forEach(item => {
  188. item.bagStatus = _.cloneDeep(this.stepNodes)
  189. })
  190. this.tableData.push(...returnData);
  191. this.tableData = _.uniqBy(this.tableData, 'carrierFlights')
  192. this.tableData = this.tableData.sort((a, b) => Date.parse(a.carrierFlightsDate) - Date.parse(b.carrierFlightsDate))
  193. this.tableData.forEach(item => {
  194. item.bagStatus.map(p => {
  195. const { timeProp, loclProp, stateProp } = p
  196. if (item.hasOwnProperty(timeProp) || item.hasOwnProperty(loclProp) || item.hasOwnProperty(stateProp)) {
  197. p.timeValue = item[timeProp]
  198. p.loclValue = item[loclProp]
  199. p.stateValue = item[stateProp]
  200. }
  201. })
  202. })
  203. this.getBagTime(this.tableData)
  204. this.loading = false;
  205. } else {
  206. this.page--;
  207. this.loading = false;
  208. this.$message.error("获取表格数据失败");
  209. }
  210. } catch (error) {
  211. this.loading = false;
  212. console.log(error)
  213. }
  214. },
  215. restTable () {
  216. this.loading = false
  217. this.noMore = false
  218. this.page = 0
  219. this.tableData = []
  220. },
  221. load () {
  222. if (Object.keys(this.queryObj).length || Object.keys(this.tagObj).length) {
  223. if (this.noMore || this.loading) {
  224. return;
  225. }
  226. this.getLuggageList(SERVICE_ID.bagTableId, this.dataContent, ++this.page, this.pageSize);
  227. }
  228. },
  229. getBagTime (arr) {
  230. arr.forEach(async item => {
  231. const { carrierFlights, carrierFlightsDate, outAirport, landAirport } = item
  232. const { code, returnData } = await this.getQueryList(SERVICE_ID.baggageTime, {
  233. carrierFlights,
  234. carrierFlightsDate,
  235. outAirport,
  236. landAirport
  237. })
  238. if (code == 0 && returnData && returnData.length) {
  239. const newArray = [...returnData]
  240. const itemObj = newArray[0]
  241. const { actualTakeOffTime, estimateTakeOffTime, scheduleTakeOffTime, actualLandInTime, estimateLandInTime, scheduleLandInTime } = itemObj
  242. item.newTakeoff_time = actualTakeOffTime ? actualTakeOffTime : estimateTakeOffTime ? estimateTakeOffTime : scheduleTakeOffTime
  243. item.newLand_time = actualLandInTime ? actualLandInTime : estimateLandInTime ? estimateLandInTime : scheduleLandInTime
  244. item.takeTime = item.newTakeoff_time.split('T').at(-1)
  245. item.landTime = item.newLand_time.split('T').at(-1)
  246. }
  247. })
  248. }
  249. }
  250. }
  251. </script>
  252. <style lang="scss" scoped>
  253. .baggageView {
  254. height: 100%;
  255. &-list {
  256. height: 183px;
  257. border-bottom: 1px solid #dfe3ea;
  258. padding: 30px 32px 47px 32px;
  259. &:last-child {
  260. border-bottom: none;
  261. }
  262. .part2 {
  263. width: 100%;
  264. background: #ffffff;
  265. display: flex;
  266. flex-direction: row;
  267. justify-content: space-between;
  268. align-items: flex-start;
  269. .part2_info {
  270. flex: 1;
  271. display: flex;
  272. flex-direction: row;
  273. justify-content: flex-start;
  274. align-items: flex-start;
  275. line-height: 42px;
  276. .title {
  277. width: 160px;
  278. margin-right: 30px;
  279. font-size: 14px;
  280. font-family: Helvetica;
  281. font-weight: 400;
  282. color: #101116;
  283. line-height: 1;
  284. .fightNo {
  285. font-size: 24px;
  286. font-family: Helvetica;
  287. font-weight: bold;
  288. margin-bottom: 8px;
  289. }
  290. .fightDate {
  291. margin-bottom: 15px;
  292. }
  293. .fightLine {
  294. margin-bottom: 8px;
  295. }
  296. .fightTime {
  297. margin-top: 13px;
  298. }
  299. }
  300. .type {
  301. font-size: 18px;
  302. font-weight: bold;
  303. margin-right: 20px;
  304. .warn {
  305. color: #df3559;
  306. }
  307. .normal {
  308. color: #519f6b;
  309. }
  310. }
  311. .airline {
  312. width: 120px;
  313. margin-right: 20px;
  314. }
  315. .baggage-track-chart {
  316. flex: 1;
  317. height: 124px;
  318. position: relative;
  319. display: flex;
  320. flex-direction: row;
  321. justify-content: space-between;
  322. width: 100%;
  323. }
  324. .step-line {
  325. width: calc(100% - 80px);
  326. height: 10px;
  327. position: absolute;
  328. top: 16px;
  329. right: 0;
  330. left: 0;
  331. margin: auto;
  332. display: flex;
  333. .step-line-segment {
  334. width: calc(100% / 6);
  335. height: 100%;
  336. background: #afb4bf;
  337. &.step-line-active {
  338. background: #2d67e3;
  339. }
  340. }
  341. }
  342. .step-item {
  343. width: 80px;
  344. height: 100%;
  345. text-align: center;
  346. font-size: 14px;
  347. display: flex;
  348. flex-direction: column;
  349. align-items: center;
  350. justify-content: flex-start;
  351. z-index: 1;
  352. font-family: Helvetica, "Microsoft Yahei";
  353. .step-circle {
  354. width: 42px;
  355. height: 42px;
  356. border-radius: 50%;
  357. background: #aaacb2;
  358. .step-name {
  359. color: #ffffff;
  360. font-size: 14px;
  361. font-weight: bold;
  362. }
  363. }
  364. .step-info {
  365. margin-top: 8px;
  366. color: #101116;
  367. line-height: 22px;
  368. .step-status {
  369. &-normal {
  370. color: #4ab36f;
  371. }
  372. &-abnormal {
  373. color: #e9af4b;
  374. }
  375. }
  376. .step-time {
  377. white-space: pre-line;
  378. font-size: 12px;
  379. line-height: 20px;
  380. }
  381. }
  382. &.active-item .step-circle {
  383. background: #2d67e3;
  384. }
  385. }
  386. }
  387. .btns {
  388. margin-top: 6px;
  389. }
  390. }
  391. }
  392. }
  393. </style>