Эх сурвалжийг харах

决策驾驶舱空数据过滤

zhongxiaoyu 2 жил өмнө
parent
commit
909c1d680f

+ 11 - 11
src/views/dashboard/arrival.vue

@@ -379,7 +379,7 @@ import Echarts from '@/components/Echarts/commonChartsBar.vue'
 import ComHead from './components/comHead.vue'
 import { Calendar, CaretBottom } from '@element-plus/icons-vue'
 import Dialog from '@/components/dialog/index.vue'
-import { usePublic, showTimeMsg } from './hooks/usePublic'
+import { usePublic, showTimeMsg, parseDate } from './hooks/usePublic'
 // import nodeCode from './hooks/nodeCode'
 import { parseTime, isValue } from '@/utils/validate'
 import * as _ from 'lodash'
@@ -545,12 +545,6 @@ const pubFunc = (listValues, target, type?) => {
   return newObj
 }
 
-const parseDate = (date: string) => {
-  const dates = date.split('-')
-  const newDate = dates.shift()
-  return dates.join('-')
-}
-
 // 特货分类统计-选取下拉数据
 const handleCommand = (command: string) => {
   specialGoods.value = command
@@ -578,10 +572,16 @@ const waybillTrendFunc = async () => {
     { flightDate1: waybillDates.startDate, flightDate2: waybillDates.endDate },
   ])) as any
   if (listValues && isValue(listValues)) {
-    listValues.forEach(item => {
-      item.jobTime = parseDate(item['jobTime'])
-    })
-    waybillTrendObj.value = pubFunc(listValues, optionLeft, true)
+    const dealedList = listValues.reduce((preList, currentValue) => {
+      if (typeof currentValue.jobTime === 'string') {
+        return [...preList, {
+          ...currentValue,
+          jobTime: parseDate(currentValue.jobTime)
+        }]
+      }
+      return preList
+    }, [])
+    waybillTrendObj.value = pubFunc(dealedList, optionLeft, true)
   }
   loading2.value = false
 }

+ 22 - 16
src/views/dashboard/departure.vue

@@ -367,7 +367,7 @@ import Echarts from '@/components/Echarts/commonChartsBar.vue'
 import ComHead from './components/comHead.vue'
 import { Calendar, CaretBottom } from '@element-plus/icons-vue'
 import Dialog from '@/components/dialog/index.vue'
-import { usePublic, showTimeMsg } from './hooks/usePublic'
+import { usePublic, showTimeMsg, parseDate } from './hooks/usePublic'
 // import nodeCode from './hooks/nodeCode'
 import { parseTime, isValue } from '@/utils/validate'
 import * as _ from 'lodash'
@@ -531,12 +531,6 @@ const pubFunc = (listValues, target, type?) => {
   return newObj
 }
 
-const parseDate = (date: string) => {
-  const dates = date.split('-')
-  const newDate = dates.shift()
-  return dates.join('-')
-}
-
 // 特货分类统计-选取下拉数据
 const handleCommand = (command: string) => {
   specialGoods.value = command
@@ -564,10 +558,16 @@ const waybillTrendFunc = async () => {
     { flightDate1: waybillDates.startDate, flightDate2: waybillDates.endDate },
   ])) as any
   if (listValues && isValue(listValues)) {
-    listValues.forEach(item => {
-      item.jobTime = parseDate(item['jobTime'])
-    })
-    waybillTrendObj.value = pubFunc(listValues, optionLeft, true)
+    const dealedList = listValues.reduce((preList, currentValue) => {
+      if (typeof currentValue.jobTime === 'string') {
+        return [...preList, {
+          ...currentValue,
+          jobTime: parseDate(currentValue.jobTime)
+        }]
+      }
+      return preList
+    }, [])
+    waybillTrendObj.value = pubFunc(dealedList, optionLeft, true)
   }
   loading2.value = false
 }
@@ -739,11 +739,17 @@ const pickingFuncs = async () => {
   ])) as any
   if (listValues && isValue(listValues)) {
     const newObj: any = _.cloneDeep(airlineAbnormalBaggage.option.baseOption)
-    listValues.forEach(item => {
-      item.jobTime = parseDate(item['flightDate'])
-      item.weight = item['flightNum']
-    })
-    pickingObj.value = pubFunc(listValues, newObj)
+    const dealedList = listValues.reduce((preList, currentValue) => {
+      if (typeof currentValue.jobTime === 'string') {
+        return [...preList, {
+          ...currentValue,
+          jobTime: parseDate(currentValue.jobTime),
+          weight: currentValue.flightNum
+        }]
+      }
+      return preList
+    }, [])
+    pickingObj.value = pubFunc(dealedList, newObj)
   }
   loading8.value = false
 }

+ 5 - 5
src/views/dashboard/hooks/usePublic.ts

@@ -13,6 +13,10 @@ export enum showTimeMsg {
   SpecialClassification, // 特货分类
 }
 
+export function parseDate (date: string) {
+  return date.split('-').slice(1).join('-')
+}
+
 export function usePublic() {
   const optionLeft = {
     tooltip: {
@@ -487,11 +491,7 @@ export function usePublic() {
     const result = newArr.filter((item) => item[dot] && item[dot] != undefined)
     return result
   }
-  const parseDate = (date: string) => {
-    const dates = date.split('-')
-    const newDate = dates.shift()
-    return dates.join('-')
-  }
+
   const formatGoods = (name: string, datas: any) => {
     if (name === '合计') {
       return datas.reduce((prev, curr) => {

+ 11 - 11
src/views/dashboard/internationalArrival.vue

@@ -381,7 +381,7 @@ import Echarts from '@/components/Echarts/commonChartsBar.vue'
 import ComHead from './components/comHead.vue'
 import { Calendar, CaretBottom } from '@element-plus/icons-vue'
 import Dialog from '@/components/dialog/index.vue'
-import { usePublic, showTimeMsg } from './hooks/usePublic'
+import { usePublic, showTimeMsg, parseDate } from './hooks/usePublic'
 // import nodeCode from './hooks/nodeCode'
 import { parseTime, isValue } from '@/utils/validate'
 import * as _ from 'lodash'
@@ -547,12 +547,6 @@ const pubFunc = (listValues, target, type?) => {
   return newObj
 }
 
-const parseDate = (date: string) => {
-  const dates = date.split('-')
-  const newDate = dates.shift()
-  return dates.join('-')
-}
-
 // 特货分类统计-选取下拉数据
 const handleCommand = (command: string) => {
   specialGoods.value = command
@@ -580,10 +574,16 @@ const waybillTrendFunc = async () => {
     { flightDate1: waybillDates.startDate, flightDate2: waybillDates.endDate },
   ])) as any
   if (listValues && isValue(listValues)) {
-    listValues.forEach(item => {
-      item.jobTime = parseDate(item['jobTime'])
-    })
-    waybillTrendObj.value = pubFunc(listValues, optionLeft, true)
+    const dealedList = listValues.reduce((preList, currentValue) => {
+      if (typeof currentValue.jobTime === 'string') {
+        return [...preList, {
+          ...currentValue,
+          jobTime: parseDate(currentValue.jobTime)
+        }]
+      }
+      return preList
+    }, [])
+    waybillTrendObj.value = pubFunc(dealedList, optionLeft, true)
   }
   loading2.value = false
 }

+ 22 - 16
src/views/dashboard/internationalDeparture.vue

@@ -369,7 +369,7 @@ import Echarts from '@/components/Echarts/commonChartsBar.vue'
 import ComHead from './components/comHead.vue'
 import { Calendar, CaretBottom } from '@element-plus/icons-vue'
 import Dialog from '@/components/dialog/index.vue'
-import { usePublic, showTimeMsg } from './hooks/usePublic'
+import { usePublic, showTimeMsg, parseDate } from './hooks/usePublic'
 // import nodeCode from './hooks/nodeCode'
 import { parseTime, isValue } from '@/utils/validate'
 import * as _ from 'lodash'
@@ -533,12 +533,6 @@ const pubFunc = (listValues, target, type?) => {
   return newObj
 }
 
-const parseDate = (date: string) => {
-  const dates = date.split('-')
-  const newDate = dates.shift()
-  return dates.join('-')
-}
-
 // 特货分类统计-选取下拉数据
 const handleCommand = (command: string) => {
   specialGoods.value = command
@@ -566,10 +560,16 @@ const waybillTrendFunc = async () => {
     { flightDate1: waybillDates.startDate, flightDate2: waybillDates.endDate },
   ])) as any
   if (listValues && isValue(listValues)) {
-    listValues.forEach(item => {
-      item.jobTime = parseDate(item['jobTime'])
-    })
-    waybillTrendObj.value = pubFunc(listValues, optionLeft, true)
+    const dealedList = listValues.reduce((preList, currentValue) => {
+      if (typeof currentValue.jobTime === 'string') {
+        return [...preList, {
+          ...currentValue,
+          jobTime: parseDate(currentValue.jobTime)
+        }]
+      }
+      return preList
+    }, [])
+    waybillTrendObj.value = pubFunc(dealedList, optionLeft, true)
   }
   loading2.value = false
 }
@@ -705,11 +705,17 @@ const pickingFuncs = async () => {
   ])) as any
   if (listValues && isValue(listValues)) {
     const newObj: any = _.cloneDeep(airlineAbnormalBaggage.option.baseOption)
-    listValues.forEach(item => {
-      item.jobTime = parseDate(item['flightDate'])
-      item.weight = item['flightNum']
-    })
-    pickingObj.value = pubFunc(listValues, newObj)
+    const dealedList = listValues.reduce((preList, currentValue) => {
+      if (typeof currentValue.jobTime === 'string') {
+        return [...preList, {
+          ...currentValue,
+          jobTime: parseDate(currentValue.jobTime),
+          weight: currentValue.flightNum
+        }]
+      }
+      return preList
+    }, [])
+    pickingObj.value = pubFunc(dealedList, newObj)
   }
   loading8.value = false
 }