From 63c0ecf98f3705b4c70e4bafee5f325966a5777b Mon Sep 17 00:00:00 2001
From: guoshipeng <3194674006@qq.com>
Date: Thu, 06 Jul 2023 09:13:54 +0800
Subject: [PATCH] 提交

---
 src/views/car/index.vue |  283 +++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 207 insertions(+), 76 deletions(-)

diff --git a/src/views/car/index.vue b/src/views/car/index.vue
index a423c11..72e4832 100644
--- a/src/views/car/index.vue
+++ b/src/views/car/index.vue
@@ -118,6 +118,14 @@
             @click="insertL"
             >������</el-button
           >
+          <el-input
+            placeholder="���������������"
+            v-model="inputnum"
+            class="inputNum"
+            clearable
+          >
+          </el-input>
+
           <div class="insLu">
             <el-upload
               class="upload-demo"
@@ -136,7 +144,7 @@
                 ������������������������(���������������)
               </div>
             </el-upload>
-            <div style="display: flex">
+            <!-- <div style="display: flex">
               <span class="statspan">������������������:</span
               ><el-input v-model="startL" style="width: 12rem"></el-input>
             </div>
@@ -154,6 +162,30 @@
             <div style="display: flex; margin-left: 4rem">
               <el-button type="primary" @click="insLuDuan">������</el-button>
               <el-button @click="insqu">������</el-button>
+              <el-button @click="qnull">������</el-button>
+            </div> -->
+            <el-table :data="tableData" style="width: 100%">
+              <el-table-column label="������������" width="180">
+                <template slot-scope="scope">
+                  <span style="margin-left: 10px">{{ scope.row.start }}</span>
+                </template>
+              </el-table-column>
+              <el-table-column label="������������" width="180">
+                <template slot-scope="scope">
+                  <span style="margin-left: 10px">{{ scope.row.end }}</span>
+                </template>
+              </el-table-column>
+            </el-table>
+            <div style="display: flex">
+              <span class="statspan">������������:</span
+              ><el-input
+                v-model="Lname"
+                style="width: 12rem; margin-left: 1.7rem"
+              ></el-input>
+            </div>
+            <div style="display: flex; margin-left: 4rem">
+              <el-button type="primary" @click="insLuDuan">������</el-button>
+              <el-button @click="insqu">������</el-button>
               <el-button @click="qnull">������</el-button>
             </div>
           </div>
@@ -464,6 +496,8 @@
   components: { index },
   data() {
     return {
+      inputnum: 0,
+      tableData: [],
       fileList: [],
       file: '',
       insdialogVisible: false,
@@ -593,42 +627,42 @@
         {
           sensorName: 'SO2',
           unit: 'ug/m��',
-          tab1: '50',
-          tab2: '150',
-          tab3: '475',
+          tab1: '150',
+          tab2: '500',
+          tab3: '650',
           tab4: '800',
-          tab5: '1600',
-          tab6: '2100',
+          tab5: '',
+          tab6: '',
         },
         {
           sensorName: 'NO2',
           unit: 'ug/m��',
-          tab1: '40',
-          tab2: '80',
-          tab3: '180',
-          tab4: '280',
-          tab5: '565',
-          tab6: '750',
+          tab1: '100',
+          tab2: '200',
+          tab3: '700',
+          tab4: '1200',
+          tab5: '2340',
+          tab6: '3090',
         },
         {
           sensorName: 'CO',
           unit: 'mg/m��',
-          tab1: '2',
-          tab2: '4',
-          tab3: '14',
-          tab4: '24',
-          tab5: '36',
-          tab6: '48',
+          tab1: '5',
+          tab2: '10',
+          tab3: '35',
+          tab4: '60',
+          tab5: '90',
+          tab6: '120',
         },
         {
           sensorName: 'O3',
           unit: 'ug/m��',
-          tab1: '100',
-          tab2: '160',
-          tab3: '215',
-          tab4: '265',
+          tab1: '160',
+          tab2: '200',
+          tab3: '300',
+          tab4: '400',
           tab5: '800',
-          tab6: '800',
+          tab6: '1000',
         },
         {
           sensorName: 'TVOC',
@@ -688,6 +722,7 @@
       endTime: '',
       dataDate: '',
       sensorTime: [],
+      Lu: [],
       startL: '',
       Lname: '',
       endL: '',
@@ -762,34 +797,66 @@
       // console.log(file, fileList)
     },
     handleChange(file, fileList) {
-      this.file = file
-      console.log(this.file.raw)
-      this.fileList = fileList
+      var str = file.name //���������4���
+      let a = str.substring(str.length - 3)
+      // console.log(a)
+      if (a === 'png') {
+        this.file = file.raw
+        console.log(this.file.raw)
+        this.fileList = fileList
+      } else {
+        this.$message('���������png���������������')
+      }
+      // console.log(file.name, 'file')
     },
     insLuDuan() {
-      if (this.startL == '') {
-        this.$message({
-          message: '���������������������',
-          type: 'warning',
-        })
-        return false
-      } else if (this.endL == '') {
-        this.$message({
-          message: '���������������������',
-          type: 'warning',
-        })
-        return false
-      } else if (this.Lname == '') {
+      // if (this.startL == '') {
+      //   this.$message({
+      //     message: '���������������������',
+      //     type: 'warning',
+      //   })
+      //   return false
+      // } else if (this.endL == '') {
+      //   this.$message({
+      //     message: '���������������������',
+      //     type: 'warning',
+      //   })
+      //   return false
+      // } else
+      if (this.Lname == '') {
         this.$message({
           message: '������������������',
           type: 'warning',
         })
         return false
       }
+      if (this.tableData.length === 0) {
+        this.$message({
+          message: '���������������',
+          type: 'warning',
+        })
+        // console.log(1);
+        return false
+      }
+      // console.log(this.tableData);
       var times = this.newTime2(this.dateValue)
       const formData = new FormData()
-      formData.append(`time1`, this.startL)
-      formData.append(`time2`, this.endL)
+      let pv = JSON.stringify(this.tableData)
+      // let big = {
+      //   table: pv,
+      //   road: this.Lname,
+      //   time3: times[0],
+      //   time4: times[1],
+      //   mac: this.carMac,
+      //   files: this.file,
+      // }
+      // console.log(big)
+
+      // console.log(pv);
+      // formData.append(`time1`, this.startL)
+      // formData.append(`time2`, this.endL)
+
+      formData.append(`table`, pv)
       formData.append(`road`, this.Lname)
       formData.append(`time3`, times[0])
       formData.append(`time4`, times[1])
@@ -809,8 +876,7 @@
             message: '������������������',
             type: 'success',
           })
-          this.startL = ''
-          this.endL = ''
+          this.tableData = []
           this.Lname = ''
         }
       })
@@ -825,8 +891,9 @@
       this.qnull()
     },
     qnull() {
-      this.startL = ''
-      this.endL = ''
+      // this.startL = ''
+      // this.endL = ''
+      this.tableData = []
       this.Lname = ''
     },
     // ������������������
@@ -869,7 +936,7 @@
         },
         query: {
           monitorPointInfo: JSON.stringify(item),
-          device: items,
+          device: JSON.stringify(items),
           macName: mac,
           indexs: indexs,
           items: [items.latitude, items.longitude],
@@ -1084,15 +1151,18 @@
       }
 
       this.$request({
-        url: '/cruiser/cruiserTrajectory',
+        // url: '/cruiser/cruiserTrajectory',
+        url: '/cruiser/carTrajectoryNewAvg',
         method: 'get',
         params: {
           mac: this.carMac,
           time1: this.sensorDate[0],
           time2: this.sensorDate[1],
+          type: this.sensorKey,
+          range: this.inputnum,
         },
       }).then((res) => {
-        console.log(res)
+        // console.log(res)
         if (!res.data.length) {
           this.noneData = true
           this.loading = false
@@ -1105,6 +1175,7 @@
     },
     // ������������������������
     initStart(res) {
+      // console.log(res.data, 'res.data')
       this.abc += 1
       const that = this
       if (!res) {
@@ -1123,14 +1194,20 @@
       if (this.responseJSON.length > 0) {
         this.noneData = false
         $.each(this.responseJSON, (item, value) => {
+          // console.log(value, 'value')
           if (typeof value.flylon === 'undefined') {
             showNoPoints()
           } else {
+            // console.log(value.flylon.toString().length, 'value.flylon.length')
             var lng = parseFloat(
-              value.flylon.substr(0, value.flylon.length - 1)
+              value.flylon
+                .toString()
+                .substr(0, value.flylon.toString().length - 1)
             )
             var lat = parseFloat(
-              value.flylat.substr(0, value.flylat.length - 1)
+              value.flylat
+                .toString()
+                .substr(0, value.flylat.toString().length - 1)
             )
             if (lng < 70 || lng > 150 || lat > 60 || lat < 20) {
               return true
@@ -1183,17 +1260,35 @@
               point.a21005 = parseFloat(value.a21005).toFixed(3)
               point.a05024 = parseInt(value.a05024)
               point.a99054 = parseFloat(value.a99054).toFixed(3)
-              if (
-                value.dustld - 0 !== 0 &&
-                value.dustld - 0 < 100 &&
-                (that.carMac === 'p5dnd7a0243622' ||
-                  that.carMac === 'p5dnd7a0243625')
-              ) {
-                point.dustld = 100
-              } else {
-                point.dustld = value.dustld - 0
-              }
+              //   if (
+              //     value.dustld - 0 !== 0 &&
+              //     value.dustld - 0 < 150 &&
+              //     (that.carMac === 'p5dnd7a0243622' ||
+              //       that.carMac === 'p5dnd7a0243625')
+              //   ) {
+              //     point.dustld = 200
+              //   } else if (
+              //     value.dustld - 0 !== 0 &&
+              //     value.dustld - 0 >= 150 &&
+              //     value.dustld - 0 <= 180 &&
+              //     (that.carMac === 'p5dnd7a0243622' ||
+              //       that.carMac === 'p5dnd7a0243625')
+              //   ) {
+              //     point.dustld = 220
+              //   } else if (
+              //     value.dustld - 0 !== 0 &&
+              //     value.dustld - 0 > 180 &&
+              //     value.dustld - 0 <= 200 &&
+              //     (that.carMac === 'p5dnd7a0243622' ||
+              //       that.carMac === 'p5dnd7a0243625')
+              //   ) {
+              //     point.dustld = 230
+              //   } else {
+              //     point.dustld = value.dustld - 0
+              //   }
             }
+            point.dustld = value.dustld - 0
+            point.times = value.time
             trackPoints.push(point)
           }
         })
@@ -1350,18 +1445,21 @@
         var points = []
         points.push(trackPoints[0])
         for (var i = 1; i < trackPoints.length; i++) {
-          var flag = true
+          // var flag = true
           var point1 = trackPoints[i]
-          for (var j = 0; j < points.length; j++) {
-            var point2 = points[j]
-            var dis = that.map.getDistance(point1, point2) // ������������������������������������������������
-            if (dis < size) {
-              flag = false
-            }
-          }
-          if (flag) {
-            points.push(point1)
-          }
+          // for (var j = 0; j < points.length; j++) {
+          //   var point2 = points[j]
+          //   var dis = that.map.getDistance(point1, point2) // ������������������������������������������������
+          //   if (dis < size) {
+          //     flag = false
+          //   }
+          // }
+          // points.push(point1)
+          // console.log(points,'num');
+          // if (flag) {
+          points.push(point1)
+          // console.log(points, 'num')
+          // }
         }
 
         return points
@@ -1748,22 +1846,50 @@
           fontWeight: 'bold',
         }
         label.addEventListener('click', (e) => {
-          console.log(e)
+          // console.log(e)
           // var ps = e.target.latLng.lat
           // var ps1 = e.target.latLng.lng
           // var p1 = new BMap.Point(ps1, ps);
           // var marker = new BMap.Marker(p1);;
           // that.map.addOverlay(marker);
           var times = e.target.domElement.children[0].getAttribute('data-times')
-          console.log(times)
+          // console.log(times)
           if (that.startL == '') {
             that.startL = times
+            // that.Lu.startLu.push(that.startL)
+            // console.log(that.Lu.startLu, 'start')
           } else {
+            // that.tableData=[]
             that.endL = times
+            comparedate(that.startL, that.endL)
+            // var endLu = []
+            // that.Lu.endLu.push(that.endL)
+            // console.log(that.Lu.endLu, 'end')
+            // that.startL = ''
+            // that.endL = ''
+            // that.tableData.push(that.Lu)
+            // console.log(that.tableData, 'table')
           }
         })
         label.setStyle(labelStyle)
         that.map.addOverlay(label)
+      }
+      //���������������������������
+      function comparedate(date1, date2) {
+        let oDate1 = new Date(date1)
+        let oDate2 = new Date(date2)
+        if (oDate1.getTime() > oDate2.getTime()) {
+          that.startL = ''
+          that.endL = ''
+          that.$message('���������������������������������������������������')
+          return false
+        } else if (oDate1.getTime() < oDate2.getTime()) {
+          var cardNumObj = { start: that.startL, end: that.endL }
+          that.tableData.push(cardNumObj)
+          console.log(that.tableData, 'that.tableData')
+          that.startL = ''
+          that.endL = ''
+        }
       }
 
       // ������������,������������������
@@ -1853,7 +1979,10 @@
           // this.bg = require('@/assets/images/tl_TVOCNew.png')
           break
       }
-      this.initStart(this.carData)
+      this.$nextTick(()=>{
+        this.getStart()
+      })
+      this.initStart();
     },
     changeCode1(index) {
       this.changeColor1 = index
@@ -2047,7 +2176,7 @@
   border: 1px solid white;
   background-color: white;
   width: 20rem;
-  height: 23rem;
+  height: 30rem;
   position: absolute;
   top: 3rem;
   left: 1rem;
@@ -2062,5 +2191,7 @@
 .insLu div {
   margin-top: 0.8rem;
 }
+/deep/.inputNum {
+  width: 5% !important;
+}
 </style>
-  
\ No newline at end of file

--
Gitblit v1.8.0