Newer
Older
smartwell_front / src / views / dataView / components / jobView.vue
yuexiaosheng on 16 Jun 2022 1 KB feat<views>:新增数据概览页面
<template>
  <div>
    <div class="flagBoxStyle">
      <div class="flagStyle" />
      <div>井数量分析</div>
    </div>
    <el-row>
      <el-col>
        <ve-bar
          :data="chartData"
          :grid="grid"
          :extend="extend"
          :settings="chartSettings"
        />
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { deviceStaticsByOnline } from '@/api/data/dataStatics'
export default {
  name: 'JobView',
  data() {
    return {
      // 柱状图
      extend: {
        xAxis: {
          axisLabel: {
            rotate: 30,
            margin: 30,
            textStyle: {
              align: 'center'
            }
          }
        },
        series: {
          label: { show: true, position: 'top' },
          barMaxWidth: 35 // 最大柱宽度
        }
      },
      grid: {
        right: 60
      },
      chartSettings: {
        itemStyle: {
          'barCategoryGap': 5
        },
        barWidth: 15,
        labelMap: {
          'deviceType': '权属单位',
          'offline': '设备数量(个)'
        },
        dimension: ['deviceType'],
        metrics: ['offline']
      },
      chartData: {
        columns: ['deviceType', 'offline'],
        rows: []
      }
    }
  },
  created() {
    this.fetchDeviceType()
  },
  methods: {
    fetchDeviceType() {
      deviceStaticsByOnline().then(response => {
        this.chartData.rows = response.data
      })
    }
  }
}
</script>

<style lang="scss" scoped>
.flagBoxStyle {
  display: flex;
  margin-bottom: 20px;
}
.flagBoxStyle div:nth-child(2){
  line-height: 30px;
  font-weight: 600;
}
.flagStyle {
  width: 4px;
  height: 30px;
  margin-right: 6px;
  background: rgb(64 121 242);
}

</style>