liwei19941102 пре 2 година
родитељ
комит
14fda0cc74
1 измењених фајлова са 74 додато и 6 уклоњено
  1. 74 6
      src/views/statics/passengerFlow.vue

+ 74 - 6
src/views/statics/passengerFlow.vue

@@ -32,7 +32,7 @@
                                     <el-button type="primary" plain @click="resetQuery">昨天</el-button>
                                     <el-button type="primary" plain @click="resetQuery">近三天</el-button> -->
                                     <el-button type="primary" @click="searchCar">查询</el-button>
-                                    <el-button @click="resetQuery">重置</el-button>
+                                    <!-- <el-button @click="resetQuery">重置</el-button> -->
                                 </el-form-item>
                             </div>
                         </div>
@@ -72,8 +72,8 @@
                                     <!-- <el-button type="primary" plain @click="goadd">今天</el-button>
                                     <el-button type="primary" plain @click="resetQuery">昨天</el-button>
                                     <el-button type="primary" plain @click="resetQuery">近三天</el-button> -->
-                                    <el-button type="primary" @click="goadd">查询</el-button>
-                                    <el-button @click="resetQuery">重置</el-button>
+                                    <el-button type="primary" @click="searchSite">查询</el-button>
+                                    <!-- <el-button @click="resetQuery">重置</el-button> -->
                                 </el-form-item>
                             </div>
                         </div>
@@ -89,8 +89,10 @@
 
 <script setup name="CarInfo" lang="ts">
 import { listCarInfo, getCarInfo, delCarInfo, addCarInfo, updateCarInfo } from '@/api/carInfo';
+import { listCarSchedule, getCarSchedule, delCarSchedule, addCarSchedule, updateCarSchedule } from '@/api/carSchedule';
 import { CarInfoVO, CarInfoQuery, CarInfoForm } from '@/api/carInfo/types';
 import { listCarPath, getCarPath, delCarPath, addCarPath, updateCarPath } from '@/api/carPath';
+
 import { getCountData } from '@/api/gpsData';
 import tableElm from "@/components/Public/table.vue";
 import { useRoute, useRouter } from "vue-router";
@@ -114,6 +116,7 @@ const carPathList = ref([])
 
 const queryFormRef = ref<ElFormInstance>();
 const carInfoFormRef = ref<ElFormInstance>();
+const siteFlowList = ref([])
 
 const dataValue = ref<[Date, Date]>([
     new Date(new Date().getTime() - 3600 * 24 * 1000),
@@ -404,17 +407,39 @@ const initData = async () => {
     carPathList.value = res.rows
     const res2 = await listCarInfo({ pageSize: 1000 });
     carInfoList.value = res2.rows
+    var params = {
+        starttime:moment(dataValue2.value[0]).format("YYYY-MM-DD HH:mm:ss"),
+        endtime:moment(dataValue2.value[1]).format("YYYY-MM-DD HH:mm:ss")
+    }
+    const res3 = await listCarSchedule({ pageSize: 1000 ,params:params})
     carFlowList.value = [];
+    siteFlowList.value = [];
     for (var index in carInfoList.value) {
         if (carInfoList.value[index].deviceInfos != null) {
-            var deviceCode = JSON.parse(carInfoList.value[index].deviceInfos).code
+            var deviceCode = JSON.parse(carInfoList.value[index].deviceInfos)[0].code
+            console.log(deviceCode)
             await getFlowData(deviceCode,carInfoList.value[index].carNum)
         }
         //getFlowData();
     }
-    table1.value.setButton([]);
+    for(var index in res3.data){
+        if(res3.data[index].ext1 != null){
+            var siteList = JSON.parse(res3.data[index].ext1)
+            var gpsCode = ''
+            for(var j in carInfoList.value){
+                 if(carInfoList.value[j].carNum == res3.data[index]){
+                    gpsCode = JSON.parse(carInfoList.value[index].deviceInfos)[0].code
+                 }
+            }
+            for(var key in siteList){
+                var obj = siteList[key]
+                 await getSiteData(key,gpsCode,obj.intime,obj.outtime);
+            }
+        }
+    }
+    table2.value.setButton([]);
     // console.log(carFlowList.value)
-    table1.value.setDataList(carFlowList.value);
+    table2.value.setDataList(siteFlowList.value);
 }
 
 const searchCar = async() =>{
@@ -431,6 +456,32 @@ const searchCar = async() =>{
     table1.value.setDataList(carFlowList.value);
 }
 
+const searchSite = async() =>{
+    var params = {
+        starttime:moment(dataValue2.value[0]).format("YYYY-MM-DD HH:mm:ss"),
+        endtime:moment(dataValue2.value[1]).format("YYYY-MM-DD HH:mm:ss")
+    }
+    const res3 = await listCarSchedule({ pageSize: 1000 ,params:params})
+    for(var index in res3.data){
+        if(res3.data[index].ext1 != null){
+            var siteList = JSON.parse(res3.data[index].ext1)
+            var gpsCode = ''
+            for(var j in carInfoList.value){
+                 if(carInfoList.value[j].carNum == res3.data[index]){
+                    gpsCode = JSON.parse(carInfoList.value[index].deviceInfos)[0].code
+                 }
+            }
+            for(var key in siteList){
+                var obj = siteList[key]
+                 await getSiteData(key,gpsCode,obj.intime,obj.outtime);
+            }
+        }
+    }
+    table2.value.setButton([]);
+    // console.log(carFlowList.value)
+    table2.value.setDataList(siteFlowList.value);
+}
+
 const getFlowData = (carCode,carNum) => {
     var obj = {
         starttime: moment(dataValue.value[0]).format('YYYY-MM-DD'),
@@ -448,6 +499,23 @@ const getFlowData = (carCode,carNum) => {
     })
 }
 
+const getSiteData = (carCode,siteName,startTime,endTime) => {
+    var obj = {
+        starttime: startTime,
+        endtime: endTime
+    }
+    getCountData({ devicecode: carCode, params: obj }).then(res => {
+        var data = {
+            siteName: siteName,
+            startTime: moment(dataValue.value[0]).format('YYYY-MM-DD'),
+            endTime: moment(dataValue.value[1]).format('YYYY-MM-DD'),
+            upCount: res.data.totalin,
+            downCount: res.data.totalout
+        }
+        siteFlowList.value.push(data);
+    })
+}
+
 const getStationData = (carCode,siteName) => {
     var obj = {
         starttime: moment(dataValue.value[0]).format('YYYY-MM-DD'),