beltTunDustHome.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <a-spin tip="Loading..." :spinning="loading">
  3. <div class="monitor-container">
  4. <div class="lr left-box vent-margin-t-10">
  5. <ventBox1 class="vent-margin-t-10">
  6. <template #title>
  7. <div>煤机喷雾参数</div>
  8. </template>
  9. <template #container>
  10. <div v-for="(item, index) in coalMachineDustParam" class="input-item" style="padding: 4px 8px; margin: 6px 0;"
  11. :key="index">
  12. <div class="title">{{ item.title }}</div>
  13. <div class="value">-</div>
  14. <div class="unit">{{ item.unit }}</div>
  15. </div>
  16. </template>
  17. </ventBox1>
  18. </div>
  19. <div class="lr right-box">
  20. <ventBox1>
  21. <template #title>
  22. <div>除尘风机监测与控制</div>
  23. </template>
  24. <template #container>
  25. <div class="dust-fan-monitor">
  26. <div class="dust-fan-monitor-item" v-for="(item, index) in dustMonitor" :key="index">
  27. <div class="title">{{ item.title }}</div>
  28. <div class=""><span class="value">-</span> <span class="unit"> {{ item.unit }} </span></div>
  29. </div>
  30. <div class="dust-fan-monitor-item fault">
  31. <div class="title">风机故障诊断</div>
  32. <div class=""><span class="value">正常</span></div>
  33. </div>
  34. </div>
  35. <div class="parameter-title group-parameter-title vent-margin-t-10">
  36. <SvgIcon class="icon" size="20" name="control-setting" /><span>设备基础参数</span>
  37. </div>
  38. <div class="data-group">
  39. <div class="data-item" v-for="(item, index) in dustFanParam" :key="index">
  40. <div class="title">{{ item.title }}</div>
  41. <div class="value">-</div>
  42. </div>
  43. </div>
  44. <div class="parameter-title group-parameter-title">
  45. <SvgIcon class="icon" size="20" name="control-setting" /><span>控制设备</span>
  46. </div>
  47. <div class="input-item vent-flex-row-between">
  48. <div>除尘器控制:</div>
  49. <div class="vent-flex-row btn-box">
  50. <div class="btn btn1">启动</div>
  51. <div class="btn btn2">停机</div>
  52. </div>
  53. </div>
  54. <div v-for="(item, index) in dustFanSetting" :key="index" class="input-item vent-flex-row-between">
  55. <div class="title-auto">{{ item.title }}:</div>
  56. <div>
  57. <a-input class="input-value" v-model="item.inputNum" placeholder="" />
  58. <span class="btn btn1 vent-margin-l-8">保存</span>
  59. </div>
  60. </div>
  61. </template>
  62. </ventBox1>
  63. </div>
  64. </div>
  65. </a-spin>
  66. </template>
  67. <script setup lang="ts">
  68. import { onBeforeMount, ref, onMounted, onUnmounted, reactive, defineProps } from 'vue';
  69. import { list } from '../beltTun.api';
  70. import ventBox1 from '/@/components/vent/ventBox1.vue'
  71. import { SvgIcon } from '/@/components/Icon';
  72. import { dustFanParam, coalMachineDustParam, dustMonitor, dustFanSetting } from '../beltTun.data'
  73. const props = defineProps({
  74. deviceId: {
  75. type: String,
  76. require: true
  77. }
  78. })
  79. const loading = ref(false)
  80. // 默认初始是第一行
  81. const openDust = ref(false)
  82. const workFaceSource = ref({});
  83. const workFaceHistorySource = ref([])
  84. const gateDataSource = ref([]);
  85. const windowDataSource = ref([]);
  86. const windDataSource = ref([]);
  87. const temperatureDataSource = ref([]);
  88. const fireDataSource = ref([]);
  89. // 监测数据
  90. const selectData = reactive({});
  91. // https获取监测数据
  92. let timer: null | NodeJS.Timeout = null;
  93. function getMonitor(flag?) {
  94. if (Object.prototype.toString.call(timer) === '[object Null]') {
  95. timer = setTimeout(async () => {
  96. if (props.deviceId) {
  97. const data = await getDataSource(props.deviceId)
  98. Object.assign(selectData, data);
  99. }
  100. if (timer) {
  101. timer = null;
  102. }
  103. await getMonitor();
  104. loading.value = false
  105. }, flag ? 0 : 1000);
  106. }
  107. };
  108. async function getDataSource(systemID) {
  109. const res = await list({ devicetype: 'sys', systemID });
  110. const result = res.msgTxt;
  111. result.forEach(item => {
  112. // ''.startsWith
  113. if (item.type.startsWith('gate')) {
  114. // 风门
  115. gateDataSource.value = item['datalist'].filter((data: any) => {
  116. const readData = data.readData;
  117. return Object.assign(data, readData);
  118. })
  119. }
  120. if (item.type.startsWith('window')) {
  121. // 风窗
  122. windowDataSource.value = item['datalist'].filter((data: any) => {
  123. const readData = data.readData;
  124. return Object.assign(data, readData);
  125. })
  126. }
  127. if (item.type.startsWith('windrect')) {
  128. // 测风
  129. windDataSource.value = item['datalist'].filter((data: any) => {
  130. const readData = data.readData;
  131. return Object.assign(data, readData);
  132. })
  133. }
  134. if (item.type === 'modelsensor_temperature') {
  135. // 温度
  136. temperatureDataSource.value = item['datalist'].filter((data: any) => {
  137. const readData = data.readData;
  138. return Object.assign(data, readData);
  139. })
  140. }
  141. if (item.type === 'modelsensor_fire') {
  142. // 火焰
  143. fireDataSource.value = item['datalist'].filter((data: any) => {
  144. const readData = data.readData;
  145. return Object.assign(data, readData);
  146. })
  147. }
  148. if (item.type === 'sys') {
  149. workFaceSource.value = Object.assign(item['datalist'][0], item['datalist'][0].readData);
  150. }
  151. if (item.type === 'surface_history') {
  152. workFaceHistorySource.value = item['datalist'][0]
  153. }
  154. loading.value = false;
  155. })
  156. }
  157. function toDetail() {
  158. }
  159. function changeType(e: Event, item) {
  160. item.value = e.target?.value
  161. }
  162. onBeforeMount(() => {
  163. });
  164. onMounted(async () => {
  165. loading.value = true;
  166. timer = null
  167. await getMonitor(true)
  168. });
  169. onUnmounted(() => {
  170. if (timer) {
  171. clearTimeout(timer);
  172. timer = undefined;
  173. }
  174. });
  175. </script>
  176. <style lang="less" scoped>
  177. @import '/@/design/vent/modal.less';
  178. @import '../../comment/less/workFace.less';
  179. @ventSpace: zxm;
  180. .dust-fan-monitor {
  181. display: flex;
  182. flex-wrap: wrap;
  183. }
  184. .dust-fan-monitor-item {
  185. width: 152px;
  186. height: 70px;
  187. display: flex;
  188. flex-direction: column;
  189. justify-content: center;
  190. align-items: center;
  191. border: 1px solid rgba(25, 251, 255, 0.4);
  192. box-shadow: inset 0 0 20px rgba(0, 197, 255, 0.4);
  193. background: rgba(0, 0, 0, 0.06666667);
  194. margin-bottom: 5px;
  195. padding: 8px 0;
  196. &:nth-child(2n) {
  197. margin-left: 12px;
  198. }
  199. .title {
  200. color: #5dfaff;
  201. }
  202. .unit {
  203. font-size: 13px;
  204. color: #ffffffaa;
  205. }
  206. .value {
  207. color: #FFB212;
  208. }
  209. }
  210. .fault {
  211. .title {
  212. color: #c4fdff;
  213. }
  214. .value {
  215. // color: #FFB212;
  216. color: #61ddb1;
  217. }
  218. }
  219. </style>