zmc
2023-10-12 f3acb8ce787f3df0eda633031473be4e6a9ff448
src/views/analysis/DataShow.vue
@@ -54,7 +54,7 @@
      <!-- <el-main> -->
        <div class="table">
        <el-table :data="displayData" border="" id="table" ref="table" table-layout="auto" >
          <!-- <el-table-column prop="id" label="序号" width="60"></el-table-column> -->
          <el-table-column
            type="index"
            label="序号"
@@ -88,7 +88,7 @@
            label="供应商"
            v-if="showColumn.privides"
          ></el-table-column>
          <!-- <el-table-column prop="smokePushDensity" label="进烟浓度mg/m³" width="130"> </el-table-column> -->
          <el-table-column
            prop="smokePopDensity"
            label="油烟浓度(mg)"
@@ -131,7 +131,7 @@
            v-if="showColumn.attributiontime"
          >
          </el-table-column>
          <!-- <el-table-column prop="reportingTime" label="上报时间" width="100"> </el-table-column> -->
          <el-table-column fixed="right" width="100" align="center">
            <template v-slot:header>
@@ -141,13 +141,7 @@
            @click="showColumnOption">
          </i-ep-setting>
          </template>
            <!-- <template v-slot:header>
              <i
                class="el-icon-setting"
                style="font-size: 22px; cursor: pointer"
                @click="showColumnOption"
              ></i>
            </template> -->
          </el-table-column>
        </el-table>
@@ -199,15 +193,14 @@
          </div>
        </transition>
      </div>
      <!-- </el-main> -->
    <!-- </el-container> -->
  </div>
</template>
<script>
import axios from 'axios';
import axiosInstanceInstance from '../../utils/request.js'
import * as XLSX from 'xlsx/xlsx.mjs';
// import { saveAs } from 'file-saver';
export default {
  data() {
    return {
@@ -274,13 +267,7 @@
  },
  mounted() {
    //发送一部请求,获取数据
    // axios.get('http://192.168.0.144:8080/web/findall',{params:{}}).then((result) => {
    //   this.tableData = result.data.data;
    //   //this.tableData=result.data.data.rows    当访问/tiaojian 时
    //   this.total = this.tableData.length;
    //   this.handleCurrentChange(1); // 默认显示第一页
    // });
    // 默认加载 ‘狼来了’, 05-01到05-15时间段
    this.handleSubmit()
@@ -331,8 +318,8 @@
        params['end'] = this.form.end;
      }
      axios
        .get('http://localhost:8080/web/form', {
      axiosInstanceInstance
        .get('/web/form', {
          params: params
        })
        .then((response) => {
@@ -393,17 +380,7 @@
      // 将workbook转为二进制xlsx文件并下载
      XLSX.writeFile(wb, '页面数据.xlsx');
      // this.jsonData=this.tableData
      // const sheetName = '数据表';
      // const worksheet = XLSX.utils.json_to_sheet(this.jsonData);
      // // 导出Excel文件
      // const workbook = XLSX.utils.book_new();
      // XLSX.utils.book_append_sheet(workbook, worksheet, sheetName);
      // const excelBuffer = XLSX.write(workbook, { bookType: 'xlsx', type: 'array' });
      // const fileName = '页面数据.xlsx';
      // const file = new Blob([excelBuffer], {type: 'application/octet-stream'});
      // saveAs(file, fileName);
    },
    handleSizeChange(val) {
      this.pageSize = val;
@@ -413,12 +390,10 @@
      const startIndex = (val - 1) * this.pageSize;
      const endIndex = startIndex + this.pageSize;
      this.displayData = this.tableData.slice(startIndex, endIndex);
      // this.indexMethod(this.pageSize)
    },
    //序号递增
    indexMethod(index) {
      // let limitpage = this.pageSize; // 每页条数
      // let curpage = this.currentPage; // 当前页码
      return index + 1 + (this.currentPage - 1) * this.pageSize;
    },
@@ -438,7 +413,6 @@
    // 监听复选框配置列所有的变化
    checkList: {
      handler: function (newnew) {
        // console.log(newnew);
        this.showColumn = newnew;
        // 这里需要让表格重新绘制一下,否则会产生固定列错位的情况
        this.$nextTick(() => {
@@ -455,7 +429,6 @@
<style>
/* 表格 */
.table {
  /* margin: 10px,0px,10px,10px; */
  margin: 10px;
}
.button-and-export {