diff options
Diffstat (limited to 'src/views/_sila/Fans/Dynamic')
-rw-r--r-- | src/views/_sila/Fans/Dynamic/FanSpeed.vue | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/src/views/_sila/Fans/Dynamic/FanSpeed.vue b/src/views/_sila/Fans/Dynamic/FanSpeed.vue index b119c268..bac1c964 100644 --- a/src/views/_sila/Fans/Dynamic/FanSpeed.vue +++ b/src/views/_sila/Fans/Dynamic/FanSpeed.vue @@ -69,6 +69,11 @@ {{ value.date }} </span> </template> + <template #cell(pwm)="{ value }"> + <span> + {{ `${value}%` }} + </span> + </template> </b-table> </div> </template> @@ -108,6 +113,10 @@ export default { label: this.$t('pageFans.table.middle'), }, { + key: 'pwm', + label: this.$t('pageFans.table.pwm'), + }, + { key: 'min', label: this.$t('pageFans.table.min'), }, @@ -129,7 +138,24 @@ export default { computed: { items() { - return getItems(this.filteredSensors); + const allArr = getItems(this.filteredSensors); + + let pwmArr = allArr.filter((item) => { + return item.name.toLowerCase().includes('pwm'); + }); + + let cpuArr = allArr.filter((item) => { + return !item.name.toLowerCase().includes('pwm'); + }); + + return cpuArr.map((cpu) => { + let pwm = pwmArr.find((pwm) => pwm.name === this.getPwmByCpu(cpu.name)) + .middle; + return { + pwm, + ...cpu, + }; + }); }, allSensors() { @@ -155,6 +181,9 @@ export default { timeScale() { this.loadData(); }, + items(data) { + console.log('data!!!', data); + }, }, created() { @@ -162,6 +191,23 @@ export default { }, methods: { + getPwmByCpu(cpu) { + switch (cpu) { + case 'System_Fan_1': + return 'Pwm_1'; + case 'System_Fan_2': + return 'Pwm_5'; + case 'System_Fan_3': + return 'Pwm_6'; + case 'CPU1_Fan': + return 'Pwm_7'; + case 'CPU2_Fan': + return 'Pwm_8'; + default: + return null; + } + }, + onOpened(state) { if (state) { this.loadData(); |