瀏覽代碼

WMS-历史轨迹中修复部分数据显示不出来的BUG;增加温度&经纬度数据为空时的系统提示。

DongZ 1 年之前
父節點
當前提交
edb66732be
共有 1 個文件被更改,包括 19 次插入48 次删除
  1. 19 48
      src/views/WMS/historical-route/index.vue

+ 19 - 48
src/views/WMS/historical-route/index.vue

@@ -193,9 +193,8 @@
         this.carMessage.boxCode = this.$route.query.boxCode.split(',');
       }
       console.log(this.carMessage, 'this.carMessage')
-      // 所有数据的总集合
+      // 获取总数据
       this.merge(this.carMessage);
-      this.handleGeocodeRepo(this.carMessage);
     },
     methods: {
       //通过传参查询数据
@@ -624,52 +623,18 @@
         this.modelData1[0].startTime = array[0].hisDate;
         this.modelData1[0].endTime = array[array.length - 1].hisDate;
         this.tableData1 = this.modelData1;
-        //   let median = (array.length / 2).toFixed(0);
-        //   let table = []
-        //   for (let i = 0; i < median; i++) {
-        //     table[i] = {
-        //       measuringPointName: '',
-        //       measuringPointAddr: '',
-        //       temperature: '',
-        //       hisDate: '',
-        //       measuringPointName1: '',
-        //       measuringPointAddr1: '',
-        //       temperature1: '',
-        //       hisDate1: ''
-        //     }
-        //   }
-        //   if (array.length % 2 == 0) {
-        //     for (let i = 0, j = 0, z = 1; i < median; i++, j = j + 2, z = z + 2) {
-        //       table[i].measuringPointName = array[j].measuringPointName;
-        //       table[i].measuringPointAddr = array[j].measuringPointAddr;
-        //       table[i].temperature = array[j].temperature;
-        //       table[i].hisDate = array[j].hisDate;
-        //       table[i].measuringPointName1 = array[z].measuringPointName;
-        //       table[i].measuringPointAddr1 = array[z].measuringPointAddr;
-        //       table[i].temperature1 = array[z].temperature;
-        //       table[i].hisDate1 = array[z].hisDate;
-        //     }
-        //   } else {
-        //     for (let i = 0, j = 0, z = 1; i < median; i++, j = j + 2, z = z + 2) {
-        //       table[i].measuringPointName = array[j].measuringPointName;
-        //       table[i].measuringPointAddr = array[j].measuringPointAddr;
-        //       table[i].temperature = array[j].temperature;
-        //       table[i].hisDate = array[j].hisDate;
-        //       if (i != median - 1) {
-        //         table[i].measuringPointName1 = array[z].measuringPointName;
-        //         table[i].measuringPointAddr1 = array[z].measuringPointAddr;
-        //         table[i].temperature1 = array[z].temperature;
-        //         table[i].hisDate1 = array[z].hisDate;
-        //       }
-        //     }
-        //   }
-        //   this.tableData2 = table;
       },
       merge(data) {
         historyApi.getMerge(data).then(res => {
           if (res.code == 200) {
             this.dataMerge = res.data;
             console.log(this.dataMerge, 'dataMerge')
+            if (res.data == undefined || res.data == null || res.data == '') {
+              this.$modal.msgError("温度&经纬度数据为空!");
+              return;
+            }
+            // 获取分组数据
+            this.handleGeocodeRepo(this.carMessage);
           }
         })
       },
@@ -686,20 +651,26 @@
             for (let j = 0; j < dataCar[i].length; j++) {
               if (j == differenceValueCar) {
                 for (let z = 0; z < differenceValueCar; z++) {
-                  dataCar[i][z].temperature1 = dataCar[i][j + z].temperature;
-                  dataCar[i][z].hisDate1 = dataCar[i][j + z].hisDate;
+                  if (j + z < dataCar[i].length) {
+                    dataCar[i][z].temperature1 = dataCar[i][j + z].temperature;
+                    dataCar[i][z].hisDate1 = dataCar[i][j + z].hisDate;
+                  }
                 }
               }
               if (j == differenceValueCar * 2) {
                 for (let z = 0; z < differenceValueCar; z++) {
-                  dataCar[i][z].temperature2 = dataCar[i][j + z].temperature;
-                  dataCar[i][z].hisDate2 = dataCar[i][j + z].hisDate;
+                  if (j + z < dataCar[i].length) {
+                    dataCar[i][z].temperature2 = dataCar[i][j + z].temperature;
+                    dataCar[i][z].hisDate2 = dataCar[i][j + z].hisDate;
+                  }
                 }
               }
               if (j == differenceValueCar * 3) {
                 for (let z = 0; z < differenceValueCar; z++) {
-                  dataCar[i][z].temperature3 = dataCar[i][j + z].temperature;
-                  dataCar[i][z].hisDate3 = dataCar[i][j + z].hisDate;
+                  if (j + z < dataCar[i].length) {
+                    dataCar[i][z].temperature3 = dataCar[i][j + z].temperature;
+                    dataCar[i][z].hisDate3 = dataCar[i][j + z].hisDate;
+                  }
                 }
               }
               if (j == differenceValueCar * 4) {