air.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <div class="yui-tree-box">
  3. <project-item-tree @treeclick="treeclick" iconfontClass="el-icon-place"></project-item-tree>
  4. <div class="hui-tree-content">
  5. <div class="hui-flex hui-content box-background">
  6. <div class="hui-content-title">
  7. <div class="hui-title-item active">空气检测</div>
  8. </div>
  9. <div class="hui-flex-box hui-no-tips" v-if="list.length === 0">
  10. <empty description="暂无空气检测设备"></empty>
  11. </div>
  12. <div class="hui-flex-box smell-list" v-else>
  13. <div class="smell-item" v-for="(item,index) in list" :key="index">
  14. <div class="smell-item-title">
  15. <i class="iconfont huifont-shouye"></i>
  16. <span>{{item.name}}</span>
  17. </div>
  18. <div class="smell-item-box">
  19. <div class="smell-item-row">
  20. <div class="smell-item-label">
  21. <div class="smell-item-value alibaba color-green">{{item.temperature}}</div>
  22. <div class="smell-item-name">温度(°C)</div>
  23. </div>
  24. <div class="smell-item-label">
  25. <div class="smell-item-value alibaba color-green">{{item.tVoc}}</div>
  26. <div class="smell-item-name">Tvoc(ppm)</div>
  27. </div>
  28. </div>
  29. <div class="smell-item-row">
  30. <div class="smell-item-label">
  31. <div class="smell-item-value alibaba color-green">{{item.humidity}}</div>
  32. <div class="smell-item-name">湿度(%)</div>
  33. </div>
  34. <div class="smell-item-label">
  35. <div class="smell-item-value color-green">{{item.pm25}}</div>
  36. <div class="smell-item-name">PM2.5(ug/m3)</div>
  37. </div>
  38. </div>
  39. <div class="smell-item-row">
  40. <div class="smell-item-label">
  41. <div class="smell-item-value alibaba color-green">{{item.co2}}</div>
  42. <div class="smell-item-name">CO2(ppm)</div>
  43. </div>
  44. <div class="smell-item-label">
  45. <div class="smell-item-value alibaba color-green">{{item.pm10}}</div>
  46. <div class="smell-item-name">PM10(ug/m3)</div>
  47. </div>
  48. </div>
  49. </div>
  50. </div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </template>
  56. <script>
  57. import projectItemTree from '@/components/common/projectItemTree'
  58. import {
  59. getAirList
  60. } from '@/httpApi/test'
  61. export default {
  62. components: {
  63. projectItemTree
  64. },
  65. data() {
  66. return {
  67. list: []
  68. }
  69. },
  70. created() {
  71. this.init();
  72. },
  73. methods: {
  74. init(option) {
  75. let postData = {
  76. type: this.type,
  77. projectId: this.$store.getters.project.id
  78. }
  79. if (option) postData = Object.assign(postData, option);
  80. getAirList(postData).then(res => {
  81. if (res.state) {
  82. this.list = res.data.dataList;
  83. }
  84. })
  85. },
  86. treeclick(item) {
  87. let obj = item.id ? {
  88. projectItemTargetId: item.id
  89. } : {};
  90. this.init(obj);
  91. },
  92. },
  93. }
  94. </script>
  95. <style lang="scss">
  96. .smell-list {
  97. padding: 15px 0 0 15px;
  98. display: flex;
  99. flex-wrap: wrap;
  100. align-content: flex-start;
  101. .smell-item {
  102. width: 276px;
  103. height: 160px;
  104. background: #232A37;
  105. border-radius: 2px;
  106. overflow: hidden;
  107. margin-right: 15px;
  108. margin-bottom: 15px;
  109. .smell-item-title {
  110. width: 276px;
  111. height: 40px;
  112. background: #2B3446;
  113. display: flex;
  114. align-items: center;
  115. padding: 0 13px;
  116. border-bottom: 1px solid $--color-border;
  117. .huifont-shouye {
  118. font-size: 22px;
  119. opacity: 0.7;
  120. margin-right: 4px;
  121. }
  122. }
  123. .smell-item-box {
  124. display: flex;
  125. flex-wrap: wrap;
  126. padding-left: 14px;
  127. padding-top: 10px;
  128. }
  129. .smell-item-row {
  130. padding-right: 14px;
  131. }
  132. .smell-item-label {
  133. overflow: hidden;
  134. height: 40px;
  135. display: flex;
  136. flex-direction: column;
  137. justify-content: center;
  138. margin-bottom: 14px;
  139. .smell-item-name {
  140. font-size: 12px;
  141. }
  142. }
  143. }
  144. }
  145. </style>