diff --git a/src/components/home/LineChart.vue b/src/components/home/LineChart.vue index 4d08d6f..74a679c 100644 --- a/src/components/home/LineChart.vue +++ b/src/components/home/LineChart.vue @@ -9,8 +9,8 @@ const props = defineProps<{ const titles = { Internal: '仓内', - WiredExtSensor: '外接传感器', - WirelessExtSensor: '无线传感器', + WiredExtSensor: '探头', + WirelessExtSensor: '探头', } watch( @@ -25,28 +25,36 @@ watch( } const option = { title: { - text: titles[newValue?.type || ''] || '', + text: (titles[newValue?.type || ''] || '') + (newValue?.id || ''), + left: 'center', // 水平居中 + top: 0, + }, + grid: { + top: 100, }, tooltip: { trigger: 'axis', + position: [10, 10], formatter: (params: any[]) => { if (!params || !params.length) return '' - // 1. 把第一个点的轴值(已经是格式化好的时间串)当作标题 const time = params[0].axisValue let html = `
${time}
` - // 2. 逐条拼接:保留它自带的 marker(圆点/线段小样) + 系列名 + 数据 + 单位 params.forEach((item) => { let unit = '' switch (item.seriesName) { - case '温度': unit = ' ℃' + case '温度': + unit = ' ℃' break - case '相对湿度': unit = ' %RH' + case '相对湿度': + unit = ' %RH' break - case 'H2O2浓度': unit = ' ppm' + case 'H2O2浓度': + unit = ' ppm' break - case 'H2O2相对饱和度': unit = ' %RS' + case 'H2O2相对饱和度': + unit = ' %RS' break } // item.marker 就是 echarts 自动给你的小彩点 @@ -134,9 +142,7 @@ onMounted(() => { diff --git a/src/stores/homeStore.ts b/src/stores/homeStore.ts index 0e0f161..78f8f66 100644 --- a/src/stores/homeStore.ts +++ b/src/stores/homeStore.ts @@ -141,6 +141,7 @@ export const useHomeStore = defineStore('home', () => { * @desc 更新环境传感器数据(温度、湿度、过氧化氢浓度等) */ const updateHomeData = (data: Home.DisplayrelyMgr[]) => { + console.log(data) data.forEach((item, index) => { h2O2SensorData.value[index] = { ...h2O2SensorData.value[index], diff --git a/src/views/home/chart.vue b/src/views/home/chart.vue index 8e7e280..6fc0526 100644 --- a/src/views/home/chart.vue +++ b/src/views/home/chart.vue @@ -4,7 +4,6 @@ import homeFinish from 'assets/images/home/home-finish.svg' import homeSettingSvg from 'assets/images/home/home-setting.svg' import BtButton from 'components/common/BTButton/index.vue' import RunFormulaConfig from 'components/formula/RunFormulaConfig.vue' -import HomeFormula from 'components/home/HomeFormula.vue' import LineChart from 'components/home/LineChart.vue' import { stopTimer } from 'libs/countdownTimer' import { FtMessage } from 'libs/message' @@ -137,19 +136,17 @@ onUnmounted(() => {