index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. <!--
  2. * @Author: WangQiBiao
  3. * @Date: 2019-09-26 08:46:04
  4. * @LastEditors: MoZhuangRu
  5. * @LastEditTime: 2019-11-21 11:18:21
  6. * @Description: 近1年应实收统计
  7. -->
  8. <template>
  9. <div class="paid-in">
  10. <TitleCom>近12个月实收统计</TitleCom>
  11. <div class="map">
  12. <div class="map-item" id="paid"></div>
  13. <div class="map-item">
  14. <IncomeCom/>
  15. </div>
  16. </div>
  17. </div>
  18. </template>
  19. <script>
  20. import TitleCom from '@/components/title'
  21. import IncomeCom from './../income'
  22. import echarts from 'echarts'
  23. import { api } from '@/api'
  24. export default {
  25. data () {
  26. return {
  27. yearTotal: []
  28. }
  29. },
  30. components: {
  31. TitleCom,
  32. IncomeCom
  33. },
  34. mounted () {
  35. api.getBillSumMonth().then(res => {
  36. this.yearTotal = res.data.data
  37. this.createMapPaid()
  38. })
  39. },
  40. methods: {
  41. createMapPaid () {
  42. var myChart = echarts.init(document.getElementById('paid'))
  43. var dataAxis = []
  44. var data = []
  45. if (this.yearTotal && this.yearTotal.length !== 0) {
  46. this.yearTotal.forEach(item => {
  47. dataAxis.push(item.type)
  48. data.push(item.total)
  49. })
  50. }
  51. var option = {
  52. name: '近12个月实收统计',
  53. legendHoverLink: true,
  54. grid: {
  55. top: 26,
  56. right: 0,
  57. bottom: 36
  58. },
  59. xAxis: {
  60. data: dataAxis,
  61. position: 'bottom',
  62. inverse: false,
  63. minInterval: 7,
  64. axisLine: { // 坐标轴
  65. show: true,
  66. lineStyle: {
  67. color: '#1036A9',
  68. width: 1
  69. }
  70. },
  71. axisTick: { // 坐标轴刻度
  72. show: false
  73. },
  74. axisLabel: { // 坐标轴label
  75. show: true,
  76. inside: false,
  77. rotate: 30,
  78. color: '#39D6FE',
  79. fontWeight: 400
  80. },
  81. splitLine: { // x轴线
  82. show: true,
  83. interval: 1000,
  84. lineStyle: {
  85. type: 'solid',
  86. color: '#1036A9'
  87. }
  88. },
  89. splitArea: { // 分隔区域
  90. show: false,
  91. interval: 0,
  92. areaStyle: {
  93. opacity: 0.36
  94. }
  95. }
  96. },
  97. yAxis: {
  98. show: true,
  99. position: 'left',
  100. name: '单位(万元)',
  101. nameTextStyle: {
  102. color: '#fff',
  103. fontSize: 10,
  104. fontWeight: 400
  105. },
  106. axisLine: {
  107. show: true,
  108. lineStyle: {
  109. color: '#1036A9',
  110. width: 1
  111. }
  112. },
  113. axisTick: { // 坐标轴刻度
  114. show: false
  115. },
  116. axisLabel: { // 坐标轴label
  117. show: true,
  118. inside: false,
  119. // rotate: 30,
  120. color: '#fff',
  121. fontWeight: 400
  122. },
  123. splitLine: { // x轴线
  124. show: true,
  125. interval: 0,
  126. lineStyle: {
  127. type: 'solid',
  128. color: '#1036A9'
  129. }
  130. },
  131. splitArea: { // 分隔区域
  132. show: false,
  133. interval: 0,
  134. areaStyle: {
  135. opacity: 0.36
  136. }
  137. }
  138. },
  139. series: [
  140. {
  141. type: 'bar',
  142. barWidth: 20,
  143. label: {
  144. show: true,
  145. position: 'top',
  146. color: '#FFF600'
  147. },
  148. itemStyle: {
  149. normal: {
  150. color: new echarts.graphic.LinearGradient(
  151. 0, 0, 0, 1,
  152. [
  153. { offset: 0, color: '#01B4FF' },
  154. { offset: 1, color: '#0E2AF6' }
  155. ]
  156. )
  157. }
  158. },
  159. data: data
  160. }
  161. ]
  162. }
  163. myChart.setOption(option)
  164. }
  165. }
  166. }
  167. </script>
  168. <style lang="scss" scoped>
  169. @import './index.scss';
  170. </style>