Browse Source

维保动态接入数据

bls-dan 2 years ago
parent
commit
0ed7af0d99

+ 1 - 0
package.json

@@ -10,6 +10,7 @@
   },
   },
   "dependencies": {
   "dependencies": {
     "@amap/amap-jsapi-loader": "^1.0.1",
     "@amap/amap-jsapi-loader": "^1.0.1",
+    "date-fns": "^3.3.1",
     "echarts": "^5.4.3",
     "echarts": "^5.4.3",
     "naive-ui": "^2.36.0",
     "naive-ui": "^2.36.0",
     "pinia": "^2.1.7",
     "pinia": "^2.1.7",

+ 0 - 2
src/pages/views/home/components/HomePage.vue

@@ -1101,8 +1101,6 @@ async function getClassesPunctualityRate() {
   const yesterdayData = data.filter((item: { type: number }) => item.type === 0)
   const yesterdayData = data.filter((item: { type: number }) => item.type === 0)
   rightContent.value[2].content[1][0].body = todayData
   rightContent.value[2].content[1][0].body = todayData
   rightContent.value[2].content[1][1].body = yesterdayData
   rightContent.value[2].content[1][1].body = yesterdayData
-
-  console.log(data, 'data')
 }
 }
 getClassesPunctualityRate()
 getClassesPunctualityRate()
 
 

+ 19 - 8
src/pages/views/home/components/MaintenanceDynamics.vue

@@ -83,7 +83,6 @@
             :height="408"
             :height="408"
             :name="item.name"
             :name="item.name"
           >
           >
-            1111
             <Echart :option="item.option" />
             <Echart :option="item.option" />
           </Box>
           </Box>
         </template>
         </template>
@@ -125,7 +124,7 @@
           <div class="checkup">
           <div class="checkup">
             <div class="total">
             <div class="total">
               <div class="num">
               <div class="num">
-                40
+                {{ checkupProblemTotal }}
               </div>
               </div>
               <div style="font-size: 24px;">
               <div style="font-size: 24px;">
                 总量
                 总量
@@ -133,15 +132,15 @@
             </div>
             </div>
             <div class="list">
             <div class="list">
               <div
               <div
-                v-for="item in 4"
-                :key="item"
+                v-for="item,index in checkupProblem"
+                :key="index"
                 class="item"
                 class="item"
               >
               >
                 <div class="num">
                 <div class="num">
-                  10
+                  {{ item.number }}
                 </div>
                 </div>
                 <div class="label">
                 <div class="label">
-                  三电故障
+                  {{ item.problemType }}
                 </div>
                 </div>
               </div>
               </div>
             </div>
             </div>
@@ -168,7 +167,7 @@ import {
   Ref, onMounted, ref, watch
   Ref, onMounted, ref, watch
 } from 'vue'
 } from 'vue'
 import Echart from '@/components/chart.vue'
 import Echart from '@/components/chart.vue'
-import MaintenanceDynamicsService from '../services/maintenanceDynamicsService'
+import MaintenanceDynamicsService from '../services/maintenanceDynamics.Service'
 import { format, subDays } from 'date-fns'
 import { format, subDays } from 'date-fns'
 
 
 const leftContent:Ref<any> = ref({
 const leftContent:Ref<any> = ref({
@@ -608,6 +607,9 @@ const rightContent = ref({
   }
   }
 })
 })
 
 
+const checkupProblem = ref([] as any[])
+const checkupProblemTotal = ref(0)
+
 const maintenanceDynamicsService = new MaintenanceDynamicsService()
 const maintenanceDynamicsService = new MaintenanceDynamicsService()
 
 
 async function getMaintenanceCarStatus() {
 async function getMaintenanceCarStatus() {
@@ -666,6 +668,15 @@ async function getMaintenanceStatistics(type: number) {
   leftContent.value.top[1].option.series.data = carNumberData
   leftContent.value.top[1].option.series.data = carNumberData
 }
 }
 
 
+async function getMaintenanceCheckupProblem() {
+  const res = await maintenanceDynamicsService.getMaintenanceCheckupProblem()
+  checkupProblem.value = res
+  checkupProblemTotal.value = res.reduce((prev: any, item: { number: number }) => {
+    prev += item.number
+    return prev
+  }, 0)
+}
+getMaintenanceCheckupProblem()
 async function getBusLineDetailAll() {
 async function getBusLineDetailAll() {
   const res = await maintenanceDynamicsService.getBusLineDetailAll()
   const res = await maintenanceDynamicsService.getBusLineDetailAll()
   leftContent.value.top[0].num = `${res.reduce((prev: any, item: { totalCar: number }) => {
   leftContent.value.top[0].num = `${res.reduce((prev: any, item: { totalCar: number }) => {
@@ -678,7 +689,7 @@ async function getMaintenanceDetail() {
   const { range } = leftContent.value.bottom
   const { range } = leftContent.value.bottom
   const params = {
   const params = {
     startTime: format(range[0], 'yyyy-MM-dd HH:mm:ss'),
     startTime: format(range[0], 'yyyy-MM-dd HH:mm:ss'),
-    endTime: range[1]
+    endTime: format(range[1], 'yyyy-MM-dd HH:mm:ss')
   }
   }
   const res = await maintenanceDynamicsService.getMaintenanceDetail(params)
   const res = await maintenanceDynamicsService.getMaintenanceDetail(params)
   console.log(res, 'res')
   console.log(res, 'res')

+ 27 - 2
src/pages/views/home/index.vue

@@ -11,9 +11,13 @@ import Map from '@/components/map/map.vue'
 import useStore from '@/pages/store'
 import useStore from '@/pages/store'
 import HomeService from './services/homepage.service'
 import HomeService from './services/homepage.service'
 import CehicleOperationService from './services/cehicleOperation.service'
 import CehicleOperationService from './services/cehicleOperation.service'
+import MaintenanceDynamicsService from './services/maintenanceDynamics.Service'
+import PassengerFlowService from './services/passengerFlow.service'
 
 
 const homeService = new HomeService()
 const homeService = new HomeService()
 const cehicleOperationService = new CehicleOperationService()
 const cehicleOperationService = new CehicleOperationService()
+const passengerFlowService = new PassengerFlowService()
+const maintenanceDynamicsService = new MaintenanceDynamicsService()
 
 
 const store = useStore()
 const store = useStore()
 const menus = [
 const menus = [
@@ -135,7 +139,7 @@ const menus = [
       },
       },
       { label: '满载率', value: 14, util: '%' },
       { label: '满载率', value: 14, util: '%' },
       {
       {
-        label: '免费换', value: 8, util: '万人次', style: { right: '-40px' }
+        label: '免费换', value: 8, util: '万人次', style: { right: '-40px' }
       },
       },
       { label: '分担率 ', value: 0, util: '%' },
       { label: '分担率 ', value: 0, util: '%' },
       { label: '平均乘距', value: 1400, util: 'km' }
       { label: '平均乘距', value: 1400, util: 'km' }
@@ -319,7 +323,7 @@ const menus = [
     }
     }
   }
   }
 ]
 ]
-const active = ref(0)
+const active = ref(3)
 const currentComponent = ref(menus[active.value].component)
 const currentComponent = ref(menus[active.value].component)
 const weather = computed(() => store.weather)
 const weather = computed(() => store.weather)
 const warningMsg = ref({
 const warningMsg = ref({
@@ -366,6 +370,27 @@ async function getBusLineStatistics() {
   menus[1].count[6].value = res.unloadedRatio
   menus[1].count[6].value = res.unloadedRatio
 }
 }
 getBusLineStatistics()
 getBusLineStatistics()
+
+async function getTrafficAnalysis() {
+  const res = await passengerFlowService.getTrafficAnalysis()
+
+  menus[2].count[0].value = res.trafficVolume
+  menus[2].count[1].value = res.fullLoad
+  menus[2].count[2].value = res.freeTransfer
+  menus[2].count[3].value = res.shareRate
+  menus[2].count[4].value = res.avgRidingDistance
+  console.log('getTrafficAnalysis')
+}
+getTrafficAnalysis()
+
+async function getMaintenanceInfo() {
+  const res = await maintenanceDynamicsService.getMaintenanceInfo()
+  menus[3].count[0].value = res.maintenanceSite
+  menus[3].count[1].value = res.maintenanceStation
+  menus[3].count[2].value = res.maintained
+  menus[3].count[3].value = res.repaired
+}
+getMaintenanceInfo()
 </script>
 </script>
 <template>
 <template>
   <div class="home">
   <div class="home">

+ 19 - 1
src/pages/views/home/services/maintenanceDynamicsService.ts → src/pages/views/home/services/maintenanceDynamics.Service.ts

@@ -77,7 +77,7 @@ export default class MaintenanceDynamicsService extends Service {
     return []
     return []
   }
   }
 
 
-  /** 获取所有线路  /maintenance/getMaintenanceDetail  */
+  /** 维保明细  /maintenance/getMaintenanceDetail  */
   async getMaintenanceDetail(params: any) {
   async getMaintenanceDetail(params: any) {
     const { startTime, endTime } = params
     const { startTime, endTime } = params
     const { success, data } = await this.netService.get(`/maintenance/getMaintenanceDetail?startTime=${startTime}&endTime=${endTime}`)
     const { success, data } = await this.netService.get(`/maintenance/getMaintenanceDetail?startTime=${startTime}&endTime=${endTime}`)
@@ -86,4 +86,22 @@ export default class MaintenanceDynamicsService extends Service {
     }
     }
     return []
     return []
   }
   }
+
+  /** 体检问题情况  /maintenance/getMaintenanceCheckupProblem  */
+  async getMaintenanceCheckupProblem() {
+    const { success, data } = await this.netService.get('/maintenance/getMaintenanceCheckupProblem')
+    if (success) {
+      return data || []
+    }
+    return []
+  }
+
+  /** 维保地图信息配置  /maintenance/getMaintenanceInfo  */
+  async getMaintenanceInfo() {
+    const { success, data } = await this.netService.get('/maintenance/getMaintenanceInfo')
+    if (success) {
+      return data || {}
+    }
+    return {}
+  }
 }
 }

+ 9 - 0
src/pages/views/home/services/passengerFlow.service.ts

@@ -67,4 +67,13 @@ export default class PassengerFlowService extends Service {
     }
     }
     return []
     return []
   }
   }
+
+  /** 客流分析地图  /trafficAnalysis/getTrafficAnalysis   */
+  async getTrafficAnalysis() {
+    const { success, data } = await this.netService.get('/trafficAnalysis/getTrafficAnalysis')
+    if (success) {
+      return data[0] || {}
+    }
+    return {}
+  }
 }
 }