ventilate.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333
  1. <template>
  2. <div class="dustPage">
  3. <div class="top-area">
  4. <div class="top-box" v-for="(item, index) in topAreaList" :key="index">
  5. <div class="top-title">{{ item.title }}</div>
  6. <div class="top-content">
  7. <div class="content-item" v-for="(items, ind) in item.content" :key="ind">
  8. <span class="item-label">{{ items.label }}</span>
  9. <span :class="{
  10. 'item-value1': items.value == 0,
  11. 'item-value2': items.value == 101,
  12. 'item-value3': items.value == 102,
  13. 'item-value4': items.value == 103,
  14. 'item-value5': items.value == 104,
  15. 'item-value6': items.value == 201,
  16. 'item-value': items.value != 0 && items.value != 101 && items.value != 102 && items.value != 103 && items.value != 104 && items.value != 201,
  17. }">{{ items.value == 0 ? '正常' : items.value == 101 ? '较低风险' : items.value == 102 ? '低风险' : items.value ==
  18. 103 ?
  19. '中风险' : items.value == 104 ? '高风险' : items.value == 201 ? '报警' : items.value }}</span>
  20. </div>
  21. </div>
  22. </div>
  23. </div>
  24. <div class="center-area">
  25. <div class="center-t">
  26. <div class="t-box" v-for="(item, index) in centerAreaListT1" :key="index">
  27. <div class="box-label">{{ item.label }}</div>
  28. </div>
  29. </div>
  30. <div class="center-b">
  31. <div class="b-box" v-for="(item, index) in centerAreaListB1" :key="index">
  32. <div class="box-label">{{ item.content }}</div>
  33. </div>
  34. </div>
  35. </div>
  36. <div class="bot-area">
  37. <echartLine :echartDataGq="echartDataFc1" :maxY="maxY" :echartDw="echartDw" />
  38. </div>
  39. </div>
  40. </template>
  41. <script lang="ts" setup>
  42. import { ref, nextTick, reactive, watch, defineProps } from 'vue';
  43. import { centerAreaListT1, centerAreaListB1 } from '../fire.data';
  44. import echartLine from './common/echartLine.vue';
  45. let props = defineProps({
  46. listData: Object,
  47. });
  48. let maxY = ref(0)
  49. let echartDw = ref('(m³/min)')
  50. //报警区域数据
  51. let topAreaList = reactive<any[]>([]);
  52. //通风图表数据
  53. const echartDataFc1 = reactive({
  54. maxData: {
  55. lengedData: '进风量',
  56. data: []
  57. },
  58. minData: {
  59. lengedData: '回风量',
  60. data: []
  61. },
  62. xData: [],
  63. });
  64. function formatRoundNum(num) {
  65. let interger = Math.ceil(num)
  66. let leng = String(interger).length
  67. return Math.ceil(interger / Math.pow(10, leng - 1)) * Math.pow(10, leng - 1)
  68. }
  69. watch(
  70. () => props.listData,
  71. (val) => {
  72. console.log(val, '详情数据');
  73. if (JSON.stringify(val.common) != '{}') {
  74. echartDataFc1.maxData.data.length = 0;
  75. echartDataFc1.minData.data.length = 0;
  76. echartDataFc1.xData.length = 0;
  77. topAreaList.length = 0;
  78. if (val.common.warnDevices.length != 0) {
  79. val.common.warnDevices.forEach((el) => {
  80. topAreaList.push({
  81. title: el.typeName,
  82. content: [
  83. { ids: 0, label: '设备类型', value: '工作面风量' },
  84. {
  85. ids: 1,
  86. label: '报警等级',
  87. value: el.datalist[0].warnLevel || 0,
  88. },
  89. { ids: 2, label: '报警描述', value: el.datalist[0].warnDes || '--' },
  90. ],
  91. });
  92. });
  93. } else {
  94. topAreaList.push({
  95. title: '工作面',
  96. content: [
  97. { ids: 0, label: '设备类型', value: '工作面风量' },
  98. {
  99. ids: 1,
  100. label: '报警等级',
  101. value: val.common.warnLevel || '正常',
  102. },
  103. { ids: 2, label: '报警描述', value: '--' },
  104. ],
  105. });
  106. }
  107. centerAreaListB1[0].content = val.common.jin || '--';
  108. centerAreaListB1[1].content = val.common.hui || '--';
  109. centerAreaListB1[2].content = val.common.xufengliang || '--';
  110. val.common.history.forEach((v) => {
  111. echartDataFc1.maxData.data.push(parseFloat(v.jin));
  112. echartDataFc1.minData.data.push(parseFloat(v.hui));
  113. echartDataFc1.xData.push(v.time);
  114. });
  115. let max1 = echartDataFc1.maxData.data.reduce((acr, cur) => {
  116. return acr > cur ? acr : cur
  117. })
  118. let max2 = echartDataFc1.minData.data.reduce((acr1, cur1) => {
  119. return acr1 > cur1 ? acr1 : cur1
  120. })
  121. maxY.value = max1 >= max2 ? formatRoundNum(max1 * 2) : formatRoundNum(max2 * 2)
  122. }
  123. },
  124. { deep: true }
  125. );
  126. </script>
  127. <style lang="less" scoped>
  128. .dustPage {
  129. width: 100%;
  130. height: 100%;
  131. padding: 20px;
  132. box-sizing: border-box;
  133. .top-area {
  134. height: 24%;
  135. display: flex;
  136. justify-content: space-between;
  137. margin-bottom: 10px;
  138. .top-box {
  139. position: relative;
  140. width: 32%;
  141. height: 88%;
  142. background: url('../../../../../assets//images/fire/fc-t.png') no-repeat;
  143. background-size: 100% 100%;
  144. .top-title {
  145. position: absolute;
  146. left: 50%;
  147. top: 4%;
  148. transform: translate(-50%, 0);
  149. }
  150. .top-content {
  151. position: absolute;
  152. top: 20%;
  153. left: 0;
  154. width: 100%;
  155. height: 80%;
  156. display: flex;
  157. justify-content: flex-start;
  158. align-items: flex-start;
  159. flex-wrap: wrap;
  160. cursor: pointer;
  161. .content-item {
  162. position: relative;
  163. width: 50%;
  164. height: 50%;
  165. background: url('../../../../../assets/images/fire/content-item.png') no-repeat center;
  166. background-size: 72% 54%;
  167. .item-label {
  168. position: absolute;
  169. left: 20%;
  170. top: 50%;
  171. transform: translate(0, -44%);
  172. font-size: 12px;
  173. }
  174. .item-value {
  175. position: absolute;
  176. right: 21%;
  177. top: 50%;
  178. transform: translate(0, -32%);
  179. font-size: 12px;
  180. font-family: 'douyuFont';
  181. color: #3df6ff;
  182. }
  183. .item-value1 {
  184. position: absolute;
  185. right: 21%;
  186. top: 50%;
  187. transform: translate(0, -32%);
  188. font-size: 12px;
  189. font-family: 'douyuFont';
  190. color: rgb(145, 230, 9);
  191. }
  192. .item-value2 {
  193. position: absolute;
  194. right: 21%;
  195. top: 50%;
  196. transform: translate(0, -32%);
  197. font-size: 12px;
  198. font-family: 'douyuFont';
  199. color: rgb(0, 242, 255);
  200. }
  201. .item-value3 {
  202. position: absolute;
  203. right: 21%;
  204. top: 50%;
  205. transform: translate(0, -32%);
  206. font-size: 12px;
  207. font-family: 'douyuFont';
  208. color: #ffff35;
  209. }
  210. .item-value4 {
  211. position: absolute;
  212. right: 21%;
  213. top: 50%;
  214. transform: translate(0, -32%);
  215. font-size: 12px;
  216. font-family: 'douyuFont';
  217. color: #ffbe69;
  218. }
  219. .item-value5 {
  220. position: absolute;
  221. right: 21%;
  222. top: 50%;
  223. transform: translate(0, -32%);
  224. font-size: 12px;
  225. font-family: 'douyuFont';
  226. color: #ff6f00;
  227. }
  228. .item-value6 {
  229. position: absolute;
  230. right: 21%;
  231. top: 50%;
  232. transform: translate(0, -32%);
  233. font-size: 12px;
  234. font-family: 'douyuFont';
  235. color: #ff0000;
  236. }
  237. }
  238. }
  239. }
  240. }
  241. .center-area {
  242. height: 34%;
  243. margin-bottom: 20px;
  244. background: url('../../../../../assets/images/fire/bj1.png') no-repeat;
  245. background-size: 100% 100%;
  246. .center-t {
  247. height: 50%;
  248. display: flex;
  249. justify-content: space-around;
  250. align-items: center;
  251. background: url('../../../../../assets/images/fire/dz.png') no-repeat;
  252. background-size: 100% 100%;
  253. .t-box {
  254. width: 14%;
  255. height: 75%;
  256. background: url('../../../../../assets/images/fire/dz1.png') no-repeat;
  257. background-size: 100% 100%;
  258. .box-label {
  259. text-align: center;
  260. }
  261. }
  262. }
  263. .center-b {
  264. height: 50%;
  265. display: flex;
  266. justify-content: space-around;
  267. align-items: center;
  268. .b-box {
  269. width: 14%;
  270. height: 75%;
  271. display: flex;
  272. flex-direction: column;
  273. justify-content: center;
  274. align-items: center;
  275. .box-label {
  276. width: 78%;
  277. height: 44%;
  278. display: flex;
  279. justify-content: center;
  280. align-items: center;
  281. color: #3df6ff;
  282. font-family: 'douyuFont';
  283. background: url('../../../../../assets/images/fire/dz2.png') no-repeat;
  284. background-size: 100% 100%;
  285. }
  286. }
  287. }
  288. }
  289. .bot-area {
  290. height: calc(100% - 58% - 30px);
  291. background: url('../../../../../assets/images/fire/bj1.png') no-repeat;
  292. background-size: 100% 100%;
  293. }
  294. }
  295. </style>