dustWork.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <div class="workJc">
  3. <div class="echart-workJc" :style="{ height: heightT }">
  4. <div class="workJc-l">{{ echartDatas || '0' }}</div>
  5. <div class="workJc-r">
  6. <div class="workJc-r-box" v-for="(item, index) in fxLenged" :key="index">
  7. <div class="r-box-label">{{ item.name }}</div>
  8. <div class="r-box-val">{{ item.value || '0' }}</div>
  9. </div>
  10. </div>
  11. </div>
  12. <div class="card-workJc" :style="{ height: heightB }">
  13. <vue3-seamless-scroll hover-stop="true" :list="cardList" :hover="true" :step="0.1"
  14. class="seamless-warp">
  15. <div class="card-box" v-for="(ite, ind) in cardList" :key="ind">
  16. <div class="card-l-label">风险</div>
  17. <div class="card-l-val">{{ ite.warningLevel == 1 ? '低': ite.warningLevel == 2 ? '中' : ite.warningLevel == 3 ? '较大' : ite.warningLevel == 4 ? '重大' : '--' }}</div>
  18. <div class="card-r-label">{{ ite.label }}</div>
  19. <div class="card-r-des">
  20. <span>粉尘浓度:</span>
  21. <span style="color:#089dff">{{ ite.dust || '0' }} mg/m³</span>
  22. </div>
  23. </div>
  24. </vue3-seamless-scroll>
  25. </div>
  26. </div>
  27. </template>
  28. <script setup lang="ts">
  29. import { ref, reactive, nextTick, defineProps, watch } from 'vue';
  30. import { Vue3SeamlessScroll } from 'vue3-seamless-scroll'
  31. let props = defineProps({
  32. heightT: {
  33. type: String,
  34. default: '0%',
  35. },
  36. heightB: {
  37. type: String,
  38. default: '0%',
  39. },
  40. cardData: {
  41. type: Array,
  42. default: () => {
  43. return []
  44. }
  45. },
  46. echartData: {
  47. type: Array,
  48. default: () => {
  49. return []
  50. }
  51. }
  52. });
  53. //获取dom节点
  54. let ring = ref();
  55. let fxLenged = reactive<any[]>([]);//图表数据
  56. let echartDatas = ref(0)
  57. let cardList = ref<any[]>([]);
  58. watch(() => props.cardData, (newC, oldC) => {
  59. console.log(newC, 'newC-------')
  60. cardList.value = newC
  61. }, { immediate: true, deep: true })
  62. watch(() => props.echartData, (newV, oldV) => {
  63. console.log(newV, '图表数据------')
  64. fxLenged.length = 0
  65. if (newV.length != 0) {
  66. newV.forEach(el => {
  67. fxLenged.push({ name: el.label, value: el.value })
  68. })
  69. let maxValue = fxLenged.sort((a, b) => b.value - a.value)
  70. echartDatas.value = maxValue[0].value
  71. }
  72. }, { immediate: true, deep: true })
  73. </script>
  74. <style lang="less" scoped>
  75. .workJc {
  76. width: 100%;
  77. height: 100%;
  78. .echart-workJc {
  79. display: flex;
  80. align-items: center;
  81. justify-content: flex-start;
  82. width: 100%;
  83. .workJc-l {
  84. display: flex;
  85. align-items: center;
  86. justify-content: center;
  87. width: 110px;
  88. height: 110px;
  89. background: url('../../../../../assets/images/dust/dusthome/img-7.png') no-repeat center;
  90. background-size: 100% 100%;
  91. color: #089dff;
  92. font-size: 16px
  93. }
  94. .workJc-r {
  95. display: flex;
  96. box-sizing: border-box;
  97. flex-wrap: wrap;
  98. align-items: flex-start;
  99. justify-content: flex-start;
  100. width: calc(100% - 110px);
  101. height: 110px;
  102. padding: 0 30px;
  103. .workJc-r-box {
  104. display: flex;
  105. flex-direction: column;
  106. align-items: center;
  107. justify-content: center;
  108. width: calc(50% - 10px);
  109. height: calc(50% - 10px);
  110. padding-left: 20px;
  111. background: url('../../../../../assets/images/fire/firehome/img-1.png') no-repeat center;
  112. background-size: 100% 100%;
  113. .r-box-label {
  114. margin-bottom: 5px;
  115. color: #fff;
  116. font-size: 12px;
  117. }
  118. .r-box-val {
  119. color: #089dff;
  120. font-size: 16px;
  121. }
  122. }
  123. }
  124. }
  125. .card-workJc {
  126. position: relative;
  127. overflow: hidden;
  128. .seamless-warp {
  129. width: 100%;
  130. height: 100%;
  131. .card-box {
  132. position: relative;
  133. width: 100%;
  134. height: 155px;
  135. margin-bottom: 10px;
  136. background: url('../../../../../assets/images/fire/firehome/img-3.png') no-repeat center;
  137. background-size: 100% 100%;
  138. .card-l-label {
  139. position: absolute;
  140. top: 22px;
  141. left: 38px;
  142. color: #fff;
  143. font-size: 14px;
  144. letter-spacing: 2px;
  145. }
  146. .card-l-val {
  147. position: absolute;
  148. top: 48%;
  149. left: 50px;
  150. color: #089dff;
  151. font-size: 36px;
  152. font-weight: bold
  153. }
  154. .card-r-label {
  155. position: absolute;
  156. top: 22px;
  157. left: 150px;
  158. color: #fff;
  159. font-size: 14px;
  160. }
  161. .card-r-des {
  162. position: absolute;
  163. top: 88px;
  164. left: 150px;
  165. width: 220px;
  166. color: #fff;
  167. font-size: 14px;
  168. }
  169. }
  170. }
  171. }
  172. }
  173. </style>