groutHomeDlt.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <template>
  2. <div class="monitor-container">
  3. <div class="header-box">
  4. <div class="header-container">
  5. <div class="device-detail">
  6. <div class="device-val">注浆站流量计瞬时流量 :</div>
  7. <div class="device-val">注浆站流量计累计流量 :</div>
  8. <div class="device-val">注浆站流量计运行时间 :</div>
  9. </div>
  10. <div class="device-detail">
  11. <div class="device-val">
  12. <span :style="{ color: '#10BC79' }">{{ monitorData['InputFlux'] !== undefined ? monitorData['InputFlux'] : '-' }}</span>
  13. </div>
  14. <div class="device-val">
  15. <span :style="{ color: '#10BC79' }">{{
  16. monitorData['CurrentCumulativeFlow'] !== undefined ? monitorData['CurrentCumulativeFlow'] : '-'
  17. }}</span>
  18. </div>
  19. <div class="device-val">
  20. <span :style="{ color: '#10BC79' }">{{
  21. monitorData['AccumulateRunDuration'] !== undefined ? monitorData['AccumulateRunDuration'] : '-'
  22. }}</span>
  23. </div>
  24. </div>
  25. <div class="device-detail">
  26. <div class="device-val">
  27. <span :style="{ color: '#BFBFBF' }">m³</span>
  28. </div>
  29. <div class="device-val">
  30. <span :style="{ color: '#BFBFBF' }">m³/min</span>
  31. </div>
  32. <div class="device-val">
  33. <span :style="{ color: '#BFBFBF' }">h</span>
  34. </div>
  35. </div>
  36. </div>
  37. </div>
  38. </div>
  39. </template>
  40. <script setup lang="ts">
  41. import { ref, onMounted, onUnmounted, defineProps } from 'vue';
  42. import { mountedThree, destroy, setModelType } from '../grout.threejs';
  43. import { list } from '../grout.api';
  44. const props = defineProps({
  45. deviceId: {
  46. type: String,
  47. require: true,
  48. },
  49. deviceType: {
  50. type: String,
  51. require: true,
  52. },
  53. });
  54. const loading = ref(false);
  55. const monitorData = ref({ InputFlux: undefined });
  56. // https获取监测数据
  57. let timer: null | NodeJS.Timeout = null;
  58. function getMonitor(flag?) {
  59. if (Object.prototype.toString.call(timer) === '[object Null]') {
  60. timer = setTimeout(
  61. async () => {
  62. await getDataSource();
  63. if (timer) {
  64. timer = null;
  65. }
  66. await getMonitor();
  67. },
  68. flag ? 0 : 1000
  69. );
  70. }
  71. }
  72. async function getDataSource() {
  73. const res = await list({ devicetype: 'pulping_auto', pagetype: 'normal' });
  74. if (res.msgTxt && res.msgTxt[0] && res.msgTxt[0].datalist && res.msgTxt[0].datalist[0]) {
  75. monitorData.value = Object.assign(res.msgTxt[0].datalist[0], res.msgTxt[0].datalist[0]['readData']);
  76. }
  77. }
  78. onMounted(() => {
  79. loading.value = true;
  80. mountedThree().then(async () => {
  81. await setModelType('bertaiBase');
  82. loading.value = false;
  83. timer = null;
  84. await getMonitor(true);
  85. });
  86. });
  87. onUnmounted(() => {
  88. destroy();
  89. if (timer) {
  90. clearTimeout(timer);
  91. timer = undefined;
  92. }
  93. });
  94. </script>
  95. <style lang="less" scoped>
  96. @import '/@/design/vent/modal.less';
  97. @ventSpace: zxm;
  98. .monitor-container {
  99. width: 100%;
  100. height: 100%;
  101. // height: 550px;
  102. // border: 1px solid #fff;
  103. margin-top: 40px;
  104. display: flex;
  105. // justify-content: space-between;
  106. justify-content: center;
  107. padding: 0 5px;
  108. .header-box {
  109. // width: 100%;
  110. margin-top: 50px;
  111. .header-container {
  112. height: auto;
  113. display: flex;
  114. flex-direction: row;
  115. justify-content: center;
  116. color: #fff;
  117. box-shadow: 0 0 30px rgb(0, 153, 184) inset;
  118. }
  119. .device-title {
  120. width: 110px;
  121. text-align: center;
  122. border-top: 1px solid #00baffd4;
  123. border-left: 1px solid #00baffd4;
  124. line-height: 46px;
  125. color: #00e5ff;
  126. background-color: #00bbff21;
  127. }
  128. .device-detail {
  129. text-align: center;
  130. width: 250px;
  131. &:first-child {
  132. background-color: #00bbff11;
  133. }
  134. &:last-child {
  135. .device-val,
  136. .device-title {
  137. border-right: 1px solid #00baffd4;
  138. }
  139. }
  140. .device-val {
  141. line-height: 36px;
  142. border-top: 1px solid #00baffd4;
  143. border-left: 1px solid #00baffd4;
  144. &:last-child {
  145. border-bottom: 1px solid #00baffd4;
  146. }
  147. }
  148. }
  149. }
  150. }
  151. :deep(.@{ventSpace}-tabs-tabpane-active) {
  152. overflow: auto;
  153. }
  154. .input-box {
  155. display: flex;
  156. align-items: center;
  157. padding-left: 10px;
  158. .input-title {
  159. color: #73e8fe;
  160. width: auto;
  161. }
  162. .@{ventSpace}-input-number {
  163. border-color: #ffffff88 !important;
  164. }
  165. margin-right: 10px;
  166. }
  167. </style>