high-incidence-disease.js 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. (function() {
  2. //<img src="../images/icon.png" class="icon-img">
  3. //<label class="btn btn-default" :class="{active: index2 == 1}" @click="btnClick2(1)">
  4. // <input type="radio">本季
  5. // </label>
  6. Vue.component('high-incidence-disease', {
  7. template: '<div style="height: 100%;">\
  8. <h4 class="c-b5e1fc c-f16 c-t-center div-common-title">本月高发疾病排行</h4>\
  9. <img src="../images/icon.png" class="icon-img" @click="detailClick">\
  10. <div v-show="!hasData" class="no-result-panel">\
  11. <div class="no-result-img" style="padding-top:1.09375rem;">\
  12. <img src="../images/noData.png">\
  13. </div>\
  14. <div class="no-result-text">暂无数据!</div>\
  15. </div>\
  16. <div data-toggle="buttons" class="btn-group" v-show="hasData">\
  17. <label class="btn btn-default" :class="{active: index1 == 0}" @click="btnClick1(0)">\
  18. <input type="radio">全部\
  19. </label>\
  20. <label class="btn btn-default" :class="{active: index1 == 1}" @click="btnClick1(1)">\
  21. <input type="radio">住院\
  22. </label>\
  23. <label class="btn btn-default" :class="{active: index1 == 2}" @click="btnClick1(2)">\
  24. <input type="radio">门诊\
  25. </label>\
  26. </div>\
  27. <div data-toggle="buttons" class="btn-group fr mr20" style="margin-left: 0;" v-show="hasData">\
  28. <label class="btn btn-default" :class="{active: index2 == 0}" @click="btnClick2(0)">\
  29. <input type="radio">本月\
  30. </label>\
  31. <label class="btn btn-default" :class="{active: index2 == 2}" @click="btnClick2(2)">\
  32. <input type="radio">本年\
  33. </label>\
  34. </div>\
  35. <div id="div-gaofa-disease-chart" v-show="hasData"></div>\
  36. </div>',
  37. props: ["data"],
  38. data: function() {
  39. return {
  40. index1:0,
  41. index2:0,
  42. gaoBingFaData:null,
  43. isInit:true,
  44. fontSize: 0.007 * window.screen.width,
  45. linkageFilter:"",
  46. hasData:true,
  47. monthData:null,
  48. yearMonth:null,
  49. }
  50. },
  51. mounted: function() {
  52. },
  53. watch:{
  54. data:function(data){
  55. if(data){
  56. this.monthData = data[0];
  57. this.yearData = data[1];
  58. this.initData();
  59. }
  60. }
  61. },
  62. methods: {
  63. detailClick:function(){
  64. top.layer.open({
  65. id: 'LAY_layuipro', //设定一个id,防止重复弹出
  66. type: 2,
  67. title: false,
  68. closeBtn: 0,
  69. shade: 0.5,
  70. shadeClose: true,
  71. area: ['7.604rem', '4.1875rem'],
  72. content: '../../../page/bigData/html/alert6.html'
  73. });
  74. },
  75. btnClick1:function(idx){
  76. this.index1 = idx;
  77. this.initData();
  78. },
  79. btnClick2:function(idx){
  80. this.index2 = idx;
  81. this.initData();
  82. },
  83. initData:function(){//高发疾病
  84. if(this.index2==0){//本月
  85. this.gaoBingFaData = this.monthData.successFlg?this.monthData.obj.viewInfos&&JSON.parse(this.monthData.obj.viewInfos[0].options[0].option):{};
  86. }else if(this.index2==2){//本年
  87. this.gaoBingFaData = this.yearData.successFlg?this.yearData.obj.viewInfos&&JSON.parse(this.yearData.obj.viewInfos[0].options[0].option):{};
  88. }
  89. if(this.gaoBingFaData.xAxis[0].data){
  90. this.hasData = true;
  91. }else{
  92. this.hasData = false;
  93. return false;
  94. }
  95. var menZhenData = [],menZhenTitle = "";
  96. var xAxisData = (this.gaoBingFaData.xAxis[0].data).reverse()||[];
  97. var zhuYuanData = (this.gaoBingFaData.series[1].data).reverse()||[];
  98. var zhuYuanTitle = this.gaoBingFaData.series[1].name||"";
  99. if(this.index1==0){//全部(显示门诊/住院数据叠加)
  100. menZhenData = (this.gaoBingFaData.series[0].data).reverse();
  101. menZhenTitle = this.gaoBingFaData.series[0].name;
  102. }else if(this.index1==2){//门诊(显示单个柱状图)
  103. zhuYuanData = (this.gaoBingFaData.series[0].data).reverse();
  104. zhuYuanTitle = this.gaoBingFaData.series[0].name;
  105. menZhenData = [];
  106. menZhenTitle = "";
  107. }
  108. this.geoFaMainFun(xAxisData,menZhenData,zhuYuanData,menZhenTitle,zhuYuanTitle)
  109. },
  110. geoFaMainFun:function(xAxisData,menZhenData,zhuYuanData,menZhenTitle,zhuYuanTitle){
  111. var vm = this;
  112. var gaoFaChart = echarts.init(document.getElementById('div-gaofa-disease-chart'));
  113. var gaofaOption = {
  114. "tooltip": {
  115. "trigger": "axis"
  116. },
  117. grid: {top: 40, bottom: 30, left: 140,right:80},
  118. "yAxis": [{
  119. "type": "category",
  120. "name": "人次",
  121. "data": xAxisData,
  122. axisPointer: {
  123. type: 'shadow'
  124. },
  125. axisTick: {
  126. show: false
  127. },
  128. axisLine: {
  129. lineStyle: {
  130. color: '#095f8e'
  131. }
  132. },
  133. axisLabel: {
  134. color: '#b5e1fc',
  135. fontSize:vm.fontSize,
  136. interval: 0,
  137. formatter: function(value) {
  138. if (value.length > 8) {
  139. return value.substring(0, 8) + "...";
  140. } else {
  141. return value;
  142. }
  143. }
  144. },
  145. nameTextStyle:{color: '#b5e1fc'},
  146. }],
  147. "xAxis": [{
  148. "type": "value",
  149. axisPointer: {
  150. type: 'shadow'
  151. },
  152. axisTick: {
  153. show: false
  154. },
  155. axisLine: {
  156. lineStyle: {
  157. color: '#095f8e'
  158. }
  159. },
  160. axisLabel: {
  161. color: '#fff',
  162. fontSize:vm.fontSize,
  163. interval:0
  164. },
  165. splitLine: {
  166. show: false // 不显示坐标轴刻度
  167. }
  168. }],
  169. "series": [{
  170. "smooth": true,
  171. "name": zhuYuanTitle,
  172. "type": "bar",
  173. stack: '高发疾病',
  174. barWidth: 20,
  175. "label": {
  176. show: true,
  177. position: "right",
  178. color: '#b5e1fc'
  179. },
  180. "itemStyle": {
  181. "normal": {
  182. "lineStyle": {
  183. "shadowColor": "rgba(0,0,0,0.4)"
  184. },
  185. color: '#00e6f3',
  186. barBorderRadius: [0, 8, 8, 0],
  187. }
  188. },
  189. "data": zhuYuanData
  190. },
  191. ]
  192. }
  193. if(menZhenData.length>0){
  194. gaofaOption.series[0].label.show = false;
  195. gaofaOption.series[0].itemStyle.normal.color = "#6576e0";
  196. delete gaofaOption.series[0].itemStyle.normal.barBorderRadius;
  197. gaofaOption.series[1] = {
  198. "smooth": true,
  199. "name": menZhenTitle,
  200. "type": "bar",
  201. stack: '高发疾病',
  202. "label": {
  203. show: true,
  204. position: "right",
  205. color: '#b5e1fc',
  206. formatter:function(param){
  207. var dataIndex = param.dataIndex,zhuYuanVal;
  208. _.map(zhuYuanData,function(item,idx){
  209. if(idx==dataIndex){
  210. zhuYuanVal = item
  211. }
  212. })
  213. return zhuYuanVal+"+"+param.value;
  214. },
  215. },
  216. "itemStyle": {
  217. "normal": {
  218. "lineStyle": {
  219. "shadowColor": "rgba(0,0,0,0.4)"
  220. },
  221. barBorderRadius: [0, 8, 8, 0],
  222. color: '#00e6f3'
  223. },
  224. },
  225. "data": menZhenData
  226. }
  227. }else{
  228. gaofaOption.series = gaofaOption.series[0];
  229. }
  230. if(gaoFaChart){
  231. gaoFaChart.clear();
  232. }
  233. gaoFaChart.setOption(gaofaOption);
  234. }
  235. },
  236. })
  237. })()