balancePressHome.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <template>
  2. <a-spin tip="Loading..." :spinning="loading">
  3. <div class="monitor-container">
  4. <div class="lr left-box">
  5. <div class="monitor-info item-box">
  6. <ventBox1>
  7. <template #title>
  8. <div>均压与低氧参数监测与设置</div>
  9. </template>
  10. <template #container>
  11. <div class="vent-flex-row-between auto-control">
  12. <div class="title">自动调节:</div>
  13. <a-radio-group v-model:value="isAutoControl" name="radioGroup" @change="changeType(isAutoControl)">
  14. <a-radio value="1">关闭</a-radio>
  15. <a-radio value="2">开启</a-radio>
  16. </a-radio-group>
  17. </div>
  18. <div class="input-box">
  19. <div class="divider-line">开始条件</div>
  20. <div v-for="(item, index) in settingParam1" class="input-item" :key="index">
  21. <div class="title">{{ item.title }}:</div>
  22. <a-input-number class="input-value" v-model="item.value" placeholder="" />
  23. <div class="unit">{{ item.unit }}</div>
  24. </div>
  25. <div class="divider-line">调节参数</div>
  26. <div v-for="(item, index) in settingParam2" class="input-item" :key="index">
  27. <div class="title">{{ item.title }}:</div>
  28. <a-input-number class="input-value" v-model="item.value" placeholder="" />
  29. <div class="unit">{{ item.unit }}</div>
  30. </div>
  31. <div class="divider-line">结束时间</div>
  32. <div v-for="(item, index) in settingParam3" class="input-item" :key="index">
  33. <div class="title">{{ item.title }}:</div>
  34. <a-input-number class="input-value" v-model="item.value" placeholder="" />
  35. <div class="unit">{{ item.unit }}</div>
  36. </div>
  37. </div>
  38. <div class="btn-box" style="text-align: center">
  39. <div class="btn btn1">提交</div>
  40. </div>
  41. </template>
  42. </ventBox1>
  43. </div>
  44. </div>
  45. <div class="lr right-box">
  46. <div class="item-box sensor-container">
  47. <ventBox1>
  48. <template #title>
  49. <div>CO与O2监测</div>
  50. </template>
  51. <template #container> </template>
  52. </ventBox1>
  53. <ventBox1 class="vent-margin-t-10">
  54. <template #title>
  55. <div>设备监测详情</div>
  56. </template>
  57. <template #container>
  58. <div class="parameter-title group-parameter-title"><SvgIcon class="icon" size="14" name="fiber-title" /><span>风窗</span></div>
  59. <div class="input-box">
  60. <div v-for="(item, index) in windowParam" class="input-item" :key="index">
  61. <div class="title">{{ item.title }}</div>
  62. <div class="value">-</div>
  63. <div class="unit">{{ item.unit }}</div>
  64. </div>
  65. </div>
  66. <div class="parameter-title group-parameter-title"><SvgIcon class="icon" size="14" name="fiber-title" /><span>均压局扇</span></div>
  67. <div class="input-box">
  68. <div v-for="(item, index) in localFanParam" class="input-item" :key="index">
  69. <div class="title">{{ item.title }}</div>
  70. <div class="value">-</div>
  71. <div class="unit">{{ item.unit }}</div>
  72. </div>
  73. </div>
  74. </template>
  75. </ventBox1>
  76. </div>
  77. <div class="item-box vent-margin-t-10">
  78. <LivePlayer id="fm-player1" style="height: 250px" ref="player1" :videoUrl="flvURL1()" muted live loading controls />
  79. </div>
  80. </div>
  81. </div>
  82. </a-spin>
  83. </template>
  84. <script setup lang="ts">
  85. import { onBeforeMount, ref, onMounted, onUnmounted, reactive, defineProps, watch } from 'vue';
  86. import ventBox1 from '/@/components/vent/ventBox1.vue';
  87. import { SvgIcon } from '/@/components/Icon';
  88. import { mountedThree, destroy, setModelType, updateText, play } from '../balancePress.threejs';
  89. import { settingParam1, settingParam2, settingParam3, windowParam, localFanParam } from '../balancePress.data';
  90. import { list } from '../balancePress.api';
  91. import LivePlayer from '@liveqing/liveplayer-v3';
  92. const props = defineProps({
  93. deviceId: {
  94. type: String,
  95. require: true,
  96. },
  97. });
  98. const loading = ref(false);
  99. // 默认初始是第一行
  100. const isAutoControl = ref('1');
  101. // 监测数据
  102. const selectData = reactive({
  103. frontRearDP: '-',
  104. sourcePressure: '-',
  105. fault: '-',
  106. });
  107. const changeType = (isAutoControl) => {
  108. isAutoControl;
  109. //
  110. };
  111. const flvURL1 = () => {
  112. return `https://sf1-hscdn-tos.pstatp.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv`;
  113. // return ''
  114. };
  115. // https获取监测数据
  116. let timer: null | NodeJS.Timeout = null;
  117. function getMonitor(flag?) {
  118. if (Object.prototype.toString.call(timer) === '[object Null]') {
  119. timer = setTimeout(
  120. async () => {
  121. if (props.deviceId) {
  122. const data = await getDataSource(props.deviceId);
  123. Object.assign(selectData, data);
  124. updateText(selectData);
  125. }
  126. if (timer) {
  127. timer = null;
  128. }
  129. await getMonitor();
  130. loading.value = false;
  131. },
  132. flag ? 0 : 1000
  133. );
  134. }
  135. }
  136. async function getDataSource(systemID) {
  137. const res = await list({ devicetype: 'sys', systemID });
  138. const result = res.msgTxt;
  139. result.forEach((item) => {
  140. if (item.type === 'sys') {
  141. // 硐室基本
  142. // fiberDataSource.value = item.filter((data: any) => {
  143. // const readData = data.readData;
  144. // return Object.assign(data, readData);
  145. // })
  146. }
  147. });
  148. }
  149. // 喷粉操作
  150. function handleDust() {
  151. //
  152. }
  153. watch(
  154. () => props.deviceId,
  155. (newVal, oldVal) => {
  156. if (newVal && oldVal != undefined) {
  157. setModelType('balancePressBase');
  158. }
  159. loading.value = true;
  160. }
  161. );
  162. onBeforeMount(() => {});
  163. onMounted(() => {
  164. // getMonitor()
  165. loading.value = true;
  166. mountedThree().then(async () => {
  167. await setModelType('balancePressBase');
  168. loading.value = false;
  169. timer = null;
  170. await getMonitor(true);
  171. play('startSmoke', 'top', 30, 'open', 0);
  172. });
  173. });
  174. onUnmounted(() => {
  175. destroy();
  176. if (timer) {
  177. clearTimeout(timer);
  178. timer = undefined;
  179. }
  180. });
  181. </script>
  182. <style lang="less" scoped>
  183. @import '/@/design/vent/modal.less';
  184. @import '../../comment/less/workFace.less';
  185. @ventSpace: zxm;
  186. .lr {
  187. width: 340px !important;
  188. }
  189. .auto-control {
  190. padding: 10px 8px;
  191. margin: 0 4px 4px 4px;
  192. border-radius: 4px;
  193. border: 1px solid #ffffff05;
  194. background-image: linear-gradient(to left, #39deff15, #3977e500, #39deff15);
  195. }
  196. .divider-line {
  197. position: relative;
  198. color: aqua;
  199. padding-left: 20px;
  200. font-size: 14px;
  201. &::before {
  202. position: absolute;
  203. content: '';
  204. display: block;
  205. top: 10px;
  206. left: 0;
  207. height: 1px;
  208. width: 15px;
  209. background-color: #ffffff33;
  210. }
  211. &::after {
  212. position: absolute;
  213. content: '';
  214. display: block;
  215. top: 10px;
  216. right: 0;
  217. height: 1px;
  218. width: calc(100% - 85px);
  219. background-color: #ffffff33;
  220. }
  221. }
  222. .input-value {
  223. width: 120px !important;
  224. }
  225. .unit {
  226. text-align: right;
  227. }
  228. .btn-box {
  229. margin: 10px 4px;
  230. .btn1 {
  231. padding: 4px 0;
  232. }
  233. }
  234. :deep(.@{ventSpace}-tabs-tabpane-active) {
  235. overflow: auto;
  236. }
  237. :deep(.@{ventSpace}-input-number) {
  238. border-color: #ffffff88 !important;
  239. }
  240. </style>