dz-list.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. <template>
  2. <div class="dz-list">
  3. <div :class="deviceType == 'deviceManageInfo' ? 'icons-box1' : 'icons-box'" @mouseleave="resetScroll">
  4. <template v-for="(item, key) in listOption" :key="key">
  5. <div class="icon-item">
  6. <!-- <img :src="item.url" :alt="item.text" /> -->
  7. <div class="level-text">
  8. <div class="all-count">
  9. <span>{{ `${item.allText}&nbsp:&nbsp` }}</span>
  10. <span class="num-count">{{ listData[item.allCount] || 0 }}</span>
  11. </div>
  12. <div class="warn-count">
  13. <span>{{ `${item.warnText}&nbsp:&nbsp` }}</span>
  14. <span :class="item.warnCount ? 'num-count1' : 'num-count'">{{ listData[item.warnCount] || 0 }}</span>
  15. </div>
  16. <div class="close-count">
  17. <span> {{ `${item.closeText}&nbsp:&nbsp` }}</span>
  18. <span :class="item.closeCount ? 'num-count1' : 'num-count'">{{ listData[item.closeCount] || 0 }}</span>
  19. </div>
  20. </div>
  21. </div>
  22. </template>
  23. </div>
  24. </div>
  25. </template>
  26. <script setup lang="ts">
  27. import { ref, reactive, watch } from 'vue';
  28. let props = defineProps({
  29. listOption: {
  30. type: Object,
  31. default: () => {
  32. return {};
  33. },
  34. },
  35. listData: {
  36. type: Object,
  37. default: () => {
  38. return {};
  39. },
  40. },
  41. deviceType: {
  42. type: String,
  43. default: '',
  44. },
  45. });
  46. const resetScroll = (e: Event) => {
  47. if (e.target && e.target) (e.target as Element).scrollTop = 0;
  48. };
  49. watch(
  50. () => props.listData,
  51. (newV, oldV) => {
  52. console.log(newV, '设备');
  53. },
  54. { immediate: true, deep: true }
  55. );
  56. </script>
  57. <style lang="less" scoped>
  58. @import '/@/design/theme.less';
  59. @{theme-deepblue} {
  60. .dz-list {
  61. --image-model_icon-item: url('@/assets/images/themify/deepblue/home-container/configurable/1600.png');
  62. }
  63. }
  64. .dz-list {
  65. --image-model_icon-item: url('@/assets/images/home-green/1600.png');
  66. width: 100%;
  67. height: 100%;
  68. }
  69. .icons-box {
  70. height: 100%;
  71. overflow-y: hidden;
  72. &:hover {
  73. overflow-y: auto;
  74. overflow-x: auto;
  75. }
  76. .icon-item {
  77. position: relative;
  78. width: 100%;
  79. height: 46px;
  80. background: var(--image-model_icon-item) no-repeat;
  81. background-size: 100% 100%;
  82. display: flex;
  83. align-items: center;
  84. justify-content: center;
  85. margin: 5px auto;
  86. &:nth-child(even) {
  87. padding-right: 0px;
  88. }
  89. .level-text {
  90. width: 76%;
  91. display: flex;
  92. justify-content: space-around;
  93. position: absolute;
  94. top: 10px;
  95. left: 76px;
  96. color: #ffffffe0;
  97. font-size: 14px;
  98. text-align: center;
  99. letter-spacing: 1px;
  100. .num-count,
  101. .num-count1 {
  102. font-family: 'douyuFont';
  103. font-size: 12px;
  104. }
  105. .warn-count,
  106. .close-count {
  107. .num-count {
  108. color: #ffffffe0;
  109. }
  110. .num-count1 {
  111. color: #ff0000;
  112. }
  113. }
  114. }
  115. img {
  116. width: 100%;
  117. height: 60px;
  118. }
  119. }
  120. }
  121. .icons-box1 {
  122. width: 100%;
  123. height: 100%;
  124. display: flex;
  125. flex-wrap: wrap;
  126. gap: 10px;
  127. overflow-y: hidden;
  128. padding: 5px;
  129. box-sizing: border-box;
  130. &:hover {
  131. overflow-y: auto;
  132. }
  133. .icon-item {
  134. flex: 0 0 calc(50% - 5px);
  135. height: 46px;
  136. background: var(--image-model_icon-item) no-repeat;
  137. background-size: 100% 100%;
  138. position: relative;
  139. display: flex;
  140. align-items: center;
  141. justify-content: center;
  142. .level-text {
  143. width: 76%;
  144. display: flex;
  145. justify-content: space-around;
  146. position: absolute;
  147. top: 10px;
  148. left: 76px;
  149. color: #ffffffe0;
  150. font-size: 14px;
  151. text-align: center;
  152. letter-spacing: 1px;
  153. .num-count,
  154. .num-count1 {
  155. font-family: 'douyuFont';
  156. font-size: 12px;
  157. }
  158. .warn-count,
  159. .close-count {
  160. .num-count {
  161. color: #ffffffe0;
  162. }
  163. .num-count1 {
  164. color: #ff0000;
  165. }
  166. }
  167. }
  168. img {
  169. width: 100%;
  170. height: 60px;
  171. }
  172. }
  173. }
  174. </style>