key-service-population.js 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. (function() {
  2. Vue.component('key-service-population', {
  3. template: '<div style="height: 100%;">\
  4. <h4 class="c-b5e1fc c-f16 c-t-center div-common-title">重点服务人群增加趋势</h4>\
  5. <div data-toggle="buttons" class="btn-group fr mr40 mt0" style="position: absolute;right: 0px;top: 15px; z-index: 99999;">\
  6. <label class="btn btn-default" :class="{active: activeIndex == 0}" @click="btnClick(0)">\
  7. <input type="radio">本月\
  8. </label>\
  9. <label class="btn btn-default" :class="{active: activeIndex == 1}" @click="btnClick(1)">\
  10. <input type="radio">本季\
  11. </label>\
  12. <label class="btn btn-default" :class="{active: activeIndex == 2}" @click="btnClick(2)">\
  13. <input type="radio">本年\
  14. </label>\
  15. </div>\
  16. <div id="div-zhongidan-echart" class="ml30"></div>\
  17. </div>',
  18. props: ["data"],
  19. data: function() {
  20. return {
  21. keyServiceData:null,
  22. activeIndex:0
  23. }
  24. },
  25. mounted: function() {
  26. var vm = this;
  27. setTimeout(function(){
  28. vm.initData();
  29. },50)
  30. },
  31. watch:{
  32. data:function(data){
  33. this.initData();
  34. }
  35. },
  36. methods: {
  37. initData:function(){//重点人群
  38. this.activeIndex = 0;
  39. this.keyServiceData = this.data["重点服务人群增加趋势"].本月;
  40. this.chartMainFun();
  41. },
  42. btnClick:function(type){
  43. this.activeIndex = type;
  44. if(type==0){//本月
  45. this.keyServiceData = this.data["重点服务人群增加趋势"].本月;
  46. }
  47. if(type==1){//本季
  48. this.keyServiceData = this.data["重点服务人群增加趋势"].本季;
  49. }
  50. if(type==2){//本年
  51. this.keyServiceData = this.data["重点服务人群增加趋势"].本年;
  52. }
  53. this.chartMainFun();
  54. },
  55. chartMainFun:function(){
  56. var xAxisData = this.keyServiceData.xAxis[0].data;
  57. var pjcrsData = this.keyServiceData.series[0].data;
  58. var huanbiData = this.keyServiceData.series[1].data;
  59. var zhongdianChart = echarts.init(document.getElementById('div-zhongidan-echart'));
  60. var zhongdianOption = {
  61. tooltip: {
  62. trigger: 'axis',
  63. axisPointer: {
  64. type: 'item',
  65. crossStyle: {
  66. color: '#fff'
  67. }
  68. }
  69. },
  70. grid: {top: 50, bottom: 30, left: 30,right:80},
  71. legend: {
  72. data:['平均床日数','环比'],
  73. textStyle: {
  74. color: '#b5e1fc'
  75. }
  76. },
  77. xAxis: [
  78. {
  79. type: 'category',
  80. data: xAxisData,
  81. axisPointer: {
  82. type: 'shadow'
  83. },
  84. axisTick: {
  85. show: false
  86. },
  87. axisLine: {
  88. lineStyle: {
  89. color: '#095f8e'
  90. }
  91. },
  92. axisLabel: {
  93. color: '#b5e1fc'
  94. }
  95. }
  96. ],
  97. yAxis: [
  98. {
  99. type: 'value',
  100. name: '平均床日数',
  101. min: 0,
  102. max: 250,
  103. nameTextStyle: {
  104. color: '#b5e1fc' // 坐标轴名称颜色
  105. },
  106. splitLine: {
  107. show: false
  108. },
  109. axisLine: {
  110. lineStyle: {
  111. color: '#095f8e'
  112. }
  113. },
  114. axisLabel: {
  115. color: '#b5e1fc'
  116. }
  117. },
  118. {
  119. type: 'value',
  120. name: '环比',
  121. nameTextStyle: {
  122. color: '#b5e1fc' // 坐标轴名称颜色
  123. },
  124. splitLine: {
  125. show: false // 不显示坐标轴刻度
  126. },
  127. axisLine: {
  128. lineStyle: {
  129. color: '#095f8e' // 坐标轴轴线颜色
  130. }
  131. },
  132. axisLabel: {
  133. color: '#b5e1fc' // 坐标轴刻度标签文本颜色
  134. },
  135. show: false
  136. }
  137. ],
  138. series: [
  139. {
  140. name:'平均床日数',
  141. type:'bar',
  142. data:pjcrsData,
  143. barWidth: 20,
  144. label: {
  145. normal: {
  146. show: true,
  147. position: 'top', // 在柱状图上方显示
  148. color: '#fff' // 柱状图上方显示的数值颜色
  149. }
  150. },
  151. itemStyle: {
  152. barBorderRadius: [8,8,0,0],
  153. color: '#00e6f3'
  154. }
  155. },
  156. {
  157. name:'环比',
  158. type:'line',
  159. yAxisIndex: 1,
  160. data:huanbiData,
  161. itemStyle: {
  162. color: '#03fa6d'
  163. }
  164. }
  165. ]
  166. };
  167. zhongdianChart.setOption(zhongdianOption);
  168. },
  169. }
  170. })
  171. })()