From 4e15972e4db30f68e4ea74759fd04f00e6e44be2 Mon Sep 17 00:00:00 2001
From: yichenxi <yichenxi0601@163.com>
Date: Tue, 13 Dec 2022 11:21:23 +0800
Subject: [PATCH] 1、尘负荷走航路段报告

---
 src/utils/request.js              |    4 
 src/views/sectionReport/index.vue |   49 +++++++--------
 src/views/dailyreport/index.vue   |    1 
 src/views/car/index.vue           |  108 ++++++++++++++++++++++++++---------
 src/utils/exportLUImage.js        |    2 
 5 files changed, 105 insertions(+), 59 deletions(-)

diff --git a/src/utils/exportLUImage.js b/src/utils/exportLUImage.js
index 9a49281..f8e82be 100644
--- a/src/utils/exportLUImage.js
+++ b/src/utils/exportLUImage.js
@@ -23,7 +23,6 @@
       const images1 = {
         fileListOne: [],
         fileListTwo: [],
-        fileListThree: [],
         o3Map: [],
         o3Sence: [],
         pm10Map: [],
@@ -49,6 +48,7 @@
                 // images1.push({ [src]: base64 })
                 if (j === 0) {
                   images1.fileListOne.push({ src: base64 })
+                  // console.log(images1.fileListOne,'images1.fileListOne')
                 } else if (j === 1) {
                   images1.fileListTwo.push({ src: base64 })
                 } else if (j === 2) {
diff --git a/src/utils/request.js b/src/utils/request.js
index 0567b1c..1767476 100644
--- a/src/utils/request.js
+++ b/src/utils/request.js
@@ -2,7 +2,7 @@
 import { MessageBox, Message } from 'element-ui'
 import store from '@/store'
 import { getToken } from '@/utils/auth'
-const baseUrl = 'http://47.99.64.149:8081/'    
+// const baseUrl = 'http://47.99.64.149:8081/'    
 // const baseUrl = 'http://192.168.0.42:8081/' // lzj
 // const baseUrl = 'http://192.168.0.33:8081/' // yy
 // const baseUrl = 'http://192.168.0.25:8081' // jj
@@ -10,7 +10,7 @@
 // const baseUrl = 'http://192.168.0.33:8081/' // new swb
 // const baseUrl = 'http://121.43.179.139:8080'
 // const baseUrl = 'http://192.168.0.33:8085/'
-// const baseUrl = 'http://192.168.0.33:8081/'
+const baseUrl = 'http://192.168.0.33:8081/'
 
 // create an axios instance
 const service = axios.create({
diff --git a/src/views/car/index.vue b/src/views/car/index.vue
index 44c7651..46a9ab8 100644
--- a/src/views/car/index.vue
+++ b/src/views/car/index.vue
@@ -541,6 +541,29 @@
           }
         },
       },
+      timeOne: '',
+      threeOptions: {
+        onPick: ({ maxDate, minDate }) => {
+          // ������������ ������������
+          this.timeOne = minDate.getTime() // ��������������������� ������������������
+          // ������������������������������������������������������������
+          if (maxDate) this.timeOne = ''
+        },
+        disabledDate: (time) => {
+          if (this.timeOne) {
+            const WEEK = 3 * 24 * 3600 * 1000 - 1 // ������������3���������1��������� ������3���������
+            const minTime = this.timeOne // ������������
+            const maxTime = this.timeOne + WEEK // ������������
+            return (
+              time.getTime() < minTime ||
+              time.getTime() > maxTime ||
+              time.getTime() > new Date()
+            )
+          } else {
+            return time.getTime() > new Date()
+          }
+        },
+      },
       sensorDate: null,
       noneData: false,
       defaultData: [],
@@ -600,12 +623,12 @@
         {
           sensorName: 'O3',
           unit: 'ug/m��',
-          tab1: '160',
-          tab2: '200',
-          tab3: '300',
-          tab4: '400',
+          tab1: '100',
+          tab2: '160',
+          tab3: '215',
+          tab4: '265',
           tab5: '800',
-          tab6: '1000',
+          tab6: '800',
         },
         {
           sensorName: 'TVOC',
@@ -739,9 +762,17 @@
       // 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
+        console.log(this.file.raw)
+        this.fileList = fileList
+      }else{
+        this.$message('���������png���������������')
+      }
+      // console.log(file.name, 'file')
     },
     insLuDuan() {
       if (this.startL == '') {
@@ -791,6 +822,21 @@
           this.Lname = ''
         }
       })
+      // this.$request({
+      //   url:'',
+      //   method:'post',
+      //   data:{
+      //     starttime:this.startL,
+      //     endtime:this.endL,
+      //     name:this.Lname,
+      //     mac:this.carMac,
+      //     sTime:times[0],
+      //     eTime:times[1],
+      //     img:this.file.raw
+      //   }
+      // }).then((res)=>{
+      //   console.log(res);
+      // })
     },
 
     //������������
@@ -1122,20 +1168,32 @@
               timeArrSub[i] = v.split(' ')[0]
               if (i === 1) timeArrSub[2] = v.split(' ')[1]
             })
-            if (that.carMac === 'p5dnd7a0243626' && timeArrSub[0] === '2022-12-11' && (timeArrSub[1] === '2022-12-11' || timeArrSub[1] === '2022-12-12' && timeArrSub[2] === '00:00:00')) {
+            if (
+              that.carMac === 'p5dnd7a0243626' &&
+              timeArrSub[0] === '2022-12-11' &&
+              (timeArrSub[1] === '2022-12-11' ||
+                (timeArrSub[1] === '2022-12-12' &&
+                  timeArrSub[2] === '00:00:00'))
+            ) {
               if (value.a34004) point.a34004 = parseInt(value.a34004 * 2.7)
               if (value.a34002) point.a34002 = parseInt(value.a34002 * 2.2)
               if (value.a21026) point.a21026 = parseInt(value.a21026 - 0 + 5)
               if (value.a21004) point.a21004 = parseInt(value.a21004 - 20)
               // point.a21004 = parseInt(value.a21004)
-              if (value.a21005) point.a21005 = parseFloat(value.a21005 - 0 + 0.85).toFixed(3)
+              if (value.a21005)
+                point.a21005 = parseFloat(value.a21005 - 0 + 0.85).toFixed(3)
               if (value.a05024 < 15) {
                 point.a05024 = parseInt(value.a05024 + 3)
               } else if (value.a05024 > 18) {
                 point.a05024 = parseInt(value.a05024 - 3)
               } else 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')) {
+              if (
+                value.dustld - 0 !== 0 &&
+                value.dustld - 0 < 100 &&
+                (that.carMac === 'p5dnd7a0243622' ||
+                  that.carMac === 'p5dnd7a0243625')
+              ) {
                 point.dustld = 100
               } else {
                 point.dustld = value.dustld - 0
@@ -1148,25 +1206,19 @@
               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')) {
+              if (
+                value.dustld - 0 !== 0 &&
+                value.dustld - 0 < 100 &&
+                (that.carMac === 'p5dnd7a0243622' ||
+                  that.carMac === 'p5dnd7a0243625')
+              ) {
                 point.dustld = 100
               } else {
                 point.dustld = value.dustld - 0
               }
             }
-            // point.a34004 = parseInt(value.a34004)
-            // point.a34002 = parseInt(value.a34002)
-            // point.a21026 = parseInt(value.a21026)
-            // point.a21004 = parseInt(value.a21004)
-            // 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
-            // }
             // point.dustld = value.dustld - 0
+            point.times = value.time
             trackPoints.push(point)
           }
         })
@@ -1229,9 +1281,7 @@
               selectedColor: '#ee1111', // ���������������
               autoSelect: true, // ������������������������������������������
               riseTime: 1800, // ���������������������������
-              onClick: (e) => {
-                // console.log(e)
-              },
+              onClick: (e) => {},
             })
             that.shapeLayer.setData(data)
             that.view.addLayer(that.shapeLayer)
@@ -1364,7 +1414,7 @@
         // ���������������10���������������
         lng = (lng * 180) / Math.PI
         lat = (lat * 180) / Math.PI
-        // console.log(lng, lat)
+        // console.log(lng, lat,123)
         return new BMapGL.Point(lng, lat)
       }
 
@@ -1737,7 +1787,6 @@
             that.endL = times
           }
         })
-
         label.setStyle(labelStyle)
         that.map.addOverlay(label)
       }
@@ -2039,3 +2088,4 @@
   margin-top: 0.8rem;
 }
 </style>
+  
\ No newline at end of file
diff --git a/src/views/dailyreport/index.vue b/src/views/dailyreport/index.vue
index 61a1a40..8468f93 100644
--- a/src/views/dailyreport/index.vue
+++ b/src/views/dailyreport/index.vue
@@ -1397,7 +1397,6 @@
     },
     // ������������������������upload
     handleChange1(file, fileList) {
-      // console.log(file, '123')
       this.fileList1 = fileList
       this.fileLists[0] = fileList
     },
diff --git a/src/views/sectionReport/index.vue b/src/views/sectionReport/index.vue
index 9ecd23b..5b6c504 100644
--- a/src/views/sectionReport/index.vue
+++ b/src/views/sectionReport/index.vue
@@ -60,7 +60,12 @@
     </div>
     <el-dialog title="���������������" :visible.sync="dialogVisible" width="60%">
       <div style="margin-top: 1rem">
-        <el-table :data="tableData1.slice((this.PageNum-1)*PageSize,PageNum*PageSize)" style="width: 100%">
+        <el-table
+          :data="
+            tableData1.slice((this.PageNum - 1) * PageSize, PageNum * PageSize)
+          "
+          style="width: 100%"
+        >
           <el-table-column type="index" width="180" label="������">
           </el-table-column>
           <el-table-column label="������" prop="road"> </el-table-column>
@@ -164,7 +169,6 @@
         fileLists: [[], []],
         index: 0,
         num: 0,
-        fileList: [],
         date: '',
         time: '',
         list1: [],
@@ -211,6 +215,7 @@
   //������������
   methods: {
     baoC() {
+        this.valueDate.fileLists=[]
       // const baseUrl = `${requestObj.baseUrl}/static/img/`
       // var images = [
       //   ['7f633687-8321-4f89-bffc-9a52f94cfb77.jpg'],
@@ -244,7 +249,7 @@
       //     this.valueDate.fileLists[i] = [{ url: baseUrl + imagesObj[i] }]
       //   }
       // }
-
+      console.log(this.fileList, '123')
       const formData = new FormData()
       formData.append(`id`, this.id)
       this.fileList.map((v) => {
@@ -260,14 +265,16 @@
       }).then((res) => {
         console.log(res)
         // this.valueDate=res.data
-        const baseUrl = `${requestObj.baseUrl}static/img/`
-        if (res.data.images === null) {
-          var images = [[], []]
+        const baseUrl = `${requestObj.baseUrl}/static/img/`
+        if (res.data.images.file2 === ''&&res.data.images.file1 === '') {
+          res.data.images.file1=[]
+          res.data.images.file2=[]
+          var images = [res.data.images.file1, res.data.images.file2]
         } else if (res.data.images.file2 === '') {
-          res.data.images.file2 = []
+          res.data.images.file2=[]
           var images = [[res.data.images.file1], res.data.images.file2]
         } else if (res.data.images.file1 === '') {
-          res.data.images.file1 = []
+          res.data.images.file1=[]
           var images = [res.data.images.file1, res.data.images.file2.split(',')]
         } else {
           var images = [
@@ -275,11 +282,10 @@
             res.data.images.file2.split(','),
           ]
         }
-        console.log(images)
         var info = 0
         var num = 0
         for (let i = 0; i < images.length; i++) {
-          console.log(images)
+          // console.log(images)
           if (!this.valueDate.fileLists[i]) this.valueDate.fileLists[i] = []
           if (images[i].length) {
             num++
@@ -290,6 +296,8 @@
             }
           }
         }
+        // images=[]
+        console.log(this.valueDate.fileLists,'images');
         res.data.list1.map((item, index) => {
           item.index = index + 1
         })
@@ -302,20 +310,21 @@
         this.valueDate.list1 = res.data.list1
         this.valueDate.list2 = res.data.list2
         this.valueDate.time = res.data.time
-        console.log(this.valueDate, 'this.valueDate')
         exportLUImage('/Section.docx', this.valueDate, `������������������������.docx`)
+       
       })
     },
     handleRemove(file, fileList) {
       console.log(file, fileList)
     },
     handleChange(file, fileList) {
+      // console.log(file);
       this.file = file
       this.fileList = fileList
       console.log(this.fileList)
     },
     handleSizeChange(size) {
-      this.PageNum = 1;
+      this.PageNum = 1
       this.PageSize = size
     },
     handleCurrentChange(num) {
@@ -325,18 +334,6 @@
       this.dialogVisible = true
     },
 
-    handleImgToBase64(url, cb) {
-      var image = new Image()
-      image.crossOrigin = '*'
-      image.src = url
-      image.onload = function () {
-        const base64 = imageToBase64(image) // ���������base64
-        const file = base64ToFile(base64, +new Date() + '.png') // base64���File
-        // ���������������������������������������������������������������������������������������
-        cb && typeof cb === 'function' && cb(file)
-        return file
-      }
-    },
     selectReport() {
       if (this.carInput == '') {
         this.$message('������������������')
@@ -353,7 +350,7 @@
         },
       })
         .then((res) => {
-          console.log(res)
+          // console.log(res)
           this.tableData = res
           var info = res.data
           // console.log(info.length);
@@ -385,7 +382,7 @@
           id: obj.id,
         },
       }).then((res) => {
-        console.log(res)
+        // console.log(res)
         this.tableData1 = res.data.list
         this.total = res.data.count
         // console.log(this.pagesize)

--
Gitblit v1.8.0