Newer
Older
CloudBrainNew / src / views / cityManage / components / mobileManage / components / mobileCaseBar.vue
wangxitong on 29 Apr 2021 2 KB 0429 submit
<!--
 * @Description: 青少年犯罪趋势
 * @Author: 王晓颖
 * @Date: 2020-12-03 09:56:31
 -->
<template>
  <single-layout  title="案件趋势">
    <div style="width: 100%;height:100%;">
      <radio-group v-model="type"/>
      <simple-bar-chart
        :id="options.id"
        :unit="options.unit"
        :height="options.height"
        :xAxisData="options.xAxisData"
        :seriesData="options.seriesData"
      />
    </div>
  </single-layout>
</template>

<script>
import ColorfulBarChart from '@/components/barChart/colorfulBarChart'
import ChartLayout from '@/components/layout/chartLayout'
import {fetchPipeCount} from '@/api/cityManage'
import RadioGroup from '../../../../../components/radioGroup/index1'
import SingleLayout from '@/components/layout/singleLayout'
import SimpleBarChart from '../../../../../components/barChart/simpleBarChart'
export default {
  name: 'mobileCaseBar',
  components: {RadioGroup, SimpleBarChart, SingleLayout, ChartLayout, ColorfulBarChart},
  data () {
    return {
      type: 'week',
      options: {
        id: 'mobile_case_bar',
        height: '100%',
        width: '100%',
        unit: '件',
        xAxisData: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
        seriesData: [0, 0, 0, 0, 0, 0, 0]
      }
    }
  },
  watch: {
    type (newval, oldval) {
      if (newval === 'week') {
        this.options.xAxisData = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
        this.options.seriesData = ['12', '13', '11', '16', '13', '22', '13']
      } else if (newval === 'month') {
        this.options.xAxisData = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22']
        this.options.seriesData = ['12', '32', '13', '41', '15', '16', '7', '8', '9', '10', '11', '12', '13', '24', '15', '16', '27', '18', '19', '20', '21', '22']
      }
    }
  },
  created () {
    this.getData()
  },
  methods: {
    getData () {
      // fetchPipeCount().then(response => {
      //   if (response.code === 200) {
      //     const data = response.data
      //     this.options.xAxisData = data.map(item => { return item.name })
      //     this.options.seriesData = data.map(item => { return item.value })
      //   }
      // })
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>

</style>