balancePressHome.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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>
  78. </div>
  79. </a-spin>
  80. </template>
  81. <script setup lang="ts">
  82. import { onBeforeMount, ref, onMounted, onUnmounted, reactive, defineProps, watch } from 'vue';
  83. import ventBox1 from '/@/components/vent/ventBox1.vue';
  84. import { SvgIcon } from '/@/components/Icon';
  85. import { mountedThree, destroy, setModelType, updateText, play } from '../balancePress.threejs';
  86. import { settingParam1, settingParam2, settingParam3, windowParam, localFanParam } from '../balancePress.data';
  87. import { list } from '../balancePress.api';
  88. const props = defineProps({
  89. deviceId: {
  90. type: String,
  91. require: true,
  92. },
  93. });
  94. const loading = ref(false);
  95. // 默认初始是第一行
  96. const isAutoControl = ref('1');
  97. // 监测数据
  98. const selectData = reactive({
  99. frontRearDP: '-',
  100. sourcePressure: '-',
  101. fault: '-',
  102. });
  103. const changeType = (isAutoControl) => {
  104. isAutoControl;
  105. //
  106. };
  107. // https获取监测数据
  108. let timer: null | NodeJS.Timeout = null;
  109. function getMonitor(flag?) {
  110. if (Object.prototype.toString.call(timer) === '[object Null]') {
  111. timer = setTimeout(
  112. async () => {
  113. if (props.deviceId) {
  114. const data = await getDataSource(props.deviceId);
  115. Object.assign(selectData, data);
  116. updateText(selectData);
  117. }
  118. if (timer) {
  119. timer = null;
  120. }
  121. await getMonitor();
  122. loading.value = false;
  123. },
  124. flag ? 0 : 1000
  125. );
  126. }
  127. }
  128. async function getDataSource(systemID) {
  129. const res = await list({ devicetype: 'sys', systemID });
  130. const result = res.msgTxt;
  131. result.forEach((item) => {
  132. if (item.type === 'sys') {
  133. // 硐室基本
  134. // fiberDataSource.value = item.filter((data: any) => {
  135. // const readData = data.readData;
  136. // return Object.assign(data, readData);
  137. // })
  138. }
  139. });
  140. }
  141. // 喷粉操作
  142. function handleDust() {
  143. //
  144. }
  145. watch(
  146. () => props.deviceId,
  147. (newVal, oldVal) => {
  148. if (newVal && oldVal != undefined) {
  149. setModelType('balancePressBase');
  150. }
  151. loading.value = true;
  152. }
  153. );
  154. onBeforeMount(() => {});
  155. onMounted(() => {
  156. // getMonitor()
  157. loading.value = true;
  158. mountedThree().then(async () => {
  159. await setModelType('balancePressBase');
  160. loading.value = false;
  161. timer = null;
  162. await getMonitor(true);
  163. play('startSmoke', 'top', 30, 'open', 0);
  164. });
  165. });
  166. onUnmounted(() => {
  167. destroy();
  168. if (timer) {
  169. clearTimeout(timer);
  170. timer = undefined;
  171. }
  172. });
  173. </script>
  174. <style lang="less" scoped>
  175. @import '/@/design/vent/modal.less';
  176. @import '../../comment/less/workFace.less';
  177. @ventSpace: zxm;
  178. .lr {
  179. width: 340px !important;
  180. }
  181. .auto-control {
  182. padding: 10px 8px;
  183. margin: 0 4px 4px 4px;
  184. border-radius: 4px;
  185. border: 1px solid #ffffff05;
  186. background-image: linear-gradient(to left, #39deff15, #3977e500, #39deff15);
  187. }
  188. .divider-line {
  189. position: relative;
  190. color: aqua;
  191. padding-left: 20px;
  192. font-size: 14px;
  193. &::before {
  194. position: absolute;
  195. content: '';
  196. display: block;
  197. top: 10px;
  198. left: 0;
  199. height: 1px;
  200. width: 15px;
  201. background-color: #ffffff33;
  202. }
  203. &::after {
  204. position: absolute;
  205. content: '';
  206. display: block;
  207. top: 10px;
  208. right: 0;
  209. height: 1px;
  210. width: calc(100% - 85px);
  211. background-color: #ffffff33;
  212. }
  213. }
  214. .input-value {
  215. width: 120px !important;
  216. }
  217. .unit {
  218. text-align: right;
  219. }
  220. .btn-box {
  221. margin: 10px 4px;
  222. .btn1 {
  223. padding: 4px 0;
  224. }
  225. }
  226. :deep(.@{ventSpace}-tabs-tabpane-active) {
  227. overflow: auto;
  228. }
  229. :deep(.@{ventSpace}-input-number) {
  230. border-color: #ffffff88 !important;
  231. }
  232. </style>