Browse Source

feat:修改主页获取数据

AmandaG 1 năm trước cách đây
mục cha
commit
486d3099a0

+ 1 - 2
src/auto-imports.d.ts

@@ -3,7 +3,6 @@
 // @ts-nocheck
 // noinspection JSUnusedGlobalSymbols
 // Generated by unplugin-auto-import
-// biome-ignore lint: disable
 export {}
 declare global {
   const $api: typeof import('@/api/index')['default']
@@ -69,6 +68,6 @@ declare global {
 // for type re-export
 declare global {
   // @ts-ignore
-  export type { Component, ComponentPublicInstance, ComputedRef, DirectiveBinding, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, MaybeRef, MaybeRefOrGetter, VNode, WritableComputedRef } from 'vue'
+  export type { Component, ComponentPublicInstance, ComputedRef, ExtractDefaultPropTypes, ExtractPropTypes, ExtractPublicPropTypes, InjectionKey, PropType, Ref, VNode, WritableComputedRef } from 'vue'
   import('vue')
 }

+ 16 - 26
src/components/MoreFilters/src/MoreFilters.vue

@@ -449,7 +449,13 @@ const changeAutoSelectAddType = (index: any, val: any) => {
 const changeAutoSelectPlacesAddType = (index: any, val: any) => {
   pushPlacesSelectedList(index, val)
 }
-const changeAutoSelectVal = (val: any, value: any) => {
+const isError = ref(false)
+const changeAutoSelectVal = (val: any, value: any, boolaen: any) => {
+  if (boolaen) {
+    isError.value = true
+  } else {
+    isError.value = false
+  }
   MoreFiltersObj = { ...MoreFiltersObj, ...val }
   for (const key in value) {
     MoreFiltersObj2[key] = value[key]
@@ -477,30 +483,15 @@ const SearchMore = () => {
       }
     })
   }
-  // 判断是否有验证样式
-  // const input_change = document.getElementsByClassName('input_change')
-  // if (AddDateType.value.length) {
-  //   AddDateType.value.forEach((item: any, index: any) => {
-  //     if (item.partyType != '' && item.partyname.length == 0) {
-  //       item.isshowVerfication = true
-  //       verification.value = 'Please input Party Details'
-  //       input_change[index].classList.add('AlertInput')
-  //     } else {
-  //       item.isshowVerfication = false
-  //       input_change[index].classList.remove('AlertInput')
-  //     }
-  //   })
-  //   const AlertInput = document.getElementsByClassName('AlertInput')
-  //   if (AlertInput.length == 0) {
-  //     // 传数据给父组件
-  //     emit('MoreFiltersSearch', MoreFiltersObj, MoreFiltersObj2)
-  //     drawer.value = false
-  //   }
-  // } else {
-  //   // 传数据给父组件
-  //   emit('MoreFiltersSearch', MoreFiltersObj, MoreFiltersObj2)
-  //   drawer.value = false
-  // }
+  if (isError.value) {
+    // 传数据给父组件
+    emit('MoreFiltersSearch', MoreFiltersObj, MoreFiltersObj2)
+    drawer.value = false
+  } else {
+    // 传数据给父组件
+    // emit('MoreFiltersSearch', MoreFiltersObj, MoreFiltersObj2)
+    // drawer.value = false
+  }
 }
 // 清除
 const clearrest = () => {
@@ -660,7 +651,6 @@ const ServiceSearch = (val: any, value: any) => {
             ref="partSelectTableSelectRef"
             :AddDateType="AddDateType"
             :DateTypeoptions="PartyTypeoptions"
-            :Verification="verification"
             @changeAutoSelectAddType="changeAutoSelectAddType"
             @changeAutoSelect="changeAutoSelectVal"
             :selectedPartyTypeoptions="selectedPartyTypeoptions"

+ 4 - 16
src/components/selectAutoSelect/src/selectAutoSelect.vue

@@ -1,5 +1,5 @@
 <script setup lang="ts">
-import { ref, watch } from 'vue'
+import { ref, watch, computed } from 'vue'
 import IconDropDown from '@/components/IconDropDown'
 interface TypeItem {
   partyType: ''
@@ -19,7 +19,6 @@ interface Props {
   ASPlaceholder: string
   DateTypeoptions: dateoptions[]
   selectedPartyTypeoptions: Array<string>
-  ASErrorList: Object
 }
 interface optionsItem {
   value: string
@@ -31,8 +30,7 @@ const options = ref<ListItem[]>([])
 const loading = ref(false)
 const props = withDefaults(defineProps<Props>(), {})
 const AddType = ref(props.AddDateType)
-const errorList = ref(props.ASErrorList)
-const value = ref()
+// const ErrorNumber = ref(0)
 const dataTypeoptions = ref<optionsItem[]>([])
 const typeSelectIndex = ref(-1)
 watch(
@@ -58,6 +56,7 @@ watch(
     deep: true
   }
 )
+const ErrorNumber = ref(true)
 const str = ref()
 const InputAutoSelect = (val: any) => {
   if (val.includes('Agent')) {
@@ -107,16 +106,7 @@ let AutoSelectObj2: any = {}
 const changeAutoSelect = (val: any, value: any) => {
   AutoSelectObj[val] = value.join()
   AutoSelectObj2[val] = value
-  emit('changeAutoSelect', AutoSelectObj, AutoSelectObj2)
-}
-// 清除警告样式
-const removeClass = (val: any, index: any) => {
-  const input_change = document.getElementsByClassName('input_change')
-  if (input_change.length && val.partyname.length != 0) {
-    if (input_change[index].classList.value.indexOf('AlertInput') != -1) {
-      input_change[index].classList.remove('AlertInput')
-    }
-  }
+  emit('changeAutoSelect', AutoSelectObj, AutoSelectObj2, ErrorNumber.value)
 }
 const typeSelectFocus = (index: any, e: any) => {
   typeSelectIndex.value = index
@@ -206,14 +196,12 @@ const typeSelectClick = (index: any, val: any) => {
         multiple
         filterable
         remote
-        class="input_change"
         :class="{
           is_error: AddType[index].partyType != '' && AddType[index].partyname.length == 0
         }"
         :reserve-keyword="false"
         :placeholder="props.ASPlaceholder"
         collapse-tags
-        @blur="removeClass(AddType[index], index)"
         @input="InputAutoSelect(AddType[index].partyType)"
         @change="changeAutoSelect(AddType[index].partyType, AddType[index].partyname)"
         :disabled="AddType[index].partyType ? false : true"

+ 24 - 4
src/views/Booking/src/BookingView.vue

@@ -61,11 +61,13 @@ const handleClose = (tag: any) => {
     delete searchTableQeury['f_voyage/m_voyage']
   }
   BookingTable_ref.value.searchTableData(searchTableQeury)
+  getbookingdata()
 }
 // 筛选框查询
 const FiltersSeach = (val: any, value: any) => {
   searchTableQeury[val] = value
   BookingTable_ref.value.searchTableData(searchTableQeury)
+  getbookingdata()
 }
 //TransportSearch
 const TransportSearch = (val: any) => {
@@ -97,6 +99,7 @@ const DateRangeSearch = (val: any, value: any) => {
     }
   }
   BookingTable_ref.value.searchTableData(searchTableQeury)
+  getbookingdata()
   renderTagsData()
 }
 //MoreFiltersSearch
@@ -133,6 +136,7 @@ const MoreFiltersSearch = (val: any, value: any) => {
   }
   // for(const key in value)
   BookingTable_ref.value.searchTableData(searchTableQeury)
+  getbookingdata()
   renderTagsData()
 }
 const clearfilters = () => {
@@ -158,6 +162,7 @@ const clearfilters = () => {
   emitter.emit('clearTag', 'voyage')
   searchTableQeury = {}
   BookingTable_ref.value.searchTableData(searchTableQeury)
+  getbookingdata()
 }
 const renderTagsData = () => {
   tagsData.value = []
@@ -198,21 +203,36 @@ interface ListItem {
 }
 const TagsList = ref<ListItem[]>([])
 const filterTag = ref(['All'])
+const getbookingdata = () => {
+  $api
+    .getBookingTableData({
+      cp: BookingTable_ref.value.pageInfo.pageNo,
+      ps: BookingTable_ref.value.pageInfo.pageSize,
+      rc: -1,
+      other_filed: '',
+      ...searchTableQeury
+    })
+    .then((res: any) => {
+      if (res.code === 200) {
+        TransportListItem.value = res.data.TransportList
+        TagsList.value = res.data.tagsList
+      }
+    })
+}
 onMounted(() => {
-  setTimeout(() => {
-    TransportListItem.value = BookingTable_ref.value.TransportListItem
-    TagsList.value = BookingTable_ref.value.TagsList
-  }, 2000)
+  getbookingdata()
 })
 const changeTag = (val: any) => {
   searchTableQeury.filterTag = val
   BookingTable_ref.value.searchTableData(searchTableQeury)
+  getbookingdata()
   filterTag.value = val
 }
 // 点击search按钮
 const SearchInput = () => {
   searchTableQeury._textSearch = BookingSearch.value
   BookingTable_ref.value.searchTableData(searchTableQeury)
+  getbookingdata()
 }
 const propsPartyTypeoptions = ref([
   {

+ 1 - 5
src/views/Booking/src/components/BookingTable/src/BookingTable.vue

@@ -105,9 +105,6 @@ const getTableData = async (isInit: boolean, isPageChange?: boolean) => {
       if (res.code === 200) {
         bookingTable.value.data = res.data.searchData
         pageInfo.value.total = Number(res.data.rc)
-        TransportListItem.value = res.data.TransportList
-        TagsList.value = res.data.tagsList
-
         // 拥有所有字段的表格
         setTimeout(() => {
           allTable.value.columns = handleColumns(res.data.allColums, 'all')
@@ -337,8 +334,7 @@ const handleCheckAllChange = ({ records }: any) => {
 }
 defineExpose({
   searchTableData,
-  TransportListItem,
-  TagsList
+  pageInfo
 })
 </script>
 

+ 30 - 1
src/views/Dashboard/src/DashboardView.vue

@@ -356,8 +356,10 @@ const ClickParams = (val: any) => {
   } else {
     tenyear = currentDate.getFullYear()
   }
+  const reportList: any = {}
   // ETD to ETA(DAYS)点击跳转
   if (val == 'ETD to ETA (Days)') {
+    console.log(pie_chart_ETD.value)
     $api
       .ClickEtdToEta({
         _reportRef: pie_chart_ETD.value[0].paramsdata.name,
@@ -366,7 +368,11 @@ const ClickParams = (val: any) => {
       })
       .then((res: any) => {
         if (res.code == 200) {
+          reportList._reportRef = pie_chart_ETD.value[0].paramsdata.name
+          reportList._reportRefe_date = currentDate.getMonth() + 1 + '/' + currentDate.getFullYear()
+          reportList._reportRefb_date = currentDate.getMonth() + 3 + '/' + tenyear
           sessionStorage.setItem('clickParams', JSON.stringify(res.data))
+          sessionStorage.setItem('reportList', JSON.stringify(reportList))
           let obj: any = {}
           obj.title = 'ETD to ETA (Days)'
           obj.data = pie_chart_ETD.value[0].paramsdata.name
@@ -385,7 +391,9 @@ const ClickParams = (val: any) => {
       })
       .then((res: any) => {
         if (res.code == 200) {
+          reportList._reportRef = pie_chart_pending_arrival.value[0].paramsdata.name
           sessionStorage.setItem('clickParams', JSON.stringify(res.data))
+          sessionStorage.setItem('reportList', JSON.stringify(reportList))
           let obj: any = {}
           obj.title = 'Pending Arrival'
           obj.data = pie_chart_pending_arrival.value[0].paramsdata.name
@@ -404,7 +412,9 @@ const ClickParams = (val: any) => {
       })
       .then((res: any) => {
         if (res.code == 200) {
+          reportList._reportRef = pie_chart_pending_departure.value[0].paramsdata.name
           sessionStorage.setItem('clickParams', JSON.stringify(res.data))
+          sessionStorage.setItem('reportList', JSON.stringify(reportList))
           let obj: any = {}
           obj.title = 'Pending Departure'
           obj.data = pie_chart_pending_departure.value[0].paramsdata.name
@@ -417,13 +427,16 @@ const ClickParams = (val: any) => {
   }
   // KPIDeparture点击跳转
   else if (val == 'KPI0') {
+    console.log(pie_chart_kpi_departure.value)
     $api
       .ClickKPIDeparture({
         _reportRef: pie_chart_kpi_departure.value[0].paramsdata.name
       })
       .then((res: any) => {
         if (res.code == 200) {
+          reportList._reportRef = pie_chart_kpi_departure.value[0].paramsdata.name
           sessionStorage.setItem('clickParams', JSON.stringify(res.data))
+          sessionStorage.setItem('reportList', JSON.stringify(reportList))
           let obj: any = {}
           obj.title = 'KPI Departure'
           obj.data = pie_chart_kpi_departure.value[0].paramsdata.name
@@ -442,7 +455,9 @@ const ClickParams = (val: any) => {
       })
       .then((res: any) => {
         if (res.code == 200) {
+          reportList._reportRef = pie_chart_kpi_arrival.value[0].paramsdata.name
           sessionStorage.setItem('clickParams', JSON.stringify(res.data))
+          sessionStorage.setItem('reportList', JSON.stringify(reportList))
           let obj: any = {}
           obj.title = 'KPI Arrival'
           obj.data = pie_chart_kpi_arrival.value[0].paramsdata.name
@@ -465,7 +480,10 @@ const ClickParams = (val: any) => {
       })
       .then((res: any) => {
         if (res.code == 200) {
+          reportList._reportRef = array
+          reportList._reportStationType = 'origin'
           sessionStorage.setItem('clickParams', JSON.stringify(res.data))
+          sessionStorage.setItem('reportList', JSON.stringify(reportList))
           let obj: any = {}
           obj.title = 'Top 10 Origin'
           obj.data = seller_chart_top10_origin.value[0].paramsdata
@@ -488,7 +506,10 @@ const ClickParams = (val: any) => {
       })
       .then((res: any) => {
         if (res.code == 200) {
+          reportList._reportRef = array
+          reportList._reportStationType = 'agent'
           sessionStorage.setItem('clickParams', JSON.stringify(res.data))
+          sessionStorage.setItem('reportList', JSON.stringify(reportList))
           let obj: any = {}
           obj.title = 'Top 10 Destination'
           obj.data = seller_chart_top10_destination.value[0].paramsdata
@@ -509,7 +530,11 @@ const ClickParams = (val: any) => {
       })
       .then((res: any) => {
         if (res.code == 200) {
+          reportList._reportRef = seller_chart_CO2_origin.value[0].paramsdata.name
+          reportList._reportDataType = seller_chart_CO2_origin.value[0].paramsdata.type
+          reportList._reportStationType = 'origin'
           sessionStorage.setItem('clickParams', JSON.stringify(res.data))
+          sessionStorage.setItem('reportList', JSON.stringify(reportList))
           let obj: any = {}
           obj.title = 'CO2e Emission by Origin (Top 10)'
           obj.data = seller_chart_CO2_origin.value[0].paramsdata.name
@@ -526,11 +551,15 @@ const ClickParams = (val: any) => {
       .ClickCO2({
         _reportRef: seller_chart_CO2_destination.value[0].paramsdata.name,
         _reportDataType: seller_chart_CO2_destination.value[0].paramsdata.type,
-        _reportStationType: 'origin'
+        _reportStationType: 'agent'
       })
       .then((res: any) => {
         if (res.code == 200) {
+          reportList._reportRef = seller_chart_CO2_destination.value[0].paramsdata.name
+          reportList._reportDataType = seller_chart_CO2_destination.value[0].paramsdata.type
+          reportList._reportStationType = 'agent'
           sessionStorage.setItem('clickParams', JSON.stringify(res.data))
+          sessionStorage.setItem('reportList', JSON.stringify(reportList))
           let obj: any = {}
           obj.title = 'CO2e Emission by Destination (Top 10)'
           obj.data = seller_chart_CO2_destination.value[0].paramsdata.name

+ 36 - 4
src/views/Tracking/src/TrackingView.vue

@@ -74,13 +74,22 @@ const handleClose = (tag: any) => {
     delete searchTableQeury['f_vessel/vessel']
   } else if (tag.includes('voyage')) {
     delete searchTableQeury['f_voyage/voyage']
+  } else {
+    delete searchTableQeury._reportRef
+    delete searchTableQeury._reportRefe_date
+    delete searchTableQeury._reportRefb_date
+    delete searchTableQeury._reportStationType
+    delete searchTableQeury._reportDataType
+    delete searchTableQeury._reportStationType
   }
   TrackingTable_ref.value.searchTableData(searchTableQeury)
+  Gettrackingdata()
 }
 // 筛选框查询
 const FiltersSeach = (val: any, value: any) => {
   searchTableQeury[val] = value
   TrackingTable_ref.value.searchTableData(searchTableQeury)
+  Gettrackingdata()
 }
 //TransportSearch
 const TransportSearch = (val: any) => {
@@ -112,6 +121,7 @@ const DateRangeSearch = (val: any, value: any) => {
     }
   }
   TrackingTable_ref.value.searchTableData(searchTableQeury)
+  Gettrackingdata()
   renderTagsData()
 }
 //MoreFiltersSearch
@@ -160,6 +170,7 @@ const MoreFiltersSearch = (val: any, value: any) => {
     }
   }
   TrackingTable_ref.value.searchTableData(searchTableQeury)
+  Gettrackingdata()
   renderTagsData()
 }
 const clearfilters = () => {
@@ -192,6 +203,7 @@ const clearfilters = () => {
   emitter.emit('clearTag', 'voyage')
   searchTableQeury = {}
   TrackingTable_ref.value.searchTableData(searchTableQeury)
+  Gettrackingdata()
 }
 const renderTagsData = () => {
   tagsData.value = []
@@ -237,30 +249,50 @@ interface ListItem {
 }
 const TagsList = ref<ListItem[]>([])
 const filterTag = ref(['All'])
+const Gettrackingdata = () => {
+  $api
+    .getTrackingTableData({
+      cp: TrackingTable_ref.value.pageInfo.pageNo,
+      ps: TrackingTable_ref.value.pageInfo.pageSize,
+      rc: -1,
+      other_filed: '',
+      ...searchTableQeury
+    })
+    .then((res: any) => {
+      if (res.code === 200) {
+        console.log(res.data)
+        TransportListItem.value = res.data.TransportList
+        TagsList.value = res.data.tagsList
+      }
+    })
+}
 onMounted(() => {
   if (
     sessionStorage.getItem('clickParams') != null &&
     sessionStorage.getItem('clickParams') != ''
   ) {
     const data = JSON.parse(sessionStorage.getItem('tagsList') as string) || {}
+    const reportlist = JSON.parse(sessionStorage.getItem('reportList') as string) || {}
     let str = `${data.title}:${data.data}`
     filterData.daterangeData.push(str)
+    for (const key in reportlist) {
+      searchTableQeury[key] = reportlist[key]
+    }
     renderTagsData()
   }
-  setTimeout(() => {
-    TransportListItem.value = TrackingTable_ref.value.TransportListItem
-    TagsList.value = TrackingTable_ref.value.TagsList
-  }, 2000)
+  Gettrackingdata()
 })
 const changeTag = (val: any) => {
   searchTableQeury.filterTag = val
   TrackingTable_ref.value.searchTableData(searchTableQeury)
   filterTag.value = val
+  Gettrackingdata()
 }
 // 点击search按钮
 const SearchInput = () => {
   searchTableQeury._textSearch = TrackingSearch.value
   TrackingTable_ref.value.searchTableData(searchTableQeury)
+  Gettrackingdata()
 }
 </script>
 

+ 1 - 4
src/views/Tracking/src/components/TrackingTable/src/TrackingTable.vue

@@ -173,8 +173,6 @@ const getTableData = async (isInit: boolean, isPageChange?: boolean) => {
         if (res.code === 200) {
           trackingTable.value.data = res.data.searchData
           pageInfo.value.total = Number(res.data.rc)
-          TransportListItem.value = res.data.TransportList
-          TagsList.value = res.data.tagsList
           if (res.data.canEdiVgm) {
             trackingTable.value.columns.push({
               title: 'Action',
@@ -395,8 +393,7 @@ const handleVGM = (row) => {
 }
 defineExpose({
   searchTableData,
-  TransportListItem,
-  TagsList
+  pageInfo
 })
 </script>
 

+ 1 - 1
vite.config.ts

@@ -9,7 +9,7 @@ import IconsResolver from 'unplugin-icons/resolver'
 
 // https://vitejs.dev/config/
 export default defineConfig({
-  base: `/${process.env.VITE_BASE_URL}/`,
+  base: `/k_new_online/`,
   resolve: {
     alias: {
       '@': fileURLToPath(new URL('./src', import.meta.url))