| | |
| | | </div> |
| | | <div class="sensor-data"> |
| | | <div class="data-item"> |
| | | <span>甲烷: {{ sensor.methane.toFixed(2) }}%</span> |
| | | <span>甲烷: {{ sensor.methane.toFixed(4) }}%</span> |
| | | <el-progress |
| | | :percentage="Math.min(Math.round(sensor.methane * 40 * 100) / 100, 100)" |
| | | :color="getProgressColor(Math.min(Math.round(sensor.methane * 40 * 100) / 100, 100), 80)" |
| | |
| | | /> |
| | | </div> |
| | | <div class="data-item"> |
| | | <span>硫化氢: {{ sensor.h2s.toFixed(2) }}ppm</span> |
| | | <span>硫化氢: {{ sensor.h2s.toFixed(4) }}ppm</span> |
| | | <el-progress |
| | | :percentage="Math.min(Math.round((sensor.h2s / 20) * 100 * 100) / 100, 100)" |
| | | :color="getProgressColor(Math.min(Math.round((sensor.h2s / 20) * 100 * 100) / 100, 100), 80)" |
| | |
| | | </div> |
| | | <div class="sensor-data"> |
| | | <div class="data-item"> |
| | | <span>甲烷: {{ sensor.methane.toFixed(2) }}%</span> |
| | | <span>甲烷: {{ sensor.methane.toFixed(4) }}%</span> |
| | | <el-progress |
| | | :percentage="Math.min(Math.round(sensor.methane * 40 * 100) / 100, 100)" |
| | | :color="getProgressColor(sensor.methane, 2.5)" |
| | |
| | | /> |
| | | </div> |
| | | <div class="data-item"> |
| | | <span>硫化氢: {{ sensor.h2s.toFixed(2) }}ppm</span> |
| | | <span>硫化氢: {{ sensor.h2s.toFixed(4) }}ppm</span> |
| | | <el-progress |
| | | :percentage="Math.min(Math.round((sensor.h2s / 20) * 100 * 100) / 100, 100)" |
| | | :color="getProgressColor(sensor.h2s, 10)" |
| | |
| | | formatProgress(percentage) { |
| | | if (percentage == null || isNaN(percentage)) return '0.00%' |
| | | const val = Math.round(Number(percentage) * 100) / 100 |
| | | return `${val.toFixed(2)}%` |
| | | return `${val.toFixed(4)}%` |
| | | }, |
| | | // 初始化图表 |
| | | initChart() { |
| | |
| | | generateRandomData(count, min, max) { |
| | | const data = [] |
| | | for (let i = 0; i < count; i++) { |
| | | data.push(+(Math.random() * (max - min) + min).toFixed(2)) |
| | | data.push(+(Math.random() * (max - min) + min).toFixed(4)) |
| | | } |
| | | return data |
| | | }, |
| | |
| | | refreshSensorData() { |
| | | // 更新储罐区传感器数据 |
| | | this.tankSensors.forEach(sensor => { |
| | | sensor.methane = +(Math.random() * 4).toFixed(2) |
| | | sensor.h2s = +(Math.random() * 15).toFixed(2) |
| | | sensor.methane = +(Math.random() * 4).toFixed(4) |
| | | sensor.h2s = +(Math.random() * 15).toFixed(4) |
| | | sensor.status = this.getSensorStatus(sensor.methane, sensor.h2s) |
| | | }) |
| | | |
| | | // 更新压缩机传感器数据 |
| | | this.compressorSensors.forEach(sensor => { |
| | | sensor.methane = +(Math.random() * 6).toFixed(2) |
| | | sensor.h2s = +(Math.random() * 20).toFixed(2) |
| | | sensor.methane = +(Math.random() * 6).toFixed(4) |
| | | sensor.h2s = +(Math.random() * 20).toFixed(4) |
| | | sensor.status = this.getSensorStatus(sensor.methane, sensor.h2s) |
| | | }) |
| | | |
| | |
| | | const h2sPct = Math.min(Math.round((sensor.h2s / 20) * 100 * 100) / 100, 100) |
| | | const isMethaneMajor = methanePct >= h2sPct |
| | | const overGas = isMethaneMajor ? '甲烷' : '硫化氢' |
| | | const percent = (isMethaneMajor ? methanePct : h2sPct).toFixed(2) |
| | | const percent = (isMethaneMajor ? methanePct : h2sPct).toFixed(4) |
| | | this.currentWarning = { |
| | | location: sensor.name, |
| | | gas: overGas, |