DeviceWarning.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. <!-- eslint-disable vue/multi-word-component-names -->
  2. <template>
  3. <CostumeHeader>
  4. <template #select>
  5. <!-- 填写空的div以覆盖默认的选择框 -->
  6. <div></div>
  7. </template>
  8. <div class="w-200px flex flex-items-center">
  9. <RightCircleOutlined class="w-30px" />
  10. <div class="flex-grow-1">
  11. 网络断开
  12. <span> {{ warns.length }}条 </span>
  13. </div>
  14. </div>
  15. </CostumeHeader>
  16. <div class="timeline">
  17. <div v-for="(item, i) in warns" :key="`svvhccdw-${i}`" class="flex items-center timeline-item">
  18. <div class="timeline-item__icon" :class="`timeline-item__icon_${item.color}`"></div>
  19. <div class="timeline-item__dot"></div>
  20. <div class="timeline-item__label">{{ item.label }}</div>
  21. <div :class="`timeline-item__value_${item.color}`">{{ item.count }}</div>
  22. </div>
  23. <div class="position-absolute timeline-component"></div>
  24. </div>
  25. </template>
  26. <script lang="ts" setup>
  27. import { onMounted, ref } from 'vue';
  28. // import { list as cfgList } from '@/views/vent/deviceManager/configurationTable/configuration.api';
  29. // import { list } from '@/views/vent/deviceManager/deviceTable/device.api';
  30. import CostumeHeader from './CostumeHeader.vue';
  31. import { RightCircleOutlined } from '@ant-design/icons-vue';
  32. // import MiniBoard from './MiniBoard.vue';
  33. // import mapComponent from './components/3Dmap/index.vue';
  34. // 设备类别,是个枚举 TODO: 将手动换为自动获取类别
  35. // const devicekind = 'fanlocal';
  36. // const configs = ref<{ prop: string; label: string }[]>([]);
  37. // function fetchConfig() {
  38. // cfgList({
  39. // deviceType: 'devicekind',
  40. // }).then(({ records }) => {
  41. // const moduleData = JSON.parse(records[0]?.moduleData);
  42. // configs.value = Object.keys(moduleData).map((k) => {
  43. // return {
  44. // prop: k,
  45. // label: moduleData[k],
  46. // };
  47. // });
  48. // });
  49. // }
  50. const warns = ref([
  51. {
  52. label: 'test',
  53. count: 0,
  54. color: 'red',
  55. },
  56. {
  57. label: 'test',
  58. count: 0,
  59. color: 'orange',
  60. },
  61. {
  62. label: 'test',
  63. count: 0,
  64. color: 'yellow',
  65. },
  66. {
  67. label: 'test',
  68. count: 0,
  69. color: 'green',
  70. },
  71. {
  72. label: 'test',
  73. count: 0,
  74. color: 'blue',
  75. },
  76. ]);
  77. // 获取全部局扇的数据,并以选项格式返回给 Header 消费
  78. // function fetchOptions() {
  79. // return list({
  80. // devicekind,
  81. // }).then(({ records }) => {
  82. // devices.value = records;
  83. // selectDeviceByID(records[0]?.id);
  84. // return records.map((e) => {
  85. // return {
  86. // label: e.strinstallpos,
  87. // key: e.id,
  88. // };
  89. // });
  90. // });
  91. // }
  92. onMounted(() => {
  93. // fetchConfig();
  94. });
  95. </script>
  96. <style lang="less" scoped>
  97. @import '@/design/vent/color.less';
  98. .timeline-item {
  99. height: 20%;
  100. }
  101. .timeline-item__icon_red {
  102. background-image: url('@/assets/images/home-container/configurable/warn_icon_5.png');
  103. }
  104. .timeline-item__icon_orange {
  105. background-image: url('@/assets/images/home-container/configurable/warn_icon_4.png');
  106. }
  107. .timeline-item__icon_yellow {
  108. background-image: url('@/assets/images/home-container/configurable/warn_icon_3.png');
  109. }
  110. .timeline-item__icon_green {
  111. background-image: url('@/assets/images/home-container/configurable/warn_icon_2.png');
  112. }
  113. .timeline-item__icon_blue {
  114. background-image: url('@/assets/images/home-container/configurable/warn_icon_1.png');
  115. }
  116. .timeline-item__icon {
  117. width: 54px;
  118. height: 45px;
  119. margin: 0 50px 0 50px;
  120. background-repeat: no-repeat;
  121. }
  122. .timeline-item__dot {
  123. position: absolute;
  124. width: 10px;
  125. height: 10px;
  126. left: 7px;
  127. background-color: @vent-gas-primary-bg;
  128. border-radius: 5px;
  129. position: relative;
  130. }
  131. .timeline-item__dot::before {
  132. content: '';
  133. position: absolute;
  134. top: -3px;
  135. left: -3px;
  136. width: 16px;
  137. height: 16px;
  138. border-radius: 8px;
  139. border: 1px solid @vent-gas-tab-border;
  140. }
  141. .timeline-item__label {
  142. width: 100px;
  143. margin-left: 100px;
  144. }
  145. .timeline-item__value_red {
  146. color: red;
  147. }
  148. .timeline-item__value_orange {
  149. color: orange;
  150. }
  151. .timeline-item__value_yellow {
  152. color: yellow;
  153. }
  154. .timeline-item__value_green {
  155. color: yellowgreen;
  156. }
  157. .timeline-item__value_blue {
  158. color: lightblue;
  159. }
  160. .timeline {
  161. height: 220px;
  162. padding: 5px;
  163. position: relative;
  164. }
  165. .timeline-component {
  166. width: 2px;
  167. height: 180px;
  168. top: 20px;
  169. left: 170px;
  170. background-image: @vent-configurable-home-timeline;
  171. }
  172. </style>