tunFaceDustHome.vue 7.4 KB

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