List.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <template>
  2. <div>
  3. <common @asynCallBack="asynCallBack"></common>
  4. <top-header :pageTitle="pageTitle"></top-header>
  5. <div class="mui-content">
  6. <div class="mui-content-padded">
  7. <h5>
  8. 设备列表
  9. <span class='mui-pull-right'>
  10. <span class="color55f868">在线</span> {{onNum}} 台 / <span class="colorfe616c">离线</span> {{offNum}} 台
  11. </span>
  12. </h5>
  13. </div>
  14. <ul class="mui-table-view">
  15. <li class="mui-table-view-cell mui-media" v-for="(device,index) in devices">
  16. <a>
  17. <div class="mui-media-body flew-sp">
  18. {{index+1}}.{{device.aliasName}}
  19. <h4 class='flew-items'>
  20. <span class="vongi-sbzt-yuan " :class="device.isOnline?'yuan-green':'yuan-red'"></span>
  21. {{device.isOnline?'在线':'离线'}}
  22. </h4>
  23. </div>
  24. </a>
  25. </li>
  26. </ul>
  27. </div>
  28. <loading :visible="isLoading"></loading>
  29. </div>
  30. </template>
  31. <script>
  32. import * as API_Device from '@/apis/Common/device'
  33. import Common from '$project/components/Common.vue'
  34. import Loading from '$project/components/Loading.vue'
  35. import TopHeader from '$project/components/TopHeader.vue'
  36. import {
  37. mapGetters,
  38. mapMutations
  39. } from 'vuex'
  40. export default {
  41. name: 'CommonDeviceList',
  42. components: {
  43. Common,
  44. Loading,
  45. TopHeader
  46. },
  47. data() {
  48. return {
  49. pageTitle: '设备列表',
  50. devices: [],
  51. isLoading: false,
  52. onNum: 0,
  53. offNum: 0,
  54. }
  55. },
  56. created() {
  57. this.pageTitle = this.person_data.companyName;
  58. },
  59. methods: {
  60. //获取列表
  61. getList() {
  62. API_Device.listOfDevice({
  63. pageIndex: 1,
  64. pageSize: 500,
  65. schoolId: this.person_data.companyId
  66. }).then(data => {
  67. this.devices = data.data;
  68. for (var i in data.data) {
  69. if (data.data[i].isOnline) {
  70. this.onNum++;
  71. } else {
  72. this.offNum++;
  73. }
  74. }
  75. }).catch(error => {
  76. this.isLoading = false;
  77. mui.toast(error);
  78. })
  79. },
  80. asynCallBack() {
  81. },
  82. },
  83. mounted() {
  84. //获取列表
  85. this.getList();
  86. },
  87. destroyed() {},
  88. computed: {
  89. ...mapGetters({
  90. openId: 'wx_openid',
  91. token: 'token',
  92. person_data: 'person_data',
  93. person_popedom: 'person_popedom',
  94. })
  95. }
  96. }
  97. </script>
  98. <style scoped src="$project/assets/css/xpwyfyy.css"></style>
  99. <style>
  100. </style>