index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <div class="fireDistributionPoint">
  3. <div class="fireDis-right-box">
  4. <div class="woke-item-box">
  5. <basicSensor :sensorTitle="sensorTitle" :sensorList="sensorList" :headList="headList" />
  6. </div>
  7. <div class="woke-item-box1">
  8. <basicSensor :sensorTitle="sensorTitleJj" :sensorList="sensorList1" :headList="headList1" />
  9. </div>
  10. <div class="woke-item-box2">
  11. <basicSensor :sensorTitle="sensorTitleZys" :sensorList="sensorList2" :headList="headList" />
  12. </div>
  13. <div class="woke-item-box3">
  14. <basicSensor :sensorTitle="sensorTitleJD" :sensorList="sensorList3" :headList="headList" />
  15. </div>
  16. </div>
  17. </div>
  18. </template>
  19. <script lang="ts" setup>
  20. import { ref, reactive, onMounted,onUnmounted } from 'vue';
  21. import basicSensor from '../../common/basicSensor.vue';
  22. import { getFireAreaInfo, getZcHfWd, getHeadingFace, getDsWd, getMainTrafficYw } from './firePoint.api'
  23. let sensorTitle = ref('综放工作面传感器监测');
  24. let sensorTitleJj = ref('掘进工作面传感器监测');
  25. let sensorTitleZys = ref('主运输系统传感器监测');
  26. let sensorTitleJD = ref('机电硐室及配电点传感器监测');
  27. let headList = reactive([
  28. { id: 0, title: '测点位置' },
  29. { id: 1, title: '监测值' },
  30. { id: 2, title: '预警级别' },
  31. { id: 3, title: '时间' },
  32. ]);
  33. let headList1 = reactive([
  34. { id: 0, title: '测点位置' },
  35. { id: 1, title: 'CO浓度(%)' },
  36. { id: 2, title: '温度' },
  37. { id: 3, title: '预警级别' },
  38. { id: 4, title: '时间' },
  39. ]);
  40. let sensorList = reactive<any[]>([]);
  41. let sensorList1 = reactive<any[]>([])
  42. let sensorList2 = reactive<any[]>([])
  43. let sensorList3 = reactive<any[]>([])
  44. //数据随便写的,不符合实际情况,因为懒得改
  45. const treeData = reactive<any[]>([])
  46. // https获取监测数据
  47. let timer: null | NodeJS.Timeout = null;
  48. function getMonitor() {
  49. timer = setTimeout(
  50. async () => {
  51. //工作面
  52. await getFireAreaInfos()
  53. if (timer) {
  54. timer = null;
  55. }
  56. getMonitor();
  57. },
  58. 5000
  59. );
  60. }
  61. //获取左侧菜单树
  62. async function getFireAreaInfos() {
  63. const res = await getFireAreaInfo({})
  64. if (res.length != 0) {
  65. res.forEach((el, ind) => {
  66. treeData.push({ name: el.areaName, value: el.ind, id: el.ind, pid: null, areaCode: el.areaCode, gxcwCnt: el.gxcwCnt, sgjcCnt: el.sgjcCnt, infoTypeTwo: el.infoTypeTwo })
  67. })
  68. console.log(treeData, 'treeData-------')
  69. getZcHfWdList()
  70. getHeadingFaceList()
  71. getMainTrafficYwList()
  72. getDsWdList()
  73. }
  74. }
  75. //获取综放工作面传感器监测数据
  76. async function getZcHfWdList() {
  77. let res = await getZcHfWd()
  78. console.log(res, '综放工作面传感器监测数据')
  79. if (res.length != 0) {
  80. sensorList.length=0
  81. res.forEach(el => {
  82. sensorList.push({ name: el.nodePlacement, status: el.detectValue + ' ('+ el.unit + ')', warn: el.warningMsg, times: el.dateTime })
  83. })
  84. }
  85. }
  86. //获取掘进工作面传感器监测数据
  87. async function getHeadingFaceList() {
  88. let res = await getHeadingFace()
  89. console.log(res, '掘进工作面传感器监测数据')
  90. if (res.length != 0) {
  91. sensorList1.length=0
  92. res.forEach(el => {
  93. sensorList1.push({ name: el.name, nd: el.co + '', status: el.wd + '', warn: el.warningMsg, times: el.dateTime })
  94. })
  95. }
  96. }
  97. //获取运输系统烟雾传感器数据
  98. async function getMainTrafficYwList() {
  99. let res = await getMainTrafficYw()
  100. console.log(res, '运输系统烟雾传感器数据')
  101. if (res.length != 0) {
  102. sensorList2.length=0
  103. res.forEach(el => {
  104. sensorList2.push({ name: el.nodePlacement, status:el.detectValue + ' ('+ el.unit + ')', warn: el.warningMsg, times: el.dateTime })
  105. })
  106. }
  107. }
  108. //获取机电硐室传感器数据
  109. async function getDsWdList() {
  110. let res = await getDsWd()
  111. console.log(res, '机电硐室传感器数据')
  112. if (res.length != 0) {
  113. sensorList3.length=0
  114. res.forEach(el => {
  115. sensorList3.push({ name: el.nodePlacement, status: el.detectValue + ' ('+ el.unit + ')', warn: el.warningMsg, times: el.dateTime })
  116. })
  117. }
  118. }
  119. onMounted(() => {
  120. getFireAreaInfos()
  121. getMonitor()
  122. })
  123. onUnmounted(() => {
  124. if (timer) {
  125. clearTimeout(timer);
  126. timer = null;
  127. }
  128. });
  129. </script>
  130. <style lang="less" scoped>
  131. .fireDistributionPoint {
  132. display: flex;
  133. position: relative;
  134. align-items: center;
  135. justify-content: space-between;
  136. width: calc(100% - 20px);
  137. // height: calc(100vh - 82px);
  138. height: 880px;
  139. margin: 0 10px;
  140. background: #282828;
  141. .fireDis-right-box {
  142. display: flex;
  143. box-sizing: border-box;
  144. flex-wrap: wrap;
  145. align-items: flex-start;
  146. justify-content: flex-start;
  147. width: 100%;
  148. height: 100%;
  149. margin-left: 10px;
  150. padding: 15px 10px;
  151. background-color: rgb(27 35 39 / 80%);
  152. .woke-item-box {
  153. width: calc(50% - 10px);
  154. height: calc(50% - 10px);
  155. margin-right: 10px;
  156. margin-bottom: 20px;
  157. }
  158. .woke-item-box1 {
  159. width: calc(50% - 10px);
  160. height: calc(50% - 10px);
  161. margin-bottom: 20px;
  162. margin-left: 10px;
  163. }
  164. .woke-item-box2 {
  165. width: calc(50% - 10px);
  166. height: calc(50% - 10px);
  167. margin-right: 10px;
  168. }
  169. .woke-item-box3 {
  170. width: calc(50% - 10px);
  171. height: calc(50% - 10px);
  172. margin-left: 10px;
  173. }
  174. }
  175. }
  176. </style>