device-info.js 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. (function(){
  2. Vue.component('device-section', {
  3. template: '<div class="panel-box panel-box2">\
  4. <h4 class="c-b5e1fc c-f16 c-t-center">健康设备</h4>\
  5. <div v-show="hasData" class="device-scroll-panel mt10">\
  6. <ul>\
  7. <li v-for="(device, index) in deviceInfo" class="ui-grid ui-grid-middle" :class="{mt20: index>0}">\
  8. <div class="ui-col-0">\
  9. <img :src="device.photo" class="device-img">\
  10. </div>\
  11. <div class="ui-col-1">\
  12. <div class="c-f14 c-b5e1fc">{{device.categoryCode == 1 ? "血糖仪" : "血压计"}}</div>\
  13. <div class="c-f12 c-b5e1fc">生产厂商<span class="ml20">{{device.deviceName}}</span></div>\
  14. </div>\
  15. </li>\
  16. </ul>\
  17. </div>\
  18. <div v-show="!hasData" class="no-result-panel">\
  19. <div class="no-result-img">\
  20. <img src="../images/wushuju_icon.png">\
  21. </div>\
  22. <div class="no-result-text">暂无相关设备数据</div>\
  23. </div>\
  24. </div>',
  25. props: ['patient'],
  26. data: function() {
  27. return {
  28. deviceInfo: [],
  29. hasData: true
  30. }
  31. },
  32. mounted: function() {
  33. var vm = this;
  34. getDeviceInfo(vm);
  35. },
  36. });
  37. function getDeviceInfo(vm){
  38. var params = {
  39. patient: vm.patient
  40. };
  41. patientAPI.getDeviceInfo(params).then(function(res){
  42. if(res.status == 200){
  43. vm.deviceInfo = res.data;
  44. if(res.data.length > 0){
  45. vm.hasData = true;
  46. }else{
  47. vm.hasData = false;
  48. }
  49. }else{
  50. console.log(res.msg);
  51. }
  52. })
  53. }
  54. })()