فهرست منبع

feat:修改首页下载名字统一,添加查询值为空时改为默认条件;

AmandaG 1 سال پیش
والد
کامیت
bd01254897

+ 2 - 2
src/router/index.ts

@@ -97,14 +97,14 @@ router.beforeEach(async (to, from, next) => {
   // 如果手动跳转登录页,清除登录信息
   if (to.path === '/login') {
     const userStore = useUserStore()
-    userStore.logout()
+    await userStore.logout()
   }
   // 未登录白名单
   const whiteList = ['/login', '/public-tracking', '/public-tracking/detail', '/reset-password']
   // 判断是否登录
   if (!whiteList.includes(to.path) && !localStorage.getItem('username')) {
     const userStore = useUserStore()
-    userStore.logout()
+    await userStore.logout()
     if (whiteList.includes(from.path)) {
       ElMessage.warning({
         message: 'Please log in to use this feature.',

+ 2 - 2
src/stores/modules/user.ts

@@ -13,9 +13,9 @@ export const useUserStore = defineStore('user', {
       localStorage.setItem('username', username)
       this.username = username
     },
-    logout(isNeedLogout: boolean = true) {
+    async logout(isNeedLogout: boolean = true) {
       if (isNeedLogout) {
-        $api.logout().then(() => {})
+        await $api.logout().then(() => {})
       }
       localStorage.removeItem('username')
       this.username = ''

+ 2 - 2
src/utils/axios.ts

@@ -45,8 +45,8 @@ class HttpAxios {
   }
 
   _requestInterceptors = (config: AxiosRequestConfig) => {
-    const _config = { timeout: this.timeout }
-    return { ...config, ..._config }
+    // const _config = { timeout: this.timeout }
+    // return { ...config, ..._config }
     return config
   }
   /**

+ 11 - 5
src/views/Booking/src/BookingView.vue

@@ -7,6 +7,7 @@ import DateRange from '@/components/DateRange'
 import MoreFilters from '@/components/MoreFilters'
 import { ref, reactive } from 'vue'
 import { useCalculatingHeight } from '@/hooks/calculatingHeight'
+import { stubString } from 'lodash'
 
 const filterRef: Ref<HTMLElement | null> = ref(null)
 
@@ -403,7 +404,16 @@ const SearchInput = () => {
         @close="handleClose(tag)"
         color="#EFEFF0"
       >
-        {{ tag }}
+        <el-tooltip
+          class="box-item"
+          effect="dark"
+          :content="tag"
+          placement="top"
+          v-if="tag.length > 39"
+        >
+          {{ tag.length > 39 ? tag.substr(0, 39) + '...' : tag }}
+        </el-tooltip>
+        <div v-else>{{ tag }}</div>
       </el-tag>
       <div class="text_button" @click="clearfilters">Clear Filters</div>
     </div>
@@ -452,10 +462,6 @@ const SearchInput = () => {
   color: var(--color-neutral-1);
   font-weight: 600;
   font-size: var(--font-size-2);
-  max-width: 320px; /* 设置最大宽度为150像素 */
-  overflow: hidden; /* 超出部分隐藏 */
-  white-space: nowrap; /* 文字不换行 */
-  text-overflow: ellipsis;
 }
 @media only screen and (min-width: 1280px) {
   .search {

+ 13 - 1
src/views/Booking/src/components/BookingDetail/src/BookingDetail.vue

@@ -1,5 +1,7 @@
 <script setup lang="ts">
 import dayjs from 'dayjs'
+import timezone from 'dayjs/plugin/timezone'
+import utc from 'dayjs/plugin/utc'
 import { VueDraggable } from 'vue-draggable-plus'
 import BasicInformation from './components/BasicInformation.vue'
 import ContainersView from './components/ContainersView.vue'
@@ -9,6 +11,8 @@ import { transportationMode } from '@/components/TransportationMode'
 import { useRoute } from 'vue-router'
 import { useOverflow } from '@/hooks/useOverflow'
 
+dayjs.extend(utc)
+dayjs.extend(timezone)
 const route = useRoute()
 
 // 可拖拽模块的列表
@@ -89,6 +93,14 @@ getData()
 const formatTime = (time: string) => {
   return time ? dayjs(time).format('MMM-DD-YYYY hh:mm A') : '--'
 }
+const formatTimezone = (tiem: string, timezone: string) => {
+  if (!tiem) return '--'
+  const formattedTime = dayjs(tiem).format('MMM-DD-YYYY hh:mm A')
+  const timeZoneOffset = dayjs().tz(timezone).format('Z')
+  // 替换 "+07:00" 为 "GMT+7"
+  const gmtOffset = `GMT${timeZoneOffset.slice(0, 3)}`
+  return `${formattedTime} (${gmtOffset})`
+}
 
 const originRef = ref()
 const destinationRef = ref()
@@ -115,7 +127,6 @@ const { isOverflow: isDestinationOverflow } = useOverflow(destinationRef, allDat
           <div class="origin">
             <div class="title">Origin</div>
             <div class="content">
-              <!-- <span>{{ allData?.transportInfo?.origin }}</span> -->
               <el-tooltip v-if="isOriginOverflow" placement="top">
                 <template #content>{{ allData?.transportInfo?.origin || '--' }}</template>
                 <span ref="originRef" class="info single-line-ellipsis">{{
@@ -281,6 +292,7 @@ const { isOverflow: isDestinationOverflow } = useOverflow(destinationRef, allDat
         }
       }
       .transport-way {
+        flex: 1 1 20%;
         display: flex;
         flex-direction: row;
         justify-content: flex-start;

+ 4 - 4
src/views/Booking/src/components/BookingTable/src/BookingTable.vue

@@ -139,10 +139,6 @@ const searchTableData = (data: any) => {
         bookingTable.value.data = res.data.searchData || []
         pageInfo.value.total = Number(res.data.rc)
         tempSearch.value = res.data.tmp_search
-        nextTick(() => {
-          tableRef.value && autoWidth(bookingTable.value, tableRef.value)
-          tableLoadingTableData.value = false
-        })
         // 拥有所有字段的表格
         setTimeout(() => {
           allTable.value.columns = handleColumns(res.data.allColums, 'all')
@@ -154,6 +150,10 @@ const searchTableData = (data: any) => {
         }, 1000)
       }
     })
+    .finally(() => {
+      tableRef.value && autoWidth(bookingTable.value, tableRef.value)
+      tableLoadingTableData.value = false
+    })
 }
 
 onMounted(() => {

+ 24 - 8
src/views/Dashboard/src/DashboardView.vue

@@ -119,7 +119,8 @@ const DateChange = (value: any) => {
 const ETDobj = reactive({
   ETD_Title: '',
   ETDList: [],
-  ETD_Radius: []
+  ETD_Radius: [],
+  download_name: ''
 })
 const GetETDEcharts = () => {
   $api
@@ -132,6 +133,7 @@ const GetETDEcharts = () => {
         ETDobj.ETD_Title = `{a|${res.data.ETD_Title}}`
         ETDobj.ETDList = res.data.ETDList
         ETDobj.ETD_Radius = res.data.ETD_Radius
+        ETDobj.download_name = res.data.download_name
       }
     })
 }
@@ -139,7 +141,8 @@ const GetETDEcharts = () => {
 const KPIobj = reactive({
   ETD_Title: '',
   ETDList: [],
-  ETD_Radius: []
+  ETD_Radius: [],
+  download_name: ''
 })
 const GetKPIEcharts = () => {
   $api
@@ -151,6 +154,7 @@ const GetKPIEcharts = () => {
         KPIobj.ETD_Title = `{a|${res.data.title1}}{b|${res.data.title2})}`
         KPIobj.ETDList = res.data.ETDList
         KPIobj.ETD_Radius = res.data.ETD_Radius
+        KPIobj.download_name = res.data.download_name
       }
     })
 }
@@ -158,7 +162,8 @@ const GetKPIEcharts = () => {
 const Arrivalobj = reactive({
   ETD_Title: '',
   ETDList: [],
-  ETD_Radius: []
+  ETD_Radius: [],
+  download_name: ''
 })
 const GetKPIArrivalEcharts = () => {
   $api
@@ -170,6 +175,7 @@ const GetKPIArrivalEcharts = () => {
         Arrivalobj.ETD_Title = `{a|${res.data.title1}}{b|${res.data.title2})}`
         Arrivalobj.ETDList = res.data.ETDList
         Arrivalobj.ETD_Radius = res.data.ETD_Radius
+        Arrivalobj.download_name = res.data.download_name
       }
     })
 }
@@ -177,7 +183,8 @@ const GetKPIArrivalEcharts = () => {
 const Pendingobj = reactive({
   ETD_Title: '',
   ETDList: [],
-  ETD_Radius: []
+  ETD_Radius: [],
+  download_name: ''
 })
 const GetPendingEcharts = () => {
   $api
@@ -189,6 +196,7 @@ const GetPendingEcharts = () => {
         Pendingobj.ETD_Title = `{a|${res.data.title1}}{b|${res.data.title2})}`
         Pendingobj.ETDList = res.data.ETDList
         Pendingobj.ETD_Radius = res.data.ETD_Radius
+        Pendingobj.download_name = res.data.download_name
       }
     })
 }
@@ -196,7 +204,8 @@ const GetPendingEcharts = () => {
 const PendingArrivalobj = reactive({
   ETD_Title: '',
   ETDList: [],
-  ETD_Radius: []
+  ETD_Radius: [],
+  download_name: ''
 })
 const GetPendingArrivalEcharts = () => {
   $api
@@ -208,6 +217,7 @@ const GetPendingArrivalEcharts = () => {
         PendingArrivalobj.ETD_Title = `{a|${res.data.title1}}{b|${res.data.title2})}`
         PendingArrivalobj.ETDList = res.data.ETDList
         PendingArrivalobj.ETD_Radius = res.data.ETD_Radius
+        PendingArrivalobj.download_name = res.data.download_name
       }
     })
 }
@@ -217,7 +227,8 @@ const containerObj = reactive({
   barList: [],
   barSeries: [],
   Max: 0,
-  interval: 0
+  interval: 0,
+  download_name: ''
 })
 const containerType = ref([])
 const GetContainerCountEcharts = (val: any) => {
@@ -235,6 +246,7 @@ const GetContainerCountEcharts = (val: any) => {
         containerObj.barSeries = res.data.ContainerCounSeries
         containerObj.Max = res.data.Max
         containerObj.interval = res.data.interval
+        containerObj.download_name = res.data.download_name
         for (let i = 0; i < res.data.ContainerCounSeries.length; i++) {
           containerType.value.push(res.data.ContainerCounSeries[i].name)
         }
@@ -248,7 +260,8 @@ const EmissionObj = reactive({
   barList: [],
   barSeries: [],
   Max: 0,
-  interval: 0
+  interval: 0,
+  download_name: ''
 })
 const GetCo2EmissionEcharts = () => {
   $api.GetCo2EmissionEcharts({}).then((res: any) => {
@@ -258,6 +271,7 @@ const GetCo2EmissionEcharts = () => {
       EmissionObj.barSeries = res.data.ContainerCounSeries
       EmissionObj.Max = res.data.Max
       EmissionObj.interval = res.data.interval
+      EmissionObj.download_name = res.data.download_name
     }
   })
 }
@@ -267,7 +281,8 @@ const DestinationObj = reactive({
   barList: [],
   barSeries: [],
   Max: 0,
-  interval: 0
+  interval: 0,
+  download_name: ''
 })
 const GetCo2DestinationEcharts = () => {
   $api.GetCo2DestinationEcharts({}).then((res: any) => {
@@ -277,6 +292,7 @@ const GetCo2DestinationEcharts = () => {
       DestinationObj.barSeries = res.data.ContainerCounSeries
       DestinationObj.Max = res.data.Max
       DestinationObj.interval = res.data.interval
+      DestinationObj.download_name = res.data.download_name
     }
   })
 }

+ 6 - 1
src/views/Dashboard/src/components/BarChart.vue

@@ -18,6 +18,7 @@ watch(
     initOption.legend.data = Name.value
     initOption.yAxis.max = Max.value
     initOption.yAxis.interval = interval.value
+    initOption.toolbox.feature.saveAsImage.name = downloadName.value
     initChart()
   },
   {
@@ -54,6 +55,10 @@ const Name = computed(() => {
     return []
   }
 })
+const downloadName = computed(() => {
+  return bar_data.value?.download_name
+})
+
 // 数额
 const initOption = reactive({
   //标题
@@ -179,7 +184,7 @@ const initOption = reactive({
     show: true, // 显示工具箱
     feature: {
       restore: { show: true },
-      saveAsImage: { show: true }
+      saveAsImage: { show: true, name: downloadName.value }
     },
     showTitle: false
   }

+ 6 - 2
src/views/Dashboard/src/components/PieChart.vue

@@ -5,18 +5,19 @@ import { onMounted, ref, reactive, watch, computed } from 'vue'
 const props = defineProps({
   PieData: Object
 })
+const pie_data = ref(props.PieData)
 watch(
   () => props.PieData,
   (current) => {
     pie_data.value = current
     initOption.title.text = pie_title.value
+    initOption.toolbox.feature.saveAsImage.name = downloadName.value
     initChart()
   },
   {
     deep: true
   }
 )
-const pie_data = ref(props.PieData)
 const pie_ref = ref()
 
 // legend
@@ -37,6 +38,9 @@ const pie_radius = computed(() => {
 const pie_series = computed(() => {
   return pie_data.value?.ETDList
 })
+const downloadName = computed(() => {
+  return pie_data.value?.download_name
+})
 
 const initOption: any = reactive({
   //标题
@@ -94,7 +98,7 @@ const initOption: any = reactive({
     show: true, // 显示工具箱
     feature: {
       restore: { show: true },
-      saveAsImage: { show: true }
+      saveAsImage: { show: true, name: downloadName.value }
     },
     showTitle: false
   },

+ 0 - 3
src/views/Layout/src/components/Header/components/LogoutDialog.vue

@@ -1,6 +1,5 @@
 <script setup lang="ts">
 import { useRouter } from 'vue-router'
-import { useUserStore } from '@/stores/modules/user'
 
 const router = useRouter()
 const dialogVisible = ref(false)
@@ -9,10 +8,8 @@ const openDialog = () => {
   dialogVisible.value = true
 }
 
-const userStore = useUserStore()
 const handleLogout = () => {
   dialogVisible.value = false
-  userStore.logout()
   router.push('/login')
   sessionStorage.clear()
 }

+ 1 - 0
src/views/Tracking/src/components/PublicTracking/src/components/PublicTrackingDetail.vue

@@ -225,6 +225,7 @@ const { isOverflow: isDestinationOverflow } = useOverflow(destinationRef, allDat
         }
       }
       .transport-way {
+        flex: 1 1 20%;
         display: flex;
         flex-direction: row;
         justify-content: flex-start;

+ 1 - 0
src/views/Tracking/src/components/TrackingDetail/src/TrackingDetail.vue

@@ -356,6 +356,7 @@ const { isOverflow: isDestinationOverflow } = useOverflow(destinationRef, allDat
         }
       }
       .transport-way {
+        flex: 1 1 20%;
         display: flex;
         flex-direction: row;
         justify-content: flex-start;

+ 20 - 12
src/views/Tracking/src/components/TrackingTable/src/TrackingTable.vue

@@ -133,7 +133,7 @@ const getSharedTableData = () => {
   return false
 }
 
-const getTableData = async (isInit: boolean, isPageChange?: boolean) => {
+const getTableData = async (isPageChange?: boolean) => {
   const rc = isPageChange ? pageInfo.value.total : -1
   tableLoadingTableData.value = true
 
@@ -184,8 +184,8 @@ const getTableData = async (isInit: boolean, isPageChange?: boolean) => {
         if (res.code === 200) {
           trackingTable.value.data = res.data.searchData || []
           pageInfo.value.total = Number(res.data.rc)
-
           tempSearch.value = res.data.tmp_search
+
           if (res.data.canEdiVgm && trackingTable.value.columns.length > 0) {
             const index = trackingTable.value.columns.findIndex(
               (item: any) => item.title === 'Action'
@@ -212,10 +212,8 @@ const getTableData = async (isInit: boolean, isPageChange?: boolean) => {
       })
   }
   nextTick(() => {
-    if (!isInit) {
-      tableRef.value && autoWidth(trackingTable.value, tableRef.value)
-      tableLoadingTableData.value = false
-    }
+    tableRef.value && autoWidth(trackingTable.value, tableRef.value)
+    tableLoadingTableData.value = false
   })
 }
 
@@ -237,10 +235,19 @@ const searchTableData = (data: any) => {
         pageInfo.value.total = Number(res.data.rc)
         tempSearch.value = res.data.tmp_search
 
-        nextTick(() => {
-          tableRef.value && autoWidth(trackingTable.value, tableRef.value)
-        })
-
+        if (res.data.canEdiVgm && trackingTable.value.columns.length > 0) {
+          const index = trackingTable.value.columns.findIndex(
+            (item: any) => item.title === 'Action'
+          )
+          if (index === -1) {
+            trackingTable.value.columns.push({
+              title: 'Action',
+              fixed: 'right',
+              width: 80,
+              slots: { default: 'action' }
+            })
+          }
+        }
         // 拥有所有字段的表格
         setTimeout(() => {
           allTable.value.columns = handleColumns(res.data.allColums, 'all')
@@ -252,6 +259,7 @@ const searchTableData = (data: any) => {
       }
     })
     .finally(() => {
+      tableRef.value && autoWidth(trackingTable.value, tableRef.value)
       tableLoadingTableData.value = false
     })
 }
@@ -581,8 +589,8 @@ defineExpose({
           background
           layout="sizes, prev, pager, next"
           :total="pageInfo.total"
-          @size-change="getTableData(false, true)"
-          @current-change="getTableData(false, true)"
+          @size-change="getTableData(true)"
+          @current-change="getTableData(true)"
         />
       </div>
     </div>