|
|
@@ -1,5 +1,7 @@
|
|
|
<script setup lang="ts">
|
|
|
import dayjs from 'dayjs'
|
|
|
+import { transportationMode } from '@/components/TransportationMode'
|
|
|
+
|
|
|
const props = defineProps({
|
|
|
data: Object
|
|
|
})
|
|
|
@@ -20,7 +22,7 @@ const routes: any = ref([
|
|
|
{
|
|
|
serialNumber: 'Leg 2',
|
|
|
mode: 'Sea',
|
|
|
- origin: 'Valenciaenz',
|
|
|
+ origin: 'ValeShenzhenShweShenzhenShweShenzhenShweShenzhenShwenciaenz',
|
|
|
destination: 'ShenzhenShweShenzhenShweShenzhenShweShenzhenShwe',
|
|
|
etd: 'Jun-15-2024 12:00 AM',
|
|
|
atd: 'Jun-17-2024 12:00 AM',
|
|
|
@@ -50,48 +52,23 @@ watch(
|
|
|
const formatDate = (date: string) => {
|
|
|
return date ? dayjs(date).format('MMM-DD-YYYY HH:mm A') : '--'
|
|
|
}
|
|
|
-
|
|
|
-const basicDesWidth = ref('180px')
|
|
|
-const detailDesWidth = ref('220px')
|
|
|
-
|
|
|
-const getContainerWidth = () => {
|
|
|
- let screenWidth = document.body.clientWidth
|
|
|
- if (screenWidth < 1300) {
|
|
|
- basicDesWidth.value = '180px'
|
|
|
- detailDesWidth.value = '220px'
|
|
|
- } else if (screenWidth < 1500) {
|
|
|
- basicDesWidth.value = '220px'
|
|
|
- detailDesWidth.value = '240px'
|
|
|
- } else {
|
|
|
- basicDesWidth.value = '240px'
|
|
|
- detailDesWidth.value = '260px'
|
|
|
- }
|
|
|
-}
|
|
|
-onMounted(() => {
|
|
|
- getContainerWidth()
|
|
|
- window.addEventListener('resize', getContainerWidth)
|
|
|
-})
|
|
|
-onBeforeUnmount(() => {
|
|
|
- window.removeEventListener('resize', getContainerWidth)
|
|
|
-})
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
- <div
|
|
|
- class="routes-view"
|
|
|
- :style="{
|
|
|
- '--basic-destination-width': basicDesWidth,
|
|
|
- '--detail-destination-width': detailDesWidth
|
|
|
- }"
|
|
|
- >
|
|
|
+ <div class="routes-view">
|
|
|
<div class="title">Total number of legs: {{ routes.length }}</div>
|
|
|
<div class="routes">
|
|
|
- <div class="route-item" v-for="(item, index) in routes" :key="item.serialNumber">
|
|
|
+ <div
|
|
|
+ class="route-item"
|
|
|
+ @click="item.isCollapse = !item.isCollapse"
|
|
|
+ v-for="(item, index) in routes"
|
|
|
+ :key="item.serialNumber"
|
|
|
+ >
|
|
|
<div class="basic-info">
|
|
|
<div class="serial-number border-right">Leg {{ index + 1 }}</div>
|
|
|
<div class="mode border-right">
|
|
|
- <span class="font_family icon-icon_ocean_b"></span>
|
|
|
- {{ item.mode }}
|
|
|
+ <span class="font_family" :class="[`icon-${transportationMode?.[item.mode]}`]"></span>
|
|
|
+ {{ item.mode_label }}
|
|
|
</div>
|
|
|
<div class="place border-right">
|
|
|
<div class="origin">
|
|
|
@@ -112,7 +89,7 @@ onBeforeUnmount(() => {
|
|
|
<div class="title">Destination</div>
|
|
|
<el-tooltip placement="top">
|
|
|
<template #content>{{ item.destination || '--' }}</template>
|
|
|
- <div class="content single-line-ellipsis">{{ item.destination || '--' }}</div>
|
|
|
+ <span class="content single-line-ellipsis">{{ item.destination || '--' }}</span>
|
|
|
</el-tooltip>
|
|
|
</div>
|
|
|
</div>
|
|
|
@@ -124,7 +101,6 @@ onBeforeUnmount(() => {
|
|
|
<div class="title">ETA</div>
|
|
|
<div class="content">{{ formatDate(item.eta) }}</div>
|
|
|
<span
|
|
|
- @click="item.isCollapse = !item.isCollapse"
|
|
|
:class="{ collapse: item.isCollapse }"
|
|
|
class="font_family icon-icon_dropdown_b"
|
|
|
></span>
|
|
|
@@ -138,7 +114,9 @@ onBeforeUnmount(() => {
|
|
|
|
|
|
<el-tooltip placement="top">
|
|
|
<template #content>{{ item.origin || '--' }}</template>
|
|
|
- <span class="label single-line-ellipsis">{{ item.origin || '--' }}</span>
|
|
|
+ <span class="label origin-label single-line-ellipsis">{{
|
|
|
+ item.origin || '--'
|
|
|
+ }}</span>
|
|
|
</el-tooltip>
|
|
|
<div class="line_container">
|
|
|
<hr color="#000000" />
|
|
|
@@ -215,7 +193,13 @@ onBeforeUnmount(() => {
|
|
|
.basic-info {
|
|
|
display: flex;
|
|
|
height: 80px;
|
|
|
-
|
|
|
+ cursor: pointer;
|
|
|
+ &:hover {
|
|
|
+ background-color: #fef8f3;
|
|
|
+ .serial-number {
|
|
|
+ background-color: #f6f2ee;
|
|
|
+ }
|
|
|
+ }
|
|
|
.serial-number {
|
|
|
width: 80px;
|
|
|
background: var(--color-header-bg);
|
|
|
@@ -237,10 +221,12 @@ onBeforeUnmount(() => {
|
|
|
font-size: 40px;
|
|
|
}
|
|
|
}
|
|
|
+ .origin {
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
|
|
|
.destination {
|
|
|
- flex: 1;
|
|
|
- max-width: calc(var(--basic-destination-width) - 16px);
|
|
|
+ max-width: calc(40% - 16px);
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
justify-content: space-between;
|
|
|
@@ -248,10 +234,11 @@ onBeforeUnmount(() => {
|
|
|
& > div.content {
|
|
|
display: inline-block;
|
|
|
width: 100%;
|
|
|
+ overflow: hidden;
|
|
|
}
|
|
|
}
|
|
|
.place {
|
|
|
- flex: 0 0 40%;
|
|
|
+ flex: 1;
|
|
|
display: flex;
|
|
|
align-items: center;
|
|
|
padding: 0 16px;
|
|
|
@@ -261,7 +248,7 @@ onBeforeUnmount(() => {
|
|
|
margin-top: 2px;
|
|
|
}
|
|
|
.origin {
|
|
|
- width: calc(100% - var(--basic-destination-width));
|
|
|
+ width: 60%;
|
|
|
}
|
|
|
|
|
|
.content {
|
|
|
@@ -278,9 +265,7 @@ onBeforeUnmount(() => {
|
|
|
}
|
|
|
|
|
|
div.eta {
|
|
|
- flex-basis: 80px;
|
|
|
position: relative;
|
|
|
-
|
|
|
& > .font_family {
|
|
|
position: absolute;
|
|
|
right: 20px;
|
|
|
@@ -331,6 +316,7 @@ onBeforeUnmount(() => {
|
|
|
border-top: 1px solid var(--color-border);
|
|
|
.line_container {
|
|
|
flex: 1;
|
|
|
+ margin-left: 8px;
|
|
|
}
|
|
|
.line_container hr {
|
|
|
border-color: #484c52;
|
|
|
@@ -339,40 +325,44 @@ onBeforeUnmount(() => {
|
|
|
|
|
|
.line_container .right-icon {
|
|
|
border-top: 1px solid #484c52;
|
|
|
-
|
|
|
border-radius: 0 1px 1px 0;
|
|
|
- top: -4px;
|
|
|
+ top: -2px;
|
|
|
right: 0px;
|
|
|
width: 10px;
|
|
|
height: 12px;
|
|
|
}
|
|
|
.date-info {
|
|
|
+ flex: 1;
|
|
|
+ max-width: calc(100% - (100% - 165px) / 3);
|
|
|
display: flex;
|
|
|
justify-content: space-between;
|
|
|
gap: 16px;
|
|
|
- width: calc(100% - 248px);
|
|
|
- padding: 12px 8px 12px;
|
|
|
+ padding: 12px 8px;
|
|
|
+ padding-right: 16px;
|
|
|
background-color: var(--color-header-bg);
|
|
|
border-radius: 6px;
|
|
|
|
|
|
.origin {
|
|
|
- flex: 1;
|
|
|
+ flex-grow: 1;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
justify-content: space-between;
|
|
|
-
|
|
|
- min-width: var(--detail-destination-width);
|
|
|
- max-width: calc(100% - var(--detail-destination-width));
|
|
|
+ overflow: hidden;
|
|
|
+ .label {
|
|
|
+ margin-top: 1px;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
.destination {
|
|
|
- flex: 1;
|
|
|
- min-width: calc(var(--detail-destination-width) - 16px);
|
|
|
+ flex-shrink: 0; /* 防止右边的子盒子缩小 */
|
|
|
+ flex-basis: auto; /* 根据内容决定初始宽度 */
|
|
|
+ max-width: 40%;
|
|
|
display: flex;
|
|
|
flex-direction: column;
|
|
|
justify-content: space-between;
|
|
|
.label {
|
|
|
width: calc(100% - 40px);
|
|
|
+ margin-top: 1px;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -422,11 +412,10 @@ onBeforeUnmount(() => {
|
|
|
}
|
|
|
|
|
|
.transport-info {
|
|
|
- width: 248px;
|
|
|
+ width: calc((100% - 165px) / 3);
|
|
|
padding: 8px 16px;
|
|
|
background-color: var(--color-header-bg);
|
|
|
border-radius: 6px;
|
|
|
-
|
|
|
.item {
|
|
|
.title {
|
|
|
margin-bottom: 4px;
|
|
|
@@ -474,6 +463,7 @@ onBeforeUnmount(() => {
|
|
|
}
|
|
|
|
|
|
.single-line-ellipsis {
|
|
|
+ height: 18px;
|
|
|
display: inline-block; /* 或者根据需要使用 inline-block */
|
|
|
white-space: nowrap; /* 不换行 */
|
|
|
overflow: hidden; /* 隐藏超出部分 */
|