dustPage.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344
  1. <template>
  2. <div class="dustPage">
  3. <div class="top-area">
  4. <div :class="activeIndex == index ? 'top-box1' : 'top-box'" v-for="(item, index) in topAreaList" :key="index"
  5. @click="topAreaClick(index)">
  6. <div class="top-title">{{ item.title }}</div>
  7. <div class="top-content">
  8. <div class="content-item" v-for="(items, ind) in item.content" :key="ind">
  9. <span class="item-label">{{ items.label }}</span>
  10. <span class="item-value">{{ items.value }}</span>
  11. </div>
  12. </div>
  13. </div>
  14. </div>
  15. <!-- <div class="center-area">
  16. <div class="center-t">
  17. <div class="t-box" v-for="(item, index) in centerAreaListT" :key="index">
  18. <div class="box-label">{{ item.label }}</div>
  19. </div>
  20. </div>
  21. <div class="center-b">
  22. <div class="b-box" v-for="(item, index) in centerAreaListB" :key="index">
  23. <div class="box-label">{{ item.content }}</div>
  24. </div>
  25. </div>
  26. </div> -->
  27. <div class="bot-area">
  28. <echartLine :echartDataGq="echartDataFc" :maxY="maxY"></echartLine>
  29. </div>
  30. </div>
  31. </template>
  32. <script lang="ts" setup>
  33. import { ref, computed, reactive, watch, defineProps } from 'vue';
  34. // import { centerAreaListT, } from '../fire.data'
  35. import echartLine from './common/echartLine.vue'
  36. let props = defineProps({
  37. listData: Object,
  38. });
  39. let maxY = ref(3)
  40. //顶部区域数据
  41. let topAreaList = reactive<any[]>([])
  42. //顶部区域激活选项
  43. let activeIndex = ref(0)
  44. //中间区域数据
  45. // let centerAreaListB = reactive<any[]>([])
  46. let choiceData = reactive<any[]>([])
  47. //粉尘图表数据
  48. let echartDataFc = reactive({
  49. maxData: {
  50. lengedData: '粉尘浓度',
  51. data: []
  52. },
  53. minData: {
  54. lengedData: '粉尘呼尘占比(%)',
  55. data: []
  56. },
  57. aveValue: {
  58. lengedData: '总尘浓度',
  59. data: []
  60. },
  61. xData: []
  62. })
  63. //顶部区域选项切换
  64. function topAreaClick(index) {
  65. activeIndex.value = index
  66. // centerAreaListB.length = 0
  67. echartDataFc.maxData.data.length = 0
  68. echartDataFc.minData.data.length = 0
  69. echartDataFc.aveValue.data.length = 0
  70. echartDataFc.xData.length = 0
  71. // centerAreaListB.push(
  72. // { content: choiceData[index].readData.dustval || '/' },
  73. // { content: choiceData[index].readData.totalDust || '/' },
  74. // { content: choiceData[index].readData.breathWeighted || '/' },
  75. // { content: choiceData[index].readData.atomizingState || '/' },
  76. // )
  77. choiceData[index].history.forEach(el => {
  78. echartDataFc.maxData.data.push(el.dustval)
  79. echartDataFc.minData.data.push(el.ratio)
  80. echartDataFc.aveValue.data.push(el.totalDust)
  81. echartDataFc.xData.push(el.time)
  82. })
  83. }
  84. watch(() => props.listData, (val) => {
  85. if (JSON.stringify(val.common) != '{}') {
  86. topAreaList.length = 0
  87. let dustList=val.common.dust.slice(0,3)
  88. dustList.forEach(el => {
  89. topAreaList.push({
  90. title: el.strinstallpos,
  91. content: [
  92. { ids: 0, label: '温度(°C)', value: el.readData.temperature || '--', },
  93. { ids: 1, label: '粉尘浓度(%)', value: el.readData.dustval || '--', },
  94. { ids: 2, label: '喷雾水压', value: el.readData.waterPressure || '--', },
  95. { ids: 3, label: '喷雾状态', value: el.readData.atomizingState || '--', },
  96. ],
  97. },)
  98. })
  99. choiceData = val.common.dust
  100. // centerAreaListB.length = 0
  101. echartDataFc.maxData.data.length = 0
  102. echartDataFc.minData.data.length = 0
  103. echartDataFc.aveValue.data.length = 0
  104. echartDataFc.xData.length = 0
  105. if (choiceData[activeIndex.value]) {
  106. // centerAreaListB.push(
  107. // { content: choiceData[activeIndex.value].readData.dustval || '--' },
  108. // { content: choiceData[activeIndex.value].readData.totalDust || '--' },
  109. // { content: choiceData[activeIndex.value].readData.breathWeighted || '--'},
  110. // { content: choiceData[activeIndex.value].readData.atomizingState || '--' },
  111. // )
  112. choiceData[activeIndex.value].history.forEach(el => {
  113. echartDataFc.maxData.data.push(el.dustval)
  114. echartDataFc.minData.data.push(el.ratio)
  115. echartDataFc.aveValue.data.push(el.totalDust)
  116. echartDataFc.xData.push(el.time)
  117. })
  118. } else {
  119. activeIndex.value = 0
  120. // centerAreaListB.push(
  121. // { content: choiceData[activeIndex.value].readData.dustval || '--' },
  122. // { content: choiceData[activeIndex.value].readData.totalDust || '--' },
  123. // { content: choiceData[activeIndex.value].readData.breathWeighted || '--' },
  124. // { content: choiceData[activeIndex.value].readData.atomizingState || '--' },
  125. // )
  126. choiceData[activeIndex.value].history.forEach(el => {
  127. echartDataFc.maxData.data.push(el.dustval)
  128. echartDataFc.minData.data.push(el.ratio)
  129. echartDataFc.aveValue.data.push(el.totalDust)
  130. echartDataFc.xData.push(el.time)
  131. })
  132. }
  133. }
  134. }, { deep: true })
  135. </script>
  136. <style lang="less" scoped>
  137. .dustPage {
  138. width: 100%;
  139. height: 100%;
  140. padding: 20px;
  141. box-sizing: border-box;
  142. .top-area {
  143. height: 183px;
  144. display: flex;
  145. // justify-content: space-between;
  146. justify-content: flex-start;
  147. margin-bottom: 10px;
  148. .top-box {
  149. position: relative;
  150. width: 480px;
  151. height: 160px;
  152. background: url('../../../../../assets//images/fire/fc-t.png') no-repeat;
  153. margin: 0px 20px;
  154. .top-title {
  155. width: 80%;
  156. text-align: center;
  157. position: absolute;
  158. left: 50%;
  159. top: 6px;
  160. transform: translate(-50%, 0);
  161. }
  162. .top-content {
  163. position: absolute;
  164. top: 33px;
  165. left: 0;
  166. width: 100%;
  167. height: calc(100% - 33px);
  168. display: flex;
  169. justify-content: flex-start;
  170. align-items: flex-start;
  171. flex-wrap: wrap;
  172. cursor: pointer;
  173. .content-item {
  174. position: relative;
  175. width: 50%;
  176. height: 50%;
  177. background: url('../../../../../assets/images/fire/content-item.png') no-repeat center;
  178. .item-label {
  179. position: absolute;
  180. left: 52px;
  181. top: 50%;
  182. transform: translate(0, -44%);
  183. font-size: 12px;
  184. }
  185. .item-value {
  186. position: absolute;
  187. right: 52px;
  188. top: 50%;
  189. transform: translate(0, -44%);
  190. font-size: 12px;
  191. font-family: 'douyuFont';
  192. color: #3df6ff;
  193. }
  194. }
  195. }
  196. }
  197. .top-box1 {
  198. position: relative;
  199. width: 480px;
  200. height: 183px;
  201. background: url('../../../../../assets//images/fire/fc-t1.png') no-repeat;
  202. margin: 0px 20px;
  203. .top-title {
  204. width: 80%;
  205. text-align: center;
  206. position: absolute;
  207. left: 50%;
  208. top: 6px;
  209. transform: translate(-50%, 0);
  210. }
  211. .top-content {
  212. position: absolute;
  213. top: 33px;
  214. left: 0;
  215. width: 100%;
  216. height: calc(100% - 33px);
  217. display: flex;
  218. justify-content: flex-start;
  219. align-items: flex-start;
  220. flex-wrap: wrap;
  221. padding-bottom: 20px;
  222. box-sizing: border-box;
  223. cursor: pointer;
  224. .content-item {
  225. position: relative;
  226. width: 50%;
  227. height: 50%;
  228. background: url('../../../../../assets/images/fire/content-item.png') no-repeat center;
  229. .item-label {
  230. position: absolute;
  231. left: 52px;
  232. top: 50%;
  233. transform: translate(0, -44%);
  234. font-size: 12px;
  235. }
  236. .item-value {
  237. position: absolute;
  238. right: 52px;
  239. top: 50%;
  240. transform: translate(0, -44%);
  241. font-size: 12px;
  242. font-family: 'douyuFont';
  243. color: #3df6ff;
  244. }
  245. }
  246. }
  247. }
  248. }
  249. // .center-area {
  250. // height: 258px;
  251. // margin-bottom: 20px;
  252. // background: url('../../../../../assets/images/fire/bj1.png') no-repeat;
  253. // background-size: 100% 100%;
  254. // .center-t {
  255. // height: 50%;
  256. // padding: 0px 80px;
  257. // display: flex;
  258. // justify-content: space-around;
  259. // align-items: center;
  260. // background: url('../../../../../assets/images/fire/dz.png') no-repeat;
  261. // background-size: 100% 100%;
  262. // box-sizing: border-box;
  263. // .t-box {
  264. // width: 218px;
  265. // height: 97px;
  266. // background: url('../../../../../assets/images/fire/dz1.png') no-repeat;
  267. // .box-label {
  268. // text-align: center;
  269. // }
  270. // }
  271. // }
  272. // .center-b {
  273. // height: 50%;
  274. // padding: 0px 80px;
  275. // display: flex;
  276. // justify-content: space-around;
  277. // align-items: center;
  278. // box-sizing: border-box;
  279. // .b-box {
  280. // width: 218px;
  281. // height: 97px;
  282. // display: flex;
  283. // flex-direction: column;
  284. // justify-content: center;
  285. // align-items: center;
  286. // .box-label {
  287. // width: 169px;
  288. // height: 42px;
  289. // line-height: 42px;
  290. // text-align: center;
  291. // margin-bottom: 5px;
  292. // color: #3df6ff;
  293. // font-family: 'douyuFont';
  294. // background: url('../../../../../assets/images/fire/dz2.png') no-repeat;
  295. // }
  296. // }
  297. // }
  298. // }
  299. .bot-area {
  300. // height: calc(100% - 471px);
  301. height: calc(100% - 193px);
  302. background: url('../../../../../assets/images/fire/bj1.png') no-repeat;
  303. background-size: 100% 100%;
  304. }
  305. }
  306. </style>