Browse Source

设备管理

bls-dan 2 years ago
parent
commit
1f216e5ecf
1 changed files with 26 additions and 1 deletions
  1. 26 1
      src/pages/views/home/index.vue

+ 26 - 1
src/pages/views/home/index.vue

@@ -13,11 +13,13 @@ import HomeService from './services/homepage.service'
 import CehicleOperationService from './services/cehicleOperation.service'
 import MaintenanceDynamicsService from './services/maintenanceDynamics.Service'
 import PassengerFlowService from './services/passengerFlow.service'
+import FacilityManagementService from './services/facilityManagement.service'
 
 const homeService = new HomeService()
 const cehicleOperationService = new CehicleOperationService()
 const passengerFlowService = new PassengerFlowService()
 const maintenanceDynamicsService = new MaintenanceDynamicsService()
+const facilityManagementService = new FacilityManagementService()
 
 const store = useStore()
 const menus = [
@@ -323,7 +325,7 @@ const menus = [
     }
   }
 ]
-const active = ref(3)
+const active = ref(4)
 const currentComponent = ref(menus[active.value].component)
 const weather = computed(() => store.weather)
 const warningMsg = ref({
@@ -391,6 +393,29 @@ async function getMaintenanceInfo() {
   menus[3].count[3].value = res.repaired
 }
 getMaintenanceInfo()
+
+async function getFacilityStatistics() {
+  const res = await facilityManagementService.getFacilityStatistics()
+  let vehicleNumTotal = 0
+  let stationNumTotal = 0
+  let carWasherNumTotal = 0
+  let chargingStationNumTotal = 0
+  let vehicleComponentsNumTotal = 0
+  for (let i = 0; i < res.length; i++) {
+    const item = res[i]
+    vehicleNumTotal += +item.vehicleNum
+    stationNumTotal += +item.stationNum
+    carWasherNumTotal += +item.carWasherNum
+    chargingStationNumTotal += +item.chargingStationNum
+    vehicleComponentsNumTotal += +item.vehicleComponentsNum
+  }
+  menus[4].count[0].value = vehicleNumTotal
+  menus[4].count[1].value = stationNumTotal
+  menus[4].count[2].value = carWasherNumTotal
+  menus[4].count[3].value = chargingStationNumTotal
+  menus[4].count[4].value = vehicleComponentsNumTotal
+}
+getFacilityStatistics()
 </script>
 <template>
   <div class="home">