operate.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <el-card >
  3. <div slot="header" class="clearfix">
  4. <div class="box">
  5. <span class='shape'></span>
  6. <span>运营数据</span>
  7. </div>
  8. </div>
  9. <statistic class="statistic" :cols="0">
  10. <statistic-item v-for="(item, key) in items" :key="key" :class="{active: active === key}" @click="active = key">
  11. <span>
  12. {{item.title}}
  13. <el-tooltip v-if="item.desc" :content="item.desc" :open-delay=".3" placement="top">
  14. <i style="margin-left: 5px;cursor: pointer;" class="el-icon-warning-outline"/>
  15. </el-tooltip>
  16. </span>
  17. <span>
  18. <count-to :endVal="item.percent"/>个
  19. </span>
  20. </statistic-item>
  21. </statistic>
  22. <!-- <ve-histogram
  23. style="width: 100%;"
  24. height="350px"
  25. :data="chartData"
  26. :data-empty="dataEmpty"
  27. :data-zoom="dataZoom"
  28. :extend="chartExtend"
  29. ></ve-histogram> -->
  30. </el-card>
  31. </template>
  32. <script>
  33. import 'echarts/lib/component/dataZoom'
  34. import countTo from 'vue-count-to'
  35. import veHistogram from 'v-charts/lib/histogram.common'
  36. export default {
  37. props: ['data'],
  38. components: {
  39. 've-histogram': veHistogram,
  40. 'count-to': countTo
  41. },
  42. computed: {
  43. items() {
  44. return {
  45. SCHOOL: this.data['SCHOOL'] || {},
  46. PROGRESS_MUSIC_GROUP_NUM: this.data['PROGRESS_MUSIC_GROUP_NUM'] || {},
  47. }
  48. },
  49. chartExtend() {
  50. return {
  51. tooltip: {
  52. axisPointer: {
  53. type: 'shadow',
  54. shadowStyle: {
  55. color: 'rgba(150,150,150,0.2)'
  56. }
  57. }
  58. }
  59. }
  60. },
  61. dataZoom() {
  62. return [
  63. {
  64. type: 'slider',
  65. start: 60,
  66. end: 100
  67. }
  68. ]
  69. },
  70. chartData() {
  71. const values = Object.values(this.items)
  72. const months = {}
  73. for (const item of values) {
  74. for (const row of (item.indexMonthData || [])) {
  75. const key = this.$helpers.dayjs(row.month).format('YYYY-MM-DD')
  76. if (!months[key]) {
  77. months[key] = {
  78. '日期': key,
  79. }
  80. }
  81. months[key][item.title] = row.percent
  82. }
  83. }
  84. return {
  85. columns: ['日期', ...values.map(item => item.title)],
  86. rows: Object.values(months)
  87. }
  88. },
  89. dataEmpty() {
  90. return !this.chartData.rows.length
  91. },
  92. },
  93. data () {
  94. return {
  95. active: 'SCHOOL',
  96. }
  97. },
  98. }
  99. </script>
  100. <style lang="less" scoped>
  101. // .statistic{
  102. // /deep/ .statistic-content{
  103. // cursor: pointer;
  104. // &.active > span{
  105. // color: #14928a !important;
  106. // }
  107. // }
  108. // }
  109. </style>