Newer
Older
laserPTZFront / src / views / dataManage / components / chartGasHistory.vue
[wangxitong] on 10 May 2022 1 KB first commit
<template>
  <div class="app-container">
    <el-row>
      <ve-line :data="chartData" :settings="chartSettings"></ve-line>
    </el-row>
  </div>
</template>

<script>
import { getHistory } from '@/api/data'
import { getDayTime } from '@/utils/dateutils'

export default {
  name: 'ChartGasHistory',
  data() {
    return {
      // chartSettings: [],
      chartSettings: {
        labelMap: {
          'logTime': '采集时间',
          'concentration': '浓度值'
        },
        dimension: ['logTime'],
        metrics: ['concentration']
      },
      listQuery: {
        monitorId: '',
        startTime: '',
        endTime: ''
      }, // 筛选条件
      chartData: {
        columns: ['logTime', 'concentration'],
        rows: []
      }, // 列表数据
      listLoading: true // 加载动画
    }
  },
  mounted() {
    // this.fetchData()
  },
  methods: {
    // 获取列表
    fetchData(param) {
      this.listLoading = true
      this.listQuery.startTime = getDayTime(new Date().getTime() - 24 * 1 * 60 * 60 * 1000).Format('yyyy-MM-dd hh:mm:ss')
      this.listQuery.endTime = new Date().Format('yyyy-MM-dd hh:mm:ss')
      this.listQuery.monitorId = param.monitorId
      console.log(this.listQuery)
      getHistory(this.listQuery).then(response => {
        this.chartData.rows = response.data
        this.listLoading = false
      })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
  $tableTitleHeight:46px;
  .table{
    margin-bottom: 20px;
  }
  .pagination-container{
    margin-bottom: 50px;
  }
  .table-title{
    background-color:rgba(243, 243, 243, 1);
    height: $tableTitleHeight;
    .title-header{
      line-height:$tableTitleHeight;
      color: #606266;
      font-size: 15px;
      i{
        margin-left: 5px;
        margin-right: 5px;
      }
    }
  }
  .edit_btns{
    .edit_btn{
      float:right;
      margin:7px 3px;//为了需要居中显示margin-top和bottom要用$tableTitleHeight减去按钮原高度除以2
    }
  }
</style>