From 57ebbe1b7aefcbdf654a5c0eb1abd63cd43f796e Mon Sep 17 00:00:00 2001
From: maochaoying <925670706@qq.com>
Date: Tue, 15 Aug 2023 21:04:31 +0800
Subject: [PATCH] danwei
---
src/components/Setting/components/Device.vue | 46 ++++++++++++++++++++--------
1 file changed, 34 insertions(+), 12 deletions(-)
diff --git a/src/components/Setting/components/Device.vue b/src/components/Setting/components/Device.vue
index 43d0c1f..aae44a2 100644
--- a/src/components/Setting/components/Device.vue
+++ b/src/components/Setting/components/Device.vue
@@ -31,7 +31,7 @@
type="number"
v-model="stoped_gs"
:clickable="true"
- :formatter="formatter"
+ :formatter="hP1Formatter"
/>
设置
@@ -43,7 +43,7 @@
type="number"
v-model="continued_gs"
:clickable="true"
- :formatter="formatter"
+ :formatter="hP1Formatter"
/>
设置
@@ -55,7 +55,7 @@
type="number"
v-model="stoped_satur"
:clickable="true"
- :formatter="humidityFormatter"
+ :formatter="hPFormatter"
/>
设置
@@ -67,7 +67,7 @@
type="number"
v-model="continued_satur"
:clickable="true"
- :formatter="humidityFormatter"
+ :formatter="hPFormatter"
/>
设置
@@ -106,15 +106,37 @@ const {
sprayLiquidConfigVal,
} = storeToRefs(settingStore)
+const hPFormatter = value => {
+ if (value > 100) {
+ return '100%RS'
+ }
+ if (value != 0) {
+ var newVal = value.replace(/\b(0+)/gi, '')
+ return newVal + '%RS'
+ }
+ return '0%RS'
+}
+
+const hP1Formatter = value => {
+ if (value > 2000) {
+ return '2000ppm'
+ }
+ if (value != 0) {
+ var newVal = value.replace(/\b(0+)/gi, '')
+ return newVal + 'ppm'
+ }
+ return '0ppm'
+}
+
const humidityFormatter = value => {
if (value > 100) {
- return '100/g'
+ return '100%RH'
}
if (value != 0) {
var newVal = value.replace(/\b(0+)/gi, '')
- return newVal + '/g'
+ return newVal + '%RH'
}
- return '0/g'
+ return '0%RH'
}
const formatter = value => {
@@ -140,7 +162,7 @@ const setAddliquidVal = () => {
}
const setStopedGsVal = () => {
- const val = parseInt(stoped_gs.value.substring(0, stoped_gs.value.length - 2))
+ const val = parseInt(stoped_gs.value.substring(0, stoped_gs.value.length - 3))
settingStore.updateStopedGs(val)
webSocketStore.sendCommandMsg(setSettingValJSON('stoped_gs', stoped_gs.value))
showSuccessToast('设置成功')
@@ -148,7 +170,7 @@ const setStopedGsVal = () => {
const setcontinuedGsVal = () => {
const val = parseInt(
- continued_gs.value.substring(0, continued_gs.value.length - 2),
+ continued_gs.value.substring(0, continued_gs.value.length - 3),
)
settingStore.updateContinuedGs(val)
webSocketStore.sendCommandMsg(
@@ -159,7 +181,7 @@ const setcontinuedGsVal = () => {
const setstopedSaturVal = () => {
const val = parseInt(
- stoped_satur.value.substring(0, stoped_satur.value.length - 2),
+ stoped_satur.value.substring(0, stoped_satur.value.length - 3),
)
settingStore.updateStopedSatur(val)
webSocketStore.sendCommandMsg(
@@ -170,7 +192,7 @@ const setstopedSaturVal = () => {
const setContinuedSaturVal = () => {
const val = parseInt(
- continued_satur.value.substring(0, continued_satur.value.length - 2),
+ continued_satur.value.substring(0, continued_satur.value.length - 3),
)
settingStore.updateContinuedSatur(val)
webSocketStore.sendCommandMsg(
@@ -181,7 +203,7 @@ const setContinuedSaturVal = () => {
const setMaxHumidityVal = () => {
const val = parseInt(
- max_humidity.value.substring(0, max_humidity.value.length - 2),
+ max_humidity.value.substring(0, max_humidity.value.length - 3),
)
settingStore.updateMaxHumidity(val)
webSocketStore.sendCommandMsg(