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: [],
@@ -195,6 +199,7 @@
            return time.getTime() > new Date()
          }
        },
        reportName: ''
      },
    }
  },
@@ -211,6 +216,7 @@
  //方法集合
  methods: {
    baoC() {
        this.valueDate.fileLists=[]
      // const baseUrl = `${requestObj.baseUrl}/static/img/`
      // var images = [
      //   ['7f633687-8321-4f89-bffc-9a52f94cfb77.jpg'],
@@ -244,7 +250,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 +266,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 +283,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 +297,8 @@
            }
          }
        }
        // images=[]
        console.log(this.valueDate.fileLists,'images');
        res.data.list1.map((item, index) => {
          item.index = index + 1
        })
@@ -302,20 +311,20 @@
        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`)
        exportLUImage('/Section.docx', this.valueDate, `${this.reportName}.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,20 +334,8 @@
      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 == '') {
      if (this.carInput === '') {
        this.$message('请选择走航车')
        return false
      }
@@ -353,7 +350,7 @@
        },
      })
        .then((res) => {
          console.log(res)
          // console.log(res)
          this.tableData = res
          var info = res.data
          // console.log(info.length);
@@ -364,8 +361,13 @@
          }
          info.map((v) => {
            console.log(v)
            var time = v.time.substring(0, 10)
            v.time = `道路积尘负荷走航监测报告${time}`
            var time = v.time.substring(0, 10).split('-').join('')
            if (this.cityChoose === 'gx') {
              v.time = `苏州高新区道路积尘负荷走航监测报告${time}`
            } else {
              v.time = `道路积尘负荷走航监测报告${time}`
            }
            this.reportName = v.time
          })
          this.tableData = info
        })
@@ -385,7 +387,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)
@@ -448,4 +450,4 @@
/deep/.el-upload-list__item {
  width: 30%;
}
</style>
</style>