liwei19941102 il y a 2 ans
Parent
commit
49f7445658
1 fichiers modifiés avec 43 ajouts et 35 suppressions
  1. 43 35
      src/views/yunying/scheduling/index.vue

+ 43 - 35
src/views/yunying/scheduling/index.vue

@@ -72,7 +72,8 @@
                             </div>
                             </div>
                         </div>
                         </div>
                         <div style="position:absolute;bottom:10px;right:6px;font-size:10px">
                         <div style="position:absolute;bottom:10px;right:6px;font-size:10px">
-                            <span>客流:{{ gettotalpeople(item,11) }}人 </span> <span  style="margin-left: 10px;">乘客:{{ gettotalpeople(item,0) }}人 </span> <span style="margin-left: 10px;">货物:11个</span>
+                            <span>客流:{{ gettotalpeople(item, 11) }}人 </span> <span style="margin-left: 10px;">乘客:{{
+                                gettotalpeople(item, 0) }}人 </span> <span style="margin-left: 10px;">货物:11个</span>
                         </div>
                         </div>
                     </div>
                     </div>
                 </el-card>
                 </el-card>
@@ -136,18 +137,18 @@ const queryFormRef = ref<ElFormInstance>();
 const carInfoFormRef = ref<ElFormInstance>();
 const carInfoFormRef = ref<ElFormInstance>();
 
 
 
 
-const gettotalpeople = (item,type) => {
-  if (item.peoplecount != undefined && item.peoplecount != null) {
-      var totalpeople = item.peoplecount['total'];
-      if (type == 1) {
-        return totalpeople.totalin - totalpeople.totalout>0?totalpeople.totalin - totalpeople.totalout:0;
-      }
-      if (type == 0) {
-          return totalpeople.totalin;
-      }
+const gettotalpeople = (item, type) => {
+    if (item.peoplecount != undefined && item.peoplecount != null) {
+        var totalpeople = item.peoplecount['total'];
+        if (type == 1) {
+            return totalpeople.totalin - totalpeople.totalout > 0 ? totalpeople.totalin - totalpeople.totalout : 0;
+        }
+        if (type == 0) {
+            return totalpeople.totalin;
+        }
 
 
-  }
-  return 0;
+    }
+    return 0;
 }
 }
 
 
 const dialogMap = reactive<DialogOption>({
 const dialogMap = reactive<DialogOption>({
@@ -276,27 +277,34 @@ const getScheduleList = async () => {
         },
         },
         pageSize: "1000"
         pageSize: "1000"
     }
     }
+    carScheduleList.value = [];
     const res = await listCarSchedule(param);
     const res = await listCarSchedule(param);
-    carScheduleList.value = res.rows;
-    carScheduleList.value.map(i => {
-
-    if (i.ext1 != undefined && i.ext1 != null) {
-      var datajson = JSON.parse(i.ext1)
-      var times = Object.values(datajson).map(j => {
-        return j.intime + "|" + j.outtime
-      }).join("$");
-      times+="$"+i.scheduleDate+"|"+moment().format("YYYY-MM-DD HH:mm:ss")
-      getCountData({ "params[times]": `${times}` }).then(res1 => {
-        var pcount = {}
-        var index = 0;
-        Object.keys(datajson).map(j => {
-          pcount[j]=res1.data[index++]
-        })
-        pcount['total'] = res1.data[index]
-        i['peoplecount'] = pcount;
-      });
-    }
-  })
+    // carScheduleList.value = res.rows;
+    res.rows.map(i => {
+        var pathLine = JSON.parse(i.pathInfo).pathLine
+        var endTime = moment(date).format('YYYY-MM-DD') + ' ' + pathLine[pathLine.length - 1].planInTime
+        // console.log(new Date().getTime() )
+        // console.log(new Date(endTime).getTime())
+        if (new Date().getTime() < new Date(endTime).getTime()) {
+            if (i.ext1 != undefined && i.ext1 != null) {
+                var datajson = JSON.parse(i.ext1)
+                var times = Object.values(datajson).map(j => {
+                    return j.intime + "|" + j.outtime
+                }).join("$");
+                times += "$" + i.scheduleDate + "|" + moment().format("YYYY-MM-DD HH:mm:ss")
+                getCountData({ "params[times]": `${times}` }).then(res1 => {
+                    var pcount = {}
+                    var index = 0;
+                    Object.keys(datajson).map(j => {
+                        pcount[j] = res1.data[index++]
+                    })
+                    pcount['total'] = res1.data[index]
+                    i['peoplecount'] = pcount;
+                });
+            }
+            carScheduleList.value.push(i)
+        }
+    })
 
 
 
 
     reloadData.value = true
     reloadData.value = true
@@ -305,8 +313,8 @@ const getScheduleList = async () => {
 const getTimeFormat = (data) => {
 const getTimeFormat = (data) => {
     var value = JSON.parse(data).pathLine
     var value = JSON.parse(data).pathLine
     if (value.length > 0) {
     if (value.length > 0) {
-        if (value[0].planInTime && value[value.length -1].planInTime) {
-            return value[0].planInTime +'-'+value[value.length -1].planInTime
+        if (value[0].planInTime && value[value.length - 1].planInTime) {
+            return value[0].planInTime + '-' + value[value.length - 1].planInTime
         } else {
         } else {
             return "请填写路线时间"
             return "请填写路线时间"
         }
         }
@@ -317,7 +325,7 @@ const getTimeFormat = (data) => {
 
 
 const getAddr = (data) => {
 const getAddr = (data) => {
     var value = JSON.parse(data).pathLine
     var value = JSON.parse(data).pathLine
-    if(value.length > 0){
+    if (value.length > 0) {
         return value[0].stationName + '-' + value[value.length - 1].stationName
         return value[0].stationName + '-' + value[value.length - 1].stationName
     }
     }
 }
 }