manbing-tab.js 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. (function() {
  2. Vue.component('manbing-tab', {
  3. template: '<div style="position:relative;height:100%;">\
  4. <div class="sk-spinner sk-spinner-chasing-dots" v-show="!isRequestEnd" style="top: 50%;left:50%;margin-left:-0.1rem;margin-top: -0.1rem;position:absolute;">\
  5. <div class="sk-dot1"></div>\
  6. <div class="sk-dot2"></div>\
  7. </div>\
  8. <div class="slider" v-show="isRequestEnd">\
  9. <div class="btn-group slider-nav" data-toggle="buttons">\
  10. <label @click="activeTab(0)" class="btn btn-default active bullet" data-index="1"><input type="radio" name="options" autocomplete="off" checked="">全部</label>\
  11. <label @click="activeTab(1)" class="btn btn-default bullet" data-index="2"><input type="radio" name="options" autocomplete="off">高血压</label>\
  12. <label @click="activeTab(2)" class="btn btn-default bullet" data-index="3"><input type="radio" name="options" autocomplete="off">糖尿病</label>\
  13. </div>\
  14. <div class="slider-container">\
  15. <div class="slider-wrapper">\
  16. <div class="slide" v-for="(disease,index) in diseaseData">\
  17. <div class="mt20">\
  18. <div class="div-juming-info" v-for="(data,dIndex) in disease" :class="{active: (activeidx == data.diseaseIndex)}" @click="activeContent(data,index)">\
  19. <div class="div-line1"></div>\
  20. <div class="div-line2"></div>\
  21. <div class="div-line3"></div>\
  22. <div class="div-line4"></div>\
  23. <div style="clear:both;" v-if="data.diseaseCondition === 0">\
  24. <div style="width:0.47rem;margin:0 auto;float:left;" class="dis-inblock">\
  25. <img src="../images/lvbiao_icon.png" class="c-vam" />\
  26. </div>\
  27. <span class="c-B5E1FC c-f20 div-juming-color-name" style="float:left;">绿标居民&emsp;</span>\
  28. <span class="c-B5E1FC c-f26" style="float:left;">{{data.num}}</span>\
  29. </div>\
  30. <div style="clear:both;" v-if="data.diseaseCondition === 1">\
  31. <div style="width:0.47rem;margin:0 auto;float:left;" class="dis-inblock">\
  32. <img src="../images/huangbiao_icon.png" class="c-vam" />\
  33. </div>\
  34. <span class="c-B5E1FC c-f20 div-juming-color-name" style="float:left;">黄标居民&emsp;</span>\
  35. <span class="c-B5E1FC c-f26" style="float:left;">{{data.num}}</span>\
  36. </div>\
  37. <div style="clear:both;" v-if="data.diseaseCondition === 2">\
  38. <div style="width:0.47rem;margin:0 auto;float:left;" class="dis-inblock">\
  39. <img src="../images/hongbiao_icon.png" class="c-vam" />\
  40. </div>\
  41. <span class="c-B5E1FC c-f20 div-juming-color-name" style="float:left;">红标居民&emsp;</span>\
  42. <span class="c-B5E1FC c-f26" style="float:left;">{{data.num}}</span>\
  43. </div>\
  44. <div style="clear:both;" v-if="data.diseaseCondition === -1">\
  45. <div style="width:0.47rem;margin:0 auto;float:left;" class="dis-inblock">\
  46. <img src="../images/wubiao_icon.png" class="c-vam" />\
  47. </div>\
  48. <span class="c-B5E1FC c-f20 div-juming-color-name" style="float:left;">无标签居民</span>\
  49. <span class="c-B5E1FC c-f26" style="float:left;">{{data.num}}</span>\
  50. </div>\
  51. </div>\
  52. </div>\
  53. </div>\
  54. </div>\
  55. </div>\
  56. </div>\
  57. </div>',
  58. props: ["activeidx"],
  59. data: function() {
  60. return {
  61. diseaseData: [],
  62. isRequestEnd:false
  63. }
  64. },
  65. methods: {
  66. activeContent: function(data, activeIndex) {
  67. //diseaseType为tab标签的值(0:全部;1:高血压;2:糖尿病)
  68. //activeIndex为子项的值(-1:无标签;0:绿标;1黄标;2红标)
  69. var diseaseType = $(".btn-group .btn.active").index();
  70. if(this.activeidx != data.diseaseIndex) {
  71. $(".div-juming-info").removeClass("active");
  72. this.activeidx = data.diseaseIndex;
  73. }
  74. //[叶泽华 ]代码添加处
  75. EventBus.$emit('device-map-filter', {
  76. diseaseType: diseaseType,
  77. diseaseCondition: data.diseaseCondition
  78. });
  79. },
  80. activeTab: function(type) {
  81. EventBus.$emit('device-map-filter', {
  82. diseaseType: type,
  83. diseaseCondition: ""
  84. });
  85. }
  86. },
  87. mounted: function() {
  88. var _self = this;
  89. getRequestData(_self);
  90. }
  91. })
  92. function getRequestData(_self) {
  93. var url = "/svr-iot/wlyy/chronicDiseaseCount";
  94. var reqUrl = [{
  95. url: url,
  96. reqType: 'get',
  97. data: {
  98. type: ""
  99. }
  100. },
  101. {
  102. url: url,
  103. reqType: 'get',
  104. data: {
  105. type: "1"
  106. }
  107. },
  108. {
  109. url: url,
  110. reqType: 'get',
  111. data: {
  112. type: "2"
  113. }
  114. }
  115. ];
  116. httpRequest.getReqPromises(reqUrl).then(function(datas) {
  117. var allData = datas[0]; //全部tab数据
  118. var gaoxueyaData = datas[1]; //高血压tab数据
  119. var tangniaobingData = datas[2]; //糖尿病tab数据
  120. //获取全部的疾病数据
  121. if(allData.status == 200) {
  122. var allDiseaseData = allData.data.reverse();
  123. allDiseaseData = _.map(allDiseaseData, function(data, index) {
  124. data.diseaseIndex = index;
  125. return data;
  126. });
  127. _self.diseaseData.push(allDiseaseData);
  128. } else {
  129. toastr.error(allData.msg)
  130. }
  131. //获取高血压的疾病数据
  132. if(gaoxueyaData.status == 200) {
  133. var gaoXYDiseaseData = gaoxueyaData.data.reverse();
  134. gaoXYDiseaseData = _.map(gaoXYDiseaseData, function(data, index) {
  135. data.diseaseIndex = index + 4;
  136. return data;
  137. });
  138. _self.diseaseData.push(gaoXYDiseaseData);
  139. } else {
  140. toastr.error(gaoxueyaData.msg)
  141. }
  142. //获取糖尿病的疾病数据
  143. if(tangniaobingData.status == 200) {
  144. var tangLBDiseaseData = tangniaobingData.data.reverse();
  145. tangLBDiseaseData = _.map(tangLBDiseaseData, function(data, index) {
  146. data.diseaseIndex = index + 8;
  147. return data;
  148. });
  149. _self.diseaseData.push(tangLBDiseaseData);
  150. } else {
  151. toastr.error(tangniaobingData.msg)
  152. }
  153. _self.isRequestEnd = true;
  154. EventBus.$emit('data-load-complete', {});
  155. //【慢病患者情况】轮播
  156. setTimeout(function() {
  157. var slider1 = Slider.init({
  158. target: $('.slider'),
  159. time: 6000
  160. });
  161. }, 500)
  162. });
  163. }
  164. })()