index.vue 7.2 KB

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