Newer
Older
CloudBrainNew / src / views / cityManage / components / service / components / serviceLine.vue
wangxitong on 29 Apr 2021 2 KB 0429 submit
<!--
 * @Description: 心理服务日统计
 * @Author: 王晓颖
 * @Date: 2020-12-02 10:46:42
 -->
<template>
  <single-layout title="心理服务日统计">
    <div style="width: 100%;height:100%;padding-top:0.05rem">
      <!--<div style="position: absolute;right:10px;top:-30px;">-->
        <!--<el-radio-group size="mini" v-model="type">-->
          <!--<el-radio-button label="week">本周</el-radio-button>-->
          <!--<el-radio-button label="month">本月</el-radio-button>-->
          <!--<el-radio-button label="year">本年</el-radio-button>-->
        <!--</el-radio-group>-->
      <!--</div>-->
      <radio-group v-model="type"/>
      <gradient-line-chart
        :id="options.id"
        :unit="options.unit"
        :height="options.height"
        :legend="options.xAxisData"
        :xAxisData="options.xAxisData"
        :seriesData="options.seriesData"
      />
    </div>
  </single-layout>
</template>

<script>
import ColorfulBarChart from '@/components/barChart/colorfulBarChart'
import GradientLineChart from '@/components/lineChart/gradientLineChart'
import {fetchCaseByDay} from '@/api/cityManage'
import SingleLayout from '@/components/layout/singleLayout'
import RadioGroup from '../../../../../components/radioGroup/index'
export default {
  name: 'serviceLine',
  components: {RadioGroup, SingleLayout, GradientLineChart, ColorfulBarChart},
  data () {
    return {
      type: 'week',
      options: {
        id: 'service_line1',
        height: '100%',
        width: '100%',
        unit: '次',
        xAxisData: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
        seriesData: [
          {name: '服务次数', data: [0, 0, 0, 0, 0, 0, 0], color: '0,144,255'}
        ]
      }
    }
  },
  created () {
    // this.getData()
  },
  watch: {
    type (newval, oldval) {
      if (newval === 'week') {
        this.options.xAxisData = ['周一', '周二', '周三', '周四', '周五', '周六', '周日']
      } 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']
      } else if (newval === 'year') {
        this.options.xAxisData = ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
      }
    }
  },
  methods: {
    getData () {
      // fetchCaseByDay().then(response => {
      //   if (response.code === 200) {
      //     const data = response.data
      //     this.options.xAxisData = data.map(item => { return item.name })
      //     const total = data.map(item => { return item.total })
      //     const complete = data.map(item => { return item.complete })
      //     this.options.seriesData = [
      //       {name: '矛盾事件总数', data: total, color: '255,45,85'},
      //       {name: '矛盾事件处理数', data: complete, color: '0,144,255'}
      //     ]
      //   }
      // })
    }
  }
}
</script>

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

</style>