yichenxi
2022-12-17 a60acf8bae5a1f49e1554e0ff63ff79e0aacf611
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)