device-banding.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. (function() {
  2. Vue.component('device-banding', {
  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="f-tac f-clb div-banding-content" v-show="isRequestEnd">\
  9. <div class="mt20 div-all-bang-count" v-show="isProduction==0">\
  10. <div class="dis-inblock c-pr">\
  11. <div class="mt20 c-f14 c-B5E1FC div-yujing-name">预警人数(人)</div>\
  12. <div class="mr60 div-renshu_img">\
  13. <div class="c-f30 c-B5E1FC div-yujing-count">{{allYJCount}}</div>\
  14. </div>\
  15. </div>\
  16. <div class="dis-inblock c-pr">\
  17. <div class="mt20 c-f14 c-B5E1FC div-bangding-name">绑定人数(人)</div>\
  18. <div class="div-renshu_img">\
  19. <div class="c-f30 c-B5E1FC div-banding-count">{{allBDCount}}</div>\
  20. </div>\
  21. </div>\
  22. </div>\
  23. <div class="mt20 div-gxy-bang-count" v-show="isProduction==1">\
  24. <div class="dis-inblock c-pr">\
  25. <div class="mt20 c-f14 c-B5E1FC div-yujing-name">预警人数(人)</div>\
  26. <div class="mr60 div-renshu_img">\
  27. <div class="c-f30 c-B5E1FC div-yujing-count">{{xyjYJCount}}</div>\
  28. </div>\
  29. </div>\
  30. <div class="dis-inblock c-pr">\
  31. <div class="mt20 c-f14 c-B5E1FC div-bangding-name">绑定人数(人)</div>\
  32. <div class="div-renshu_img">\
  33. <div class="c-f30 c-B5E1FC div-banding-count">{{xyjBDCount}}</div>\
  34. </div>\
  35. </div>\
  36. </div>\
  37. <div class="mt20 div-tnb-bang-count" v-show="isProduction==2">\
  38. <div class="dis-inblock c-pr">\
  39. <div class="mt20 c-f14 c-B5E1FC div-yujing-name">预警人数(人)</div>\
  40. <div class="mr60 div-renshu_img">\
  41. <div class="c-f30 c-B5E1FC div-yujing-count">{{xtyYJCount}}</div>\
  42. </div>\
  43. </div>\
  44. <div class="dis-inblock c-pr">\
  45. <div class="mt20 c-f14 c-B5E1FC div-bangding-name">绑定人数(人)</div>\
  46. <div class="div-renshu_img">\
  47. <div class="c-f30 c-B5E1FC div-banding-count">{{xtyBDCount}}</div>\
  48. </div>\
  49. </div>\
  50. </div>\
  51. </div>\
  52. </div>',
  53. props: [],
  54. data: function() {
  55. return {
  56. isProduction: 0,
  57. allYJCount: null,
  58. allBDCount: null,
  59. xtyYJCount: null,
  60. xtyBDCount: null,
  61. xyjYJCount: null,
  62. xyjBDCount: null,
  63. isRequestEnd: false
  64. }
  65. },
  66. methods: {
  67. changeProduction: function(num) {
  68. this.isProduction = num;
  69. }
  70. },
  71. mounted: function() {
  72. var _self = this;
  73. EventBus.$on('get-banding-info', function(arg) {
  74. var type = arg.type;
  75. if(type == "") { //全部
  76. _self.changeProduction(0);
  77. } else if(type == "1") { //血压计
  78. _self.changeProduction(1);
  79. } else if(type == "2") { //血糖仪
  80. _self.changeProduction(2);
  81. }
  82. });
  83. var url = "/svr-iot/wlyy/deviceBinding";
  84. var reqUrl = [{
  85. url: url,
  86. reqType: 'get',
  87. data: {
  88. type: ""
  89. }
  90. },
  91. {
  92. url: url,
  93. reqType: 'get',
  94. data: {
  95. type: "1"
  96. }
  97. },
  98. {
  99. url: url,
  100. reqType: 'get',
  101. data: {
  102. type: "2"
  103. }
  104. }
  105. ];
  106. httpRequest.getReqPromises(reqUrl).then(function(datas) {
  107. var allData = datas[0]; //全部tab数据
  108. var tangniaobingData = datas[1]; //糖尿病tab数据
  109. var gaoxueyaData = datas[2]; //高血压tab数据
  110. if(allData.status == 200) {
  111. var data = allData.data;
  112. _self.allYJCount = data[1].num;
  113. _self.allBDCount = data[0].num;
  114. }
  115. if(gaoxueyaData.status == 200) {
  116. var data = gaoxueyaData.data;
  117. _self.xyjYJCount = data[1].num;
  118. _self.xyjBDCount = data[0].num;
  119. }
  120. if(tangniaobingData.status == 200) {
  121. var data = tangniaobingData.data;
  122. _self.xtyYJCount = data[1].num;
  123. _self.xtyBDCount = data[0].num;
  124. }
  125. _self.isRequestEnd = true;
  126. })
  127. }
  128. })
  129. })()