<template> <!-- 污水处理厂工艺图 --> <div class="wscMonitorPage"></div> </template> <script setup> const { proxy } = getCurrentInstance(); const wscObj = ref({}); const timer = ref(null); const props = defineProps({ wscObj: { type: Object, }, }); watch( () => props.wscObj, () => { wscObj.value = props.wscObj; }, { immediate: true } ); // 污水处理厂数据 function getDataWSC() { let params = { stationCode: wscObj.value.sewageCode, }; realtimeDataList(params).then(res => { let datas = res.data || {}; if (Object.keys(datas).length > 0) { for (let i in datas) { if (i.includes('COD-JS')) { sewageObj.value.jsCOD = datas[i]; } // 总磷 if (i.includes('TP-JS')) { sewageObj.value.jsTP = datas[i]; } // 总氮 if (i.includes('TN-JS')) { sewageObj.value.jsTN = datas[i]; } // 氨氮 if (i.includes('NH3N-JS')) { sewageObj.value.jsNH3N = datas[i]; } if (i.includes('COD-CS')) { sewageObj.value.csCOD = datas[i]; } if (i.includes('TP-CS')) { sewageObj.value.csTP = datas[i]; } if (i.includes('TN-CS')) { sewageObj.value.csTN = datas[i]; } if (i.includes('NH3N-CS')) { sewageObj.value.csNH3N = datas[i]; } } } else { sewageObj.value = {}; } }); } onMounted(() => { getDataWSC(); //污水处理厂pcl实时数据 // 定时刷新 timer.value = setInterval(() => { getDataWSC(); }, 5 * 60 * 1000); }); onBeforeUnmount(() => { if (timer.value) clearInterval(timer.value); }); </script> <style lang="scss" scoped> .wscMonitorPage { width: 934px; height: 590px; background: url('http://58.19.180.222:8125/static/img/gygWsc.0d9a1c49.png') no-repeat; background-size: 100% 100%; margin: 0px 0px 30px 10px; } </style>