key-service-population.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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: 0.208rem;top: 0.05rem;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.data = data;
  34. this.initData();
  35. }
  36. },
  37. methods: {
  38. initData:function(){//重点人群
  39. this.activeIndex = 0;
  40. this.keyServiceData = this.data["重点服务人群增加趋势"].本月;
  41. this.chartMainFun();
  42. },
  43. btnClick:function(type){
  44. this.activeIndex = type;
  45. if(type==0){//本月
  46. this.keyServiceData = this.data["重点服务人群增加趋势"].本月;
  47. }
  48. if(type==1){//本季
  49. this.keyServiceData = this.data["重点服务人群增加趋势"].本季;
  50. }
  51. if(type==2){//本年
  52. this.keyServiceData = this.data["重点服务人群增加趋势"].本年;
  53. }
  54. this.chartMainFun();
  55. },
  56. chartMainFun:function(){
  57. var xAxisData = this.keyServiceData.xAxis[0].data;
  58. var pjcrsData = this.keyServiceData.series[0].data;
  59. var huanbiData = this.keyServiceData.series[1].data;
  60. var zhongdianChart = echarts.init(document.getElementById('div-zhongidan-echart'));
  61. var zhongdianOption = {
  62. tooltip: {
  63. trigger: 'axis',
  64. axisPointer: {
  65. type : 'shadow'
  66. },
  67. formatter: '{b} <br /> {a0}: {c0}<br />{a1}: {c1}' + "%"
  68. },
  69. grid: {top: 50, bottom: 30, left: 30,right:80},
  70. legend: {
  71. data:['平均床日数','环比'],
  72. textStyle: {
  73. color: '#b5e1fc'
  74. }
  75. },
  76. xAxis: [
  77. {
  78. type: 'category',
  79. data: xAxisData,
  80. axisPointer: {
  81. type: 'shadow'
  82. },
  83. axisTick: {
  84. show: false
  85. },
  86. axisLine: {
  87. lineStyle: {
  88. color: '#095f8e'
  89. }
  90. },
  91. axisLabel: {
  92. color: '#b5e1fc'
  93. }
  94. }
  95. ],
  96. yAxis: [
  97. {
  98. type: 'value',
  99. name: '平均床日数',
  100. nameTextStyle: {
  101. color: '#b5e1fc' // 坐标轴名称颜色
  102. },
  103. splitLine: {
  104. show: false
  105. },
  106. axisLine: {
  107. lineStyle: {
  108. color: '#095f8e'
  109. }
  110. },
  111. axisLabel: {
  112. color: '#b5e1fc'
  113. }
  114. },
  115. {
  116. type: 'value',
  117. name: '环比',
  118. nameTextStyle: {
  119. color: '#b5e1fc' // 坐标轴名称颜色
  120. },
  121. splitLine: {
  122. show: false // 不显示坐标轴刻度
  123. },
  124. axisLine: {
  125. lineStyle: {
  126. color: '#095f8e' // 坐标轴轴线颜色
  127. }
  128. },
  129. axisLabel: {
  130. color: '#b5e1fc' // 坐标轴刻度标签文本颜色
  131. },
  132. show: true
  133. }
  134. ],
  135. series: [
  136. {
  137. name:'平均床日数',
  138. type:'bar',
  139. data:pjcrsData,
  140. barWidth: 20,
  141. label: {
  142. normal: {
  143. show: true,
  144. position: 'top', // 在柱状图上方显示
  145. color: '#fff',// 柱状图上方显示的数值颜色
  146. }
  147. },
  148. itemStyle: {
  149. barBorderRadius: [8,8,0,0],
  150. color: '#00e6f3'
  151. }
  152. },
  153. {
  154. name:'环比',
  155. type:'line',
  156. yAxisIndex: 1,
  157. data:huanbiData,
  158. itemStyle: {
  159. color: '#03fa6d'
  160. },
  161. }
  162. ]
  163. };
  164. zhongdianChart.setOption(zhongdianOption);
  165. },
  166. }
  167. })
  168. })()