Browse Source

fix: 传感器数值错误

master
guoapeng 2 weeks ago
parent
commit
4a151a4420
  1. 102
      src/components/home/Environment.vue
  2. 1
      src/stores/deviceStore.ts
  3. 3
      src/stores/homeStore.ts
  4. 10
      src/views/home/index.vue

102
src/components/home/Environment.vue

@ -56,82 +56,82 @@ onMounted(() => {
<img :src="imgs[envParams.type]"> {{ envParams.title }}
</div>
<div class="env-row odd">
<div class="env-row-label ">
<div class="env-row-label">
温度
</div>
<div class="env-row-value ">
{{ roundNumber(envParams.temp || 0, 2) }}°C
<div class="env-row-value">
{{ envParams.temp === -1 ? '--' : roundNumber(envParams.temp, 2) }}°C
</div>
</div>
<div class="env-row">
<div class="env-row-label ">
<div class="env-row-label">
相对湿度
</div>
<div class="env-row-value">
{{ roundNumber(envParams.rh || 0, 2) }}%RH
{{ envParams.rh === -1 ? '--' : roundNumber(envParams.rh, 2) }}%RH
</div>
</div>
<div class="env-row odd">
<div class="env-row-label ">
<div class="env-row-label">
相对饱和度
</div>
<div class="env-row-value ">
{{ roundNumber(envParams.rs || 0, 2) }}%RS
<div class="env-row-value">
{{ envParams.rs === -1 ? '--' : roundNumber(envParams.rs, 2) }}%RS
</div>
</div>
<div class="env-row">
<div class="env-row-label ">
<div class="env-row-label">
汽化过氧化氢
</div>
<div class="env-row-value ">
{{ roundNumber(envParams.h2o2 || 0, 2) }}ppm
<div class="env-row-value">
{{ envParams.h2o2 === -1 ? '--' : roundNumber(envParams.h2o2, 2) }}ppm
</div>
</div>
</template>
<style lang="scss" scoped>
div{
//font-family: ;
font-size: 18px;
font-weight: normal;
line-height: normal;
letter-spacing: 0.06em;
}
.title{
div {
//font-family: ;
font-size: 18px;
font-weight: normal;
line-height: normal;
letter-spacing: 0.06em;
}
.title {
display: flex;
align-items: center;
gap: 10px;
font-size: 26px;
padding: 1rem;
}
.title-line {
height: 1vw;
position: absolute;
width: 100%;
border-radius: 10px 10px 0 0;
margin: -2.12rem;
}
.env-row {
display: grid;
grid-template-columns: repeat(2, 1fr);
height: 7.8vh;
padding: 7px;
.env-row-label {
display: flex;
align-items: center;
gap: 10px;
font-size: 26px;
padding: 1rem;
justify-self: start;
justify-content: center;
padding-left: 10px;
}
.title-line{
height: 1vw;
position: absolute;
width: 100%;
border-radius: 10px 10px 0 0;
margin: -2.12rem;
}
.env-row{
display: grid;
grid-template-columns: repeat(2, 1fr);
height: 7.8vh;
padding: 7px;
.env-row-label{
display: flex;
align-items: center;
justify-self: start;
justify-content: center;
padding-left: 10px;
}
.env-row-value{
display: flex;
align-items: center;
justify-self: end;
justify-content: center;
padding-right: 10px;
}
}
.odd {
background: rgba(139, 190, 239, 0.1);
.env-row-value {
display: flex;
align-items: center;
justify-self: end;
justify-content: center;
padding-right: 10px;
}
}
.odd {
background: rgba(139, 190, 239, 0.1);
}
</style>

1
src/stores/deviceStore.ts

@ -41,7 +41,6 @@ export const useDeviceStore = defineStore('device', () => {
deviceInfo.value = info
isLowCost.value = info.projectType === 'DT600B'
// isLowCost.value = true
console.log(isLowCost.value)
}
/**

3
src/stores/homeStore.ts

@ -49,7 +49,6 @@ export const useHomeStore = defineStore('home', () => {
* @desc 湿
*/
const updateHomeData = (data: Home.DisplayrelyMgrs) => {
console.log('updateHomeData', data)
const sensordata = data.sensordata
if (sensordata && sensordata.length) {
sensordata.forEach((item, index) => {
@ -101,7 +100,7 @@ export const useHomeStore = defineStore('home', () => {
disinfectionState.value = disinfectState
if (!renderTimer) {
renderTimer = setTimeout(() => {
h2O2SensorData.value = [...disinfectionState.value.h2o2SensorData] // 创建副本
// h2O2SensorData.value = [...disinfectionState.value.h2o2SensorData] // 创建副本
// updateHomeData(disinfectionState.value.h2o2SensorData)
renderTimer = null
}, 3000) as unknown as NodeJS.Timeout // 类型断言兼容不同环境

10
src/views/home/index.vue

@ -26,12 +26,12 @@ const initEnv1 = {
type: 'env1',
title: '探头1',
}
const initEnv2 = {
type: 'env2',
title: '探头2',
}
// const initEnv2 = {
// type: 'env2',
// title: '2',
// }
const probe1Params = ref<Home.DisplayrelyMgrParams>(homeStore.h2O2SensorData[1] || initEnv1)
const probe2Params = ref<Home.DisplayrelyMgrParams>(homeStore.h2O2SensorData[2] || initEnv2)
const probe2Params = ref<Home.DisplayrelyMgrParams>(homeStore.h2O2SensorData[2])
const liquidInfo = ref<Liquid.LiquidData>(liquidStore.liquidStateData)
const liquidTotal = ref<number>(liquidStore.liquidTotal)
const formulaInfo = ref()

Loading…
Cancel
Save