diff --git a/src/components/home/LineChart.vue b/src/components/home/LineChart.vue index a4ea915..a0271ec 100644 --- a/src/components/home/LineChart.vue +++ b/src/components/home/LineChart.vue @@ -1,41 +1,30 @@ - + - + diff --git a/src/stores/homeStore.ts b/src/stores/homeStore.ts index eeea66c..ca879ef 100644 --- a/src/stores/homeStore.ts +++ b/src/stores/homeStore.ts @@ -43,6 +43,8 @@ export const useHomeStore = defineStore('home', () => { const defaultIntensityValue = ref(10) const defaultIntensityTypeValue = ref() + const allData = ref([]) + /** * @function updateHomeData * @param {Home.DisplayrelyMgr[]} data - 当前设备所有环境数据(仓内、探头) @@ -52,11 +54,24 @@ export const useHomeStore = defineStore('home', () => { const sensordata = data.sensordata if (sensordata && sensordata.length) { sensordata.forEach((item, index) => { + if (allData.value[index]) { + allData.value[index].data.push(item) + // data中的数据只保留最后30条 + if (allData.value[index].data.length > 30) { + allData.value[index].data.shift() + } + } + else { + allData.value.push({ + data: [item], + }) + } h2O2SensorData.value[index] = { ...h2O2SensorData.value[index], ...item, } }) + console.log('allData', allData.value) } } @@ -140,6 +155,7 @@ export const useHomeStore = defineStore('home', () => { isDeviceIdle, h2O2SensorData, + allData, updateHomeData, updatePressure, diff --git a/src/views/home/chart.vue b/src/views/home/chart.vue index 98095db..0284cb5 100644 --- a/src/views/home/chart.vue +++ b/src/views/home/chart.vue @@ -83,7 +83,7 @@ const onClose = () => { - + { - - - + + + - - 预计剩余时间: - - - 消毒状态: - + 预计剩余时间: + 消毒状态: {{ curStateRemainTime }} @@ -161,11 +160,11 @@ const onClose = () => {