yichenxi
2022-12-13 4e15972e4db30f68e4ea74759fd04f00e6e44be2
1、尘负荷走航路段报告
5 files modified
164 ■■■■■ changed files
src/utils/exportLUImage.js 2 ●●● patch | view | raw | blame | history
src/utils/request.js 4 ●●●● patch | view | raw | blame | history
src/views/car/index.vue 108 ●●●● patch | view | raw | blame | history
src/views/dailyreport/index.vue 1 ●●●● patch | view | raw | blame | history
src/views/sectionReport/index.vue 49 ●●●● patch | view | raw | blame | history
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) {
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({
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>
src/views/dailyreport/index.vue
@@ -1397,7 +1397,6 @@
    },
    // 走航车上传文件到upload
    handleChange1(file, fileList) {
      // console.log(file, '123')
      this.fileList1 = fileList
      this.fileLists[0] = fileList
    },
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)