disease-crowd.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. (function() {
  2. Vue.component('disease-crowd', {
  3. template: '<div v-if="data" class="left-panel-img">\
  4. <div class="div-disease-item" @click="diseaseClick(0)" :class="{active: activeIndex == 0}" @mouseout="diseaseMouseOut" @mouseover="diseaseMouseOver">\
  5. <h4 class="c-b5e1fc c-f16 c-t-center div-disease-title">高血压人群</h4>\
  6. <img src="../images/icon.png" class="icon-img" @click="detailClick(0)">\
  7. <div class="c-row">\
  8. <div class="c-33 bg-icon">\
  9. <div class="absolute-content">\
  10. <p class="c-b5e1fc c-f12">\
  11. <span class="c-b5e1fc c-f16">总人数</span>\
  12. </p>\
  13. <span class="c-fff71a c-f26 c-bold">{{data1.totalNumber}}</span>\
  14. <span class="c-b5e1fc c-f16">人</span>\
  15. </div>\
  16. </div>\
  17. <div class="c-33 bg-icon">\
  18. <div class="absolute-content">\
  19. <p class="c-b5e1fc c-f12">\
  20. <span class="c-b5e1fc c-f16">上月新增</span>\
  21. </p>\
  22. <span class="c-fff71a c-f26 c-bold">{{data1.addNumber}}</span>\
  23. <span class="c-b5e1fc c-f16">人</span>\
  24. </div>\
  25. </div>\
  26. <div class="c-33 bg-icon">\
  27. <div class="absolute-content">\
  28. <p class="c-b5e1fc c-f12">\
  29. <span class="c-b5e1fc c-f16">环比</span>\
  30. </p>\
  31. <img v-if="data1.ringRatio<0" src="../images/xiajiang.png" class="zengzhang-img"/>\
  32. <img v-if="data1.ringRatio>=0" src="../images/zengzhang.png" class="zengzhang-img"/>\
  33. <span class="c-b5e1fc c-f26 ml20 c-bold">{{data1.ringRatio}}%</span>\
  34. </div>\
  35. </div>\
  36. </div>\
  37. </div>\
  38. <div class="div-disease-item mt10" @click="diseaseClick(1)" :class="{active: activeIndex == 1}" @mouseout="diseaseMouseOut" @mouseover="diseaseMouseOver">\
  39. <h4 class="c-b5e1fc c-f16 c-t-center div-disease-title">糖尿病人群</h4>\
  40. <img src="../images/icon.png" class="icon-img" @click="detailClick(1)">\
  41. <div class="c-row">\
  42. <div class="c-33 bg-icon">\
  43. <div class="absolute-content">\
  44. <p class="c-b5e1fc c-f12">\
  45. <span class="c-b5e1fc c-f16">总人数</span>\
  46. </p>\
  47. <span class="c-fff71a c-f26 c-bold">{{data2.totalNumber}}</span>\
  48. <span class="c-b5e1fc c-f16">人</span>\
  49. </div>\
  50. </div>\
  51. <div class="c-33 bg-icon">\
  52. <div class="absolute-content">\
  53. <p class="c-b5e1fc c-f12">\
  54. <span class="c-b5e1fc c-f16">上月新增</span>\
  55. </p>\
  56. <span class="c-fff71a c-f26 c-bold">{{data2.addNumber}}</span>\
  57. <span class="c-b5e1fc c-f16">人</span>\
  58. </div>\
  59. </div>\
  60. <div class="c-33 bg-icon">\
  61. <div class="absolute-content">\
  62. <p class="c-b5e1fc c-f12">\
  63. <span class="c-b5e1fc c-f16">环比</span>\
  64. </p>\
  65. <img v-if="data2.ringRatio<0" src="../images/xiajiang.png" class="zengzhang-img"/>\
  66. <img v-if="data2.ringRatio>=0" src="../images/zengzhang.png" class="zengzhang-img"/>\
  67. <span class="c-b5e1fc c-f26 ml20 c-bold">{{data2.ringRatio}}%</span>\
  68. </div>\
  69. </div>\
  70. </div>\
  71. </div>\
  72. <div class="div-disease-item mt10" @click="diseaseClick(2)" :class="{active: activeIndex == 2}" @mouseout="diseaseMouseOut" @mouseover="diseaseMouseOver">\
  73. <h4 class="c-b5e1fc c-f16 c-t-center div-disease-title">孕产妇人群</h4>\
  74. <img src="../images/icon.png" class="icon-img" @click="detailClick(2)">\
  75. <div class="c-row">\
  76. <div class="c-33 bg-icon">\
  77. <div class="absolute-content">\
  78. <p class="c-b5e1fc c-f12">\
  79. <span class="c-b5e1fc c-f16">总人数</span>\
  80. </p>\
  81. <span class="c-fff71a c-f26 c-bold">{{data3.totalNumber}}</span>\
  82. <span class="c-b5e1fc c-f16">人</span>\
  83. </div>\
  84. </div>\
  85. <div class="c-33 bg-icon">\
  86. <div class="absolute-content">\
  87. <p class="c-b5e1fc c-f12">\
  88. <span class="c-b5e1fc c-f16">上月新增</span>\
  89. </p>\
  90. <span class="c-fff71a c-f26 c-bold">{{data3.addNumber}}</span>\
  91. <span class="c-b5e1fc c-f16">人</span>\
  92. </div>\
  93. </div>\
  94. <div class="c-33 bg-icon">\
  95. <div class="absolute-content">\
  96. <p class="c-b5e1fc c-f12">\
  97. <span class="c-b5e1fc c-f16">环比</span>\
  98. </p>\
  99. <img v-if="data3.ringRatio<0" src="../images/xiajiang.png" class="zengzhang-img"/>\
  100. <img v-if="data3.ringRatio>=0" src="../images/zengzhang.png" class="zengzhang-img"/>\
  101. <span class="c-b5e1fc c-f26 ml20 c-bold">{{data3.ringRatio}}%</span>\
  102. </div>\
  103. </div>\
  104. </div>\
  105. </div>\
  106. <div class="div-disease-item mt10" @click="diseaseClick(3)" :class="{active: activeIndex == 3}" @mouseout="diseaseMouseOut" @mouseover="diseaseMouseOver">\
  107. <h4 class="c-b5e1fc c-f16 c-t-center div-disease-title">65岁以上老年人人数</h4>\
  108. <img src="../images/icon.png" class="icon-img" @click="detailClick(3)">\
  109. <div class="c-row">\
  110. <div class="c-33 bg-icon">\
  111. <div class="absolute-content">\
  112. <p class="c-b5e1fc c-f12">\
  113. <span class="c-b5e1fc c-f16">总人数</span>\
  114. </p>\
  115. <span class="c-fff71a c-f26 c-bold">{{data4.totalNumber}}</span>\
  116. <span class="c-b5e1fc c-f16">人</span>\
  117. </div>\
  118. </div>\
  119. <div class="c-33 bg-icon">\
  120. <div class="absolute-content">\
  121. <p class="c-b5e1fc c-f12">\
  122. <span class="c-b5e1fc c-f16">上月新增</span>\
  123. </p>\
  124. <span class="c-fff71a c-f26 c-bold">{{data4.addNumber}}</span>\
  125. <span class="c-b5e1fc c-f16">人</span>\
  126. </div>\
  127. </div>\
  128. <div class="c-33 bg-icon">\
  129. <div class="absolute-content">\
  130. <p class="c-b5e1fc c-f12">\
  131. <span class="c-b5e1fc c-f16">环比</span>\
  132. </p>\
  133. <img v-if="data4.ringRatio<0" src="../images/xiajiang.png" class="zengzhang-img"/>\
  134. <img v-if="data4.ringRatio>=0" src="../images/zengzhang.png" class="zengzhang-img"/>\
  135. <span class="c-b5e1fc c-f26 ml20 c-bold">{{data4.ringRatio}}%</span>\
  136. </div>\
  137. </div>\
  138. </div>\
  139. </div>\
  140. </div>',
  141. props: ["data","town"],
  142. data: function() {
  143. return {
  144. activeIndex:0,
  145. cacheActiveIndex:0,
  146. data1:{},//高血压
  147. data2:{},//糖尿病
  148. data3:{},//孕产妇人群
  149. data4:{},//65岁以上老年人人数
  150. }
  151. },
  152. mounted: function() {
  153. },
  154. filters:{
  155. formatData:function(value){
  156. return toThousands(value)
  157. }
  158. },
  159. methods: {
  160. initData:function(){
  161. var data1 = this.data[0].successFlg?this.data[0].detailModelList:[];
  162. var data2 = this.data[1].successFlg?this.data[1].detailModelList:[];
  163. var data3 = this.data[2].successFlg?this.data[2].detailModelList:[];
  164. var data4 = this.data[3].successFlg?this.data[3].detailModelList:[];
  165. this.gxyformatData(data1);
  166. this.tnbformatData(data2);
  167. this.ycfformatData(data3);
  168. this.lnrformatData(data4);
  169. },
  170. gxyformatData:function(data){//高血压数据
  171. var vm = this,idx;
  172. _.map(data[0].VIEW_13_0013,function(item,index){
  173. if(vm.town=="上饶市" && item.firstColumn=="合计"){//上饶市
  174. idx = index;
  175. }else if(item.firstColumn==vm.town){
  176. idx = index;
  177. }
  178. })
  179. vm.data1 = {totalNumber:(data[0].VIEW_13_0013[idx]&&data[0].VIEW_13_0013[idx].HC_13_0021 || "--"),addNumber:(data[1].VIEW_13_0036[idx]&&data[1].VIEW_13_0036[idx].HC_13_0021 || "--"),ringRatio:(data[2].VIEW_13_0037[idx]&&data[2].VIEW_13_0037[idx].HC_13_0023 || "--")};
  180. },
  181. tnbformatData:function(data){//糖尿病数据
  182. var vm = this,idx;
  183. _.map(data[0].VIEW_13_0026 || [],function(item,index){
  184. if(vm.town=="上饶市" && item.firstColumn=="合计"){//上饶市
  185. idx = index;
  186. }else if(item.firstColumn==vm.town){
  187. idx = index;
  188. }
  189. })
  190. vm.data2 = {totalNumber:(data[0].VIEW_13_0026[idx]&&data[0].VIEW_13_0026[idx].HC_13_0017 || "--"),addNumber:(data[1].VIEW_13_0034[idx]&&data[1].VIEW_13_0034[idx].HC_13_0017 || "--"),ringRatio:(data[2].VIEW_13_0027[idx]&&data[2].VIEW_13_0027[idx].HC_13_0026 || "--")};
  191. },
  192. ycfformatData:function(data){//孕产妇数据
  193. var vm = this,idx;
  194. _.map(data[0].VIEW_16_0009,function(item,index){
  195. if(vm.town=="上饶市" && item.firstColumn=="合计"){//上饶市
  196. idx = index;
  197. }else if(item.firstColumn==vm.town){
  198. idx = index;
  199. }
  200. })
  201. vm.data3 = {totalNumber:(data[0].VIEW_16_0009[idx]&&data[0].VIEW_16_0009[idx].HC_13_0033 || "--"),addNumber:(data[1].VIEW_16_0010[idx]&&data[1].VIEW_16_0010[idx].HC_13_0033 || "--"),ringRatio:(data[2].VIEW_16_0011[idx]&&data[2].VIEW_16_0011[idx].HC_13_0035 || "--")};
  202. },
  203. lnrformatData:function(data){//老年人数据
  204. var vm = this,idx;
  205. _.map(data[0].VIEW_15_0001,function(item,index){
  206. if(vm.town=="上饶市" && item.firstColumn=="合计"){//上饶市
  207. idx = index;
  208. }else if(item.firstColumn==vm.town){
  209. idx = index;
  210. }
  211. })
  212. vm.data4 = {totalNumber:data[0].VIEW_15_0001[idx].HC_15_1006,addNumber:data[1].VIEW_15_0011[idx].HC_15_1006,ringRatio:(data[2].VIEW_15_0008[idx]&&data[2].VIEW_15_0008[idx].HC_15_1009 || "--")};
  213. },
  214. diseaseClick:function(type){
  215. this.activeIndex = type;
  216. this.cacheActiveIndex = type;
  217. if($(event.target).hasClass("icon-img")){//点击图片,则不触发重新请求数据
  218. return false;
  219. }
  220. EventBus.$emit('refresh-json-data', {type:type});//触发首页重新请求数据方法
  221. },
  222. diseaseMouseOver:function(){
  223. this.activeIndex = null;
  224. },
  225. diseaseMouseOut:function(){
  226. this.activeIndex = this.cacheActiveIndex;
  227. },
  228. detailClick:function(type){//type:0高血压 1糖尿病,2孕产妇3老年人
  229. var height = (0.42 * window.screen.width) + 'px',url=httpRequest.alertUrl;
  230. if(type==0){
  231. url += '/page/bigData/html/alert1.html';
  232. }else if(type==1){
  233. url += '/page/bigData/html/alert2.html';
  234. }else if(type==2){
  235. url += '/page/bigData/html/alert3.html';
  236. }else if(type==3){
  237. url += '/page/bigData/html/alert4.html';
  238. }
  239. var width = (0.7604 * window.screen.width) + 'px';
  240. var height = (0.41875 * window.screen.width) + 'px';
  241. top.layer.open({
  242. id: 'LAY_layuipro', //设定一个id,防止重复弹出
  243. type: 2,
  244. title: false,
  245. closeBtn: 0,
  246. shade: 0.5,
  247. shadeClose: true,
  248. area: [width, height],
  249. content: url
  250. });
  251. }
  252. },
  253. watch:{
  254. data:function(data){
  255. if(data&&data.length>0){
  256. this.data = data;
  257. this.initData();
  258. }
  259. }
  260. }
  261. })
  262. })()