ventilate.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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. if (val.common.history.length != 0) {
  111. val.common.history.forEach((v) => {
  112. echartDataFc1.maxData.data.push(parseFloat(v.jin));
  113. echartDataFc1.minData.data.push(parseFloat(v.hui));
  114. echartDataFc1.xData.push(v.time);
  115. });
  116. }
  117. let max1 = echartDataFc1.maxData.data.reduce((acr, cur) => {
  118. return acr > cur ? acr : cur
  119. })
  120. let max2 = echartDataFc1.minData.data.reduce((acr1, cur1) => {
  121. return acr1 > cur1 ? acr1 : cur1
  122. })
  123. maxY.value = max1 >= max2 ? formatRoundNum(max1 * 2) : formatRoundNum(max2 * 2)
  124. }
  125. },
  126. { deep: true }
  127. );
  128. </script>
  129. <style lang="less" scoped>
  130. .dustPage {
  131. width: 100%;
  132. height: 100%;
  133. padding: 20px;
  134. box-sizing: border-box;
  135. .top-area {
  136. height: 24%;
  137. display: flex;
  138. justify-content: space-between;
  139. margin-bottom: 10px;
  140. .top-box {
  141. position: relative;
  142. width: 32%;
  143. height: 88%;
  144. background: url('../../../../../assets//images/fire/fc-t.png') no-repeat;
  145. background-size: 100% 100%;
  146. .top-title {
  147. position: absolute;
  148. left: 50%;
  149. top: 4%;
  150. transform: translate(-50%, 0);
  151. }
  152. .top-content {
  153. position: absolute;
  154. top: 20%;
  155. left: 0;
  156. width: 100%;
  157. height: 80%;
  158. display: flex;
  159. justify-content: flex-start;
  160. align-items: flex-start;
  161. flex-wrap: wrap;
  162. cursor: pointer;
  163. .content-item {
  164. position: relative;
  165. width: 50%;
  166. height: 50%;
  167. background: url('../../../../../assets/images/fire/content-item.png') no-repeat center;
  168. background-size: 72% 54%;
  169. .item-label {
  170. position: absolute;
  171. left: 20%;
  172. top: 50%;
  173. transform: translate(0, -44%);
  174. font-size: 12px;
  175. }
  176. .item-value {
  177. position: absolute;
  178. right: 21%;
  179. top: 50%;
  180. transform: translate(0, -32%);
  181. font-size: 12px;
  182. font-family: 'douyuFont';
  183. color: #3df6ff;
  184. }
  185. .item-value1 {
  186. position: absolute;
  187. right: 21%;
  188. top: 50%;
  189. transform: translate(0, -32%);
  190. font-size: 12px;
  191. font-family: 'douyuFont';
  192. color: rgb(145, 230, 9);
  193. }
  194. .item-value2 {
  195. position: absolute;
  196. right: 21%;
  197. top: 50%;
  198. transform: translate(0, -32%);
  199. font-size: 12px;
  200. font-family: 'douyuFont';
  201. color: rgb(0, 242, 255);
  202. }
  203. .item-value3 {
  204. position: absolute;
  205. right: 21%;
  206. top: 50%;
  207. transform: translate(0, -32%);
  208. font-size: 12px;
  209. font-family: 'douyuFont';
  210. color: #ffff35;
  211. }
  212. .item-value4 {
  213. position: absolute;
  214. right: 21%;
  215. top: 50%;
  216. transform: translate(0, -32%);
  217. font-size: 12px;
  218. font-family: 'douyuFont';
  219. color: #ffbe69;
  220. }
  221. .item-value5 {
  222. position: absolute;
  223. right: 21%;
  224. top: 50%;
  225. transform: translate(0, -32%);
  226. font-size: 12px;
  227. font-family: 'douyuFont';
  228. color: #ff6f00;
  229. }
  230. .item-value6 {
  231. position: absolute;
  232. right: 21%;
  233. top: 50%;
  234. transform: translate(0, -32%);
  235. font-size: 12px;
  236. font-family: 'douyuFont';
  237. color: #ff0000;
  238. }
  239. }
  240. }
  241. }
  242. }
  243. .center-area {
  244. height: 34%;
  245. margin-bottom: 20px;
  246. background: url('../../../../../assets/images/fire/bj1.png') no-repeat;
  247. background-size: 100% 100%;
  248. .center-t {
  249. height: 50%;
  250. display: flex;
  251. justify-content: space-around;
  252. align-items: center;
  253. background: url('../../../../../assets/images/fire/dz.png') no-repeat;
  254. background-size: 100% 100%;
  255. .t-box {
  256. width: 14%;
  257. height: 75%;
  258. background: url('../../../../../assets/images/fire/dz1.png') no-repeat;
  259. background-size: 100% 100%;
  260. .box-label {
  261. text-align: center;
  262. }
  263. }
  264. }
  265. .center-b {
  266. height: 50%;
  267. display: flex;
  268. justify-content: space-around;
  269. align-items: center;
  270. .b-box {
  271. width: 14%;
  272. height: 75%;
  273. display: flex;
  274. flex-direction: column;
  275. justify-content: center;
  276. align-items: center;
  277. .box-label {
  278. width: 78%;
  279. height: 44%;
  280. display: flex;
  281. justify-content: center;
  282. align-items: center;
  283. color: #3df6ff;
  284. font-family: 'douyuFont';
  285. background: url('../../../../../assets/images/fire/dz2.png') no-repeat;
  286. background-size: 100% 100%;
  287. }
  288. }
  289. }
  290. }
  291. .bot-area {
  292. height: calc(100% - 58% - 30px);
  293. background: url('../../../../../assets/images/fire/bj1.png') no-repeat;
  294. background-size: 100% 100%;
  295. }
  296. }
  297. </style>