index.vue 3.9 KB

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