index.vue 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <div class="fireZhud">
  3. <div class="zhud-content">
  4. <div class="content-item" v-for="(item, index) in contentList" :key="index">
  5. <div class="card-item">
  6. <span>设备名称 : </span>
  7. <span>{{ item.deviceName || '--' }}</span>
  8. </div>
  9. <div class="card-item">
  10. <span>额定注氮压力(Mpa) : </span>
  11. <span>{{ item.injectionPressure || '--' }}</span>
  12. </div>
  13. <div class="card-item">
  14. <span>额定注氮流量(m3/h) : </span>
  15. <span>{{ item.injectionFlow || '--' }}</span>
  16. </div>
  17. <div class="card-item">
  18. <span>额定氮气浓度(%) : </span>
  19. <span>{{ item.injectionConsistence || '--' }}</span>
  20. </div>
  21. <div class="card-item">
  22. <span>设备型号 : </span>
  23. <span>{{ item.modelCode || '--' }}</span>
  24. </div>
  25. <div class="card-item">
  26. <span>额定电流 : </span>
  27. <span>{{ item.current || '--' }}</span>
  28. </div>
  29. <div class="card-item">
  30. <span>额定电压 : </span>
  31. <span>{{ item.voltage || '--' }}</span>
  32. </div>
  33. </div>
  34. </div>
  35. </div>
  36. </template>
  37. <script setup lang="ts">
  38. import { ref, reactive, onMounted, onUnmounted } from 'vue'
  39. import { getRealData } from './fireZhud.api'
  40. let contentList = reactive<any[]>([])
  41. // https获取监测数据
  42. let timer: null | NodeJS.Timeout = null;
  43. function getMonitor() {
  44. timer = setTimeout(
  45. async () => {
  46. //智能注氮
  47. await getRealDataList()
  48. if (timer) {
  49. timer = null;
  50. }
  51. getMonitor();
  52. },
  53. 5000
  54. );
  55. }
  56. async function getRealDataList() {
  57. let res = await getRealData({ type: 'FireZhuD' })
  58. console.log(res, '智能注氮数据----------')
  59. if (res.length != 0) {
  60. contentList.length = 0
  61. res.forEach(el => {
  62. contentList.push(el)
  63. })
  64. }
  65. }
  66. onMounted(() => {
  67. getRealDataList()
  68. getMonitor()
  69. })
  70. onUnmounted(() => {
  71. if (timer) {
  72. clearTimeout(timer);
  73. timer = null;
  74. }
  75. });
  76. </script>
  77. <style lang="less" scoped>
  78. .fireZhud {
  79. display: flex;
  80. position: relative;
  81. align-items: center;
  82. justify-content: center;
  83. width: calc(100% - 20px);
  84. // height: calc(100vh - 82px);
  85. height: 863px;
  86. margin: 50px 10px 15px;
  87. background: #282828;
  88. .zhud-content {
  89. position: relative;
  90. width: 1566px;
  91. height: 100%;
  92. background: url('../../../../assets/images/fire/zhud-t.png') no-repeat center;
  93. background-size: 100% 100%;
  94. .content-item{
  95. &:nth-child(1){
  96. position: absolute;
  97. top: 20px;
  98. right: 20px;
  99. }
  100. &:nth-child(2){
  101. position: absolute;
  102. top: 40px;
  103. right: 40px;
  104. }
  105. }
  106. }
  107. }
  108. </style>