detail.vue 4.46 KB
<template>
  <div class="statusdetail">
    <el-dialog
      :title="titlename"
      :visible.sync="show"
      width="40%"
      :before-close="handleClose">
      <div  v-show="curshow == 'chart'" class="report-select">
        <el-select class="flr" v-model="period" @change="chageperiod">
          <el-option label="天" value="day"></el-option>
          <el-option label="周" value="week"></el-option>
          <el-option label="月" value="month"></el-option>
        </el-select>
      </div>
      <div class="activitychart" id="activitychart" v-show="curshow == 'chart'"></div>
      <div class="imgbox"  v-show="curshow == 'img'">
        <div v-for="(item,index) in imgData" class="item-img-box" :key="index">
          <img  :src="item.pic_url" alt="">
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="show = false">取 消</el-button>
        <el-button type="primary" @click="show = false">确 定</el-button>
      </span>
</el-dialog>
  </div>
</template>

<script>
export default {
  data() {
    return {
      show:false,
      detaildata:'',
      curshow:'img',
      period:'week',
      titlename:'抓拍图片',
      xdata:['01','02','03','04','05','06'],
      apperadata:[23,60,20,36,23,85],
      imgData:[]
    }
  },
  methods:{
    initImg(){
      this.show = true
      this.titlename = '抓拍图片'
      this.curshow = 'img'
      this.axios.get(this.API.url + '/faces/' + data.face_unid + '/face_events').then(res => {
        this.imgData = res.data.list_data
      })
    },
    chageperiod(){
      this.xdata = ['00:00','00:01','00:02','00:03','00:04','00:05']
      this.apperadata = [123,60,32,36,213,85]
      this.initchart()
    },
    initchart(data){
      this.titlename = '活动状态'
      this.show = true;
      this.curshow = 'chart'
      this.detaildata = data
      setTimeout(() => {
      this.initactivityChart(this.data)
      }, 0);
    },
    initactivityChart(){
      var chart  = this.$echarts.init(document.getElementById('activitychart'))
      var option = {
        tooltip: {
        trigger: 'axis'
      },
          xAxis: [{
              type: 'category',
              data: this.xdata,
              axisLine: {
                  lineStyle: {
                      color: "#999"
                  }
              }
          }],
          yAxis: [{
              type: 'value',
              splitNumber: 4,
              splitLine: {
                  lineStyle: {
                      type: 'dashed',
                      color: '#DDD'
                  }
              },
              axisLine: {
                  show: false,
                  lineStyle: {
                      color: "#333"
                  },
              },
              nameTextStyle: {
                  color: "#999"
              },
              splitArea: {
                  show: false
              }
          }],
          series: [{
              name: '次数',
              type: 'line',
              data: this.apperadata,
              lineStyle: {
                  normal: {
                      width: 8,
                      color: {
                          type: 'linear',

                          colorStops: [{
                              offset: 0,
                              color: '#A9F387' // 0% 处的颜色
                          }, {
                              offset: 1,
                              color: '#48D8BF' // 100% 处的颜色
                          }],
                          globalCoord: false // 缺省为 false
                      },
                      shadowColor: 'rgba(72,216,191, 0.3)',
                      shadowBlur: 10,
                      shadowOffsetY: 20
                  }
              },
              itemStyle: {
                  normal: {
                      color: '#fff',
                      borderWidth: 10,
                      /*shadowColor: 'rgba(72,216,191, 0.3)',
                      shadowBlur: 100,*/
                      borderColor: "#A9F387"
                  }
              },
              smooth: true
          }]
        };
        chart.setOption(option)
    }
  },
  mounted(){
  }
}
</script>

<style lang="stylus" scoped>
.activitychart{
  height 40vh
  width 40vw
}
.report-select{
  width 100%
  overflow hidden
}
.imgbox{
   overflow hidden
}
.item-img-box{
  height 200px
  width 200px
  float left
  overflow hidden
  border-radius 5px
  margin 0 0 20px 20px
  img {
    height 100%
    width 100%
  }
}
</style>