|
|
@@ -13,6 +13,7 @@ import MapView from './components/MapView.vue'
|
|
|
import { cloneDeep } from 'lodash'
|
|
|
import { transportationMode } from '@/components/TransportationMode'
|
|
|
import { useRoute } from 'vue-router'
|
|
|
+import { useOverflow } from '@/hooks/useOverflow'
|
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
|
@@ -107,6 +108,10 @@ getData()
|
|
|
const formatTime = (time: string) => {
|
|
|
return time ? dayjs(time).format('MMM-DD-YYYY hh:mm A') : '--'
|
|
|
}
|
|
|
+const originRef = ref()
|
|
|
+const destinationRef = ref()
|
|
|
+const { isOverflow: isOriginOverflow } = useOverflow(originRef, allData)
|
|
|
+const { isOverflow: isDestinationOverflow } = useOverflow(destinationRef, allData)
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
@@ -142,13 +147,15 @@ const formatTime = (time: string) => {
|
|
|
<div class="origin">
|
|
|
<div class="title">Origin</div>
|
|
|
<div class="content">
|
|
|
- <el-tooltip placement="top">
|
|
|
+ <el-tooltip v-if="isOriginOverflow" placement="top">
|
|
|
<template #content>{{ allData?.transportInfo?.origin || '--' }}</template>
|
|
|
- <span class="info single-line-ellipsis">{{
|
|
|
+ <span ref="originRef" class="info single-line-ellipsis">{{
|
|
|
allData?.transportInfo?.origin || '--'
|
|
|
}}</span>
|
|
|
</el-tooltip>
|
|
|
-
|
|
|
+ <span v-else ref="originRef" class="info single-line-ellipsis">{{
|
|
|
+ allData?.transportInfo?.origin || '--'
|
|
|
+ }}</span>
|
|
|
<div class="line_container">
|
|
|
<hr color="#000000" />
|
|
|
<div class="right-icon"></div>
|
|
|
@@ -158,12 +165,15 @@ const formatTime = (time: string) => {
|
|
|
<div class="destination">
|
|
|
<div class="title">Destination</div>
|
|
|
<div class="content">
|
|
|
- <el-tooltip placement="top">
|
|
|
+ <el-tooltip v-if="isDestinationOverflow" placement="top">
|
|
|
<template #content>{{ allData?.transportInfo?.destination || '--' }}</template>
|
|
|
- <span class="info single-line-ellipsis">{{
|
|
|
+ <span ref="destinationRef" class="info single-line-ellipsis">{{
|
|
|
allData?.transportInfo?.destination || '--'
|
|
|
}}</span>
|
|
|
</el-tooltip>
|
|
|
+ <span v-else ref="destinationRef" class="info single-line-ellipsis">{{
|
|
|
+ allData?.transportInfo?.destination || '--'
|
|
|
+ }}</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -324,7 +334,8 @@ const formatTime = (time: string) => {
|
|
|
height: 96px;
|
|
|
margin: 0 8px;
|
|
|
& > .item {
|
|
|
- flex: 1;
|
|
|
+ flex: 1 1 33%;
|
|
|
+ max-width: 40%;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
justify-content: center;
|
|
|
@@ -348,15 +359,12 @@ const formatTime = (time: string) => {
|
|
|
flex-direction: row;
|
|
|
justify-content: flex-start;
|
|
|
gap: 16px;
|
|
|
- max-width: 500px;
|
|
|
.origin {
|
|
|
- width: 60%;
|
|
|
+ flex: 1;
|
|
|
+ width: calc(60% - 16px);
|
|
|
}
|
|
|
.destination {
|
|
|
- width: 40%;
|
|
|
- .info {
|
|
|
- width: calc(100% - 16px);
|
|
|
- }
|
|
|
+ max-width: 40%;
|
|
|
}
|
|
|
.title {
|
|
|
margin-top: 11px;
|
|
|
@@ -447,3 +455,8 @@ const formatTime = (time: string) => {
|
|
|
text-overflow: ellipsis; /* 超出部分显示省略号 */
|
|
|
}
|
|
|
</style>
|
|
|
+<style lang="scss">
|
|
|
+.is-show-tooltip {
|
|
|
+ // display: none;
|
|
|
+}
|
|
|
+</style>
|