index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <template>
  2. <div class="vent-home-header">
  3. <Decoration5 class="header-icon" :dur="2" :color="['#21437F', '#2CF7FE']" style="width: 500px; height: 40px" />
  4. <div class="header-text">皮带机监测</div>
  5. </div>
  6. <div class="fire-box">
  7. <div class="fire-top">
  8. <div class="top-lr top-left">
  9. <div class="lr-item">
  10. <BorderBox1 title="实时网络解算" :color="['#00FFFF']">
  11. <div class="item-top-title">火焰传感器监测</div>
  12. <div class="scroll-box">
  13. <!-- <ScrollBoard :config="hyConfig" ref="hyScrollBoard" style="width:100%;height:calc(100% - 40px)" @mouseover="mouseoverHandler" @click="clickHandler" /> -->
  14. </div>
  15. </BorderBox1>
  16. </div>
  17. <div class="lr-item">
  18. <BorderBox1 title="实时网络解算" :color="['#00FFFF']">
  19. <div class="item-top-title">烟雾传感器监测</div>
  20. <div class="scroll-box">
  21. <ScrollBoard
  22. :config="ywConfig"
  23. ref="ywScrollBoard"
  24. style="width: 100%; height: calc(100% - 40px)"
  25. @mouseover="mouseoverHandler"
  26. @click="clickHandler"
  27. />
  28. </div>
  29. </BorderBox1>
  30. </div>
  31. </div>
  32. <div class="top-lr top-right">
  33. <div class="lr-item">
  34. <BorderBox1 title="实时网络解算" :color="['#00FFFF']">
  35. <div class="item-top-title">火焰传感器监测</div>
  36. <div class="scroll-box">
  37. <ScrollBoard
  38. :config="hyConfig"
  39. ref="hyScrollBoard"
  40. style="width: 100%; height: calc(100% - 40px)"
  41. @mouseover="mouseoverHandler"
  42. @click="clickHandler"
  43. />
  44. </div>
  45. </BorderBox1>
  46. </div>
  47. <div class="lr-item">
  48. <BorderBox1 title="实时网络解算" :color="['#00FFFF']">
  49. <div class="item-top-title">喷淋灭火装置监测</div>
  50. <div class="scroll-box">
  51. <ScrollBoard
  52. :config="plConfig"
  53. ref="plScrollBoard"
  54. style="width: 100%; height: calc(100% - 40px)"
  55. @mouseover="mouseoverHandler"
  56. @click="clickHandler"
  57. />
  58. </div>
  59. </BorderBox1>
  60. </div>
  61. </div>
  62. </div>
  63. <div class="fire-bottom">
  64. <BorderBox11 title="光纤测温实时监测" :color="['#00FFFF']">
  65. <BarAndLine xAxisPropType="readTime" :dataSource="[]" height="100%" :chartsColumns="[]" chartsType="detail" @refresh="refreshEchatrs" />
  66. </BorderBox11>
  67. </div>
  68. </div>
  69. </template>
  70. <script setup lang="ts">
  71. import BarAndLine from '/@/components/chart/BarAndLine.vue';
  72. import { BorderBox1, ScrollBoard, BorderBox11, Decoration5 } from '@kjgl77/datav-vue3';
  73. import { ref, reactive, onMounted, onUnmounted } from 'vue';
  74. import { hyConfigFn, ywConfigFn, plConfigFn } from './fire.data';
  75. import { list } from './fire.api';
  76. const hyScrollBoard = ref();
  77. const ywScrollBoard = ref();
  78. const plScrollBoard = ref();
  79. const hyConfig = hyConfigFn();
  80. const ywConfig = ywConfigFn();
  81. const plConfig = plConfigFn();
  82. const wdOption = reactive({
  83. legend: '温度',
  84. seriesName: '(℃)',
  85. ymax: 50,
  86. yname: '℃',
  87. linetype: 'bar',
  88. yaxispos: 'right',
  89. color: '#FC4327',
  90. sort: 2,
  91. xRotate: 0,
  92. dataIndex: 'temperature',
  93. });
  94. function mouseoverHandler(e: any) {
  95. console.log(e);
  96. }
  97. function clickHandler(e: any) {
  98. console.log(e);
  99. }
  100. let timer: null | NodeJS.Timeout | undefined = null;
  101. async function getMonitor(flag?) {
  102. if (timer === null) {
  103. timer = setTimeout(
  104. async () => {
  105. const result = await list({ pagetype: 'normal', devicetype: 'sys', systemID: '1637983899775242242' });
  106. const hyDatas: any[] = [],
  107. ywDatas: any[] = [],
  108. plDatas: any[] = [],
  109. wdDatas: any[] = [];
  110. result.forEach((item) => {
  111. if (item.msgTxt.type === 'modelsensor_fire') {
  112. item.msgTxt.datalist.forEach((dataObj) => {
  113. hyDatas.push([dataObj.strinstallpos, dataObj.warnFlag, dataObj.readTime?.substring(11)]);
  114. });
  115. }
  116. if (item.msgTxt.type === 'modelsensor_smoke') {
  117. item.msgTxt.datalist.forEach((dataObj) => {
  118. ywDatas.push([dataObj.strinstallpos, dataObj.warnFlag, dataObj.readTime?.substring(11)]);
  119. });
  120. }
  121. if (item.msgTxt.type === 'modelsensor_temperature') {
  122. item.msgTxt.datalist.forEach((dataObj) => {
  123. wdDatas.push([dataObj.strinstallpos, dataObj.warnFlag, dataObj.readTime?.substring(11)]);
  124. });
  125. }
  126. if (item.msgTxt.type === 'modelsensor_fire') {
  127. item.msgTxt.datalist.forEach((dataObj) => {
  128. plDatas.push([dataObj.strinstallpos, dataObj.warnFlag, dataObj.readTime?.substring(11)]);
  129. });
  130. }
  131. });
  132. hyScrollBoard.value.updateRows(hyDatas);
  133. ywScrollBoard.value.updateRows(ywDatas);
  134. plScrollBoard.value.updateRows(plDatas);
  135. // hyConfig.data = hyDatas
  136. // ywConfig.data = ywDatas
  137. // plConfig.data = plDatas
  138. await getMonitor();
  139. },
  140. flag ? 0 : 5000
  141. );
  142. if (timer) {
  143. timer = null;
  144. }
  145. }
  146. }
  147. async function refreshEchatrs() {
  148. timer = null;
  149. await getMonitor(true);
  150. console.log('echarts 刷新');
  151. }
  152. onMounted(async () => {
  153. await getMonitor(true);
  154. });
  155. onUnmounted(() => {
  156. timer = undefined;
  157. });
  158. </script>
  159. <style lang="less" scoped>
  160. .vent-home-header {
  161. width: 100%;
  162. height: 100px;
  163. position: fixed;
  164. top: 0;
  165. background: url('/@/assets/images/vent/new-home/header-bg.png') no-repeat;
  166. background-size: contain;
  167. display: flex;
  168. justify-content: center;
  169. z-index: 99;
  170. .header-icon {
  171. margin-top: 45px;
  172. }
  173. .header-text {
  174. position: fixed;
  175. top: 18px;
  176. color: #fff;
  177. font-size: 26px;
  178. }
  179. }
  180. .fire-box {
  181. position: relative;
  182. z-index: 999;
  183. width: 100%;
  184. height: calc(100% - 48px);
  185. top: 0px;
  186. pointer-events: none;
  187. .fire-top {
  188. height: calc(100% - 300px);
  189. display: flex;
  190. flex-direction: row;
  191. justify-content: space-between;
  192. .top-lr {
  193. width: 400px;
  194. height: 100%;
  195. margin-top: 10px;
  196. display: flex;
  197. flex-direction: column;
  198. .lr-item {
  199. flex: 1;
  200. margin-top: 20px;
  201. .item-top-title {
  202. position: relative;
  203. top: -5px;
  204. color: #fff;
  205. }
  206. }
  207. }
  208. .top-right {
  209. }
  210. }
  211. .fire-bottom {
  212. height: 300px;
  213. }
  214. .scroll-box {
  215. padding: 0 20px;
  216. height: 100%;
  217. }
  218. }
  219. </style>