From 2f57be13b66f335b064102f3c72bbfd3e2a1dea4 Mon Sep 17 00:00:00 2001 From: xiongqin <3323939337@qq.com> Date: Thu, 17 Jul 2025 14:37:01 +0800 Subject: [PATCH] =?UTF-8?q?xq=20commit:"=E4=BF=AE=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E9=80=86=E5=8F=98=E5=99=A8=E5=8E=86=E5=8F=B2=E8=AF=A6=E6=83=85?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/modules/program.ts | 7 ++++++- src/views/business/inverter/index.vue | 7 +++---- src/views/historyDetail/historyDetail.vue | 10 +++++++--- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/store/modules/program.ts b/src/store/modules/program.ts index 035239e..d8b465d 100644 --- a/src/store/modules/program.ts +++ b/src/store/modules/program.ts @@ -4,12 +4,14 @@ interface ProgramState { programID: string; personProgramTemp: any; totalArr: any; + details: any; } const useProgram = defineStore('program', { state: (): ProgramState => ({ programID: '', personProgramTemp: [], - totalArr: [] + totalArr: [], + details: null }), actions: { @@ -22,6 +24,9 @@ const useProgram = defineStore('program', { }, updateTotalArr(arr: any) { this.totalArr = arr; + }, + updateDetails(a: any) { + this.details = a; } } }); diff --git a/src/views/business/inverter/index.vue b/src/views/business/inverter/index.vue index 5b30f75..ff82096 100644 --- a/src/views/business/inverter/index.vue +++ b/src/views/business/inverter/index.vue @@ -1803,11 +1803,10 @@ const handleCheckDetail = async (row?: InverterVO) => { chart6Value: chart6Value.value, chart6Index: chart6Index.value }; + localStorage.setItem('detail', JSON.stringify(detail)); + programState.updateDetails(detail); router.push({ - path: '/historyDetail', - query: { - detail: JSON.stringify(detail) - } + path: '/historyDetail' }); // await nextTick(() => { // initChart(chart1Value.value, chart1Index.value, myChart1.value, '直流电流参数', 25, 'A'); diff --git a/src/views/historyDetail/historyDetail.vue b/src/views/historyDetail/historyDetail.vue index 13b94bc..d3ae2d2 100644 --- a/src/views/historyDetail/historyDetail.vue +++ b/src/views/historyDetail/historyDetail.vue @@ -2,9 +2,11 @@ import moment from 'moment'; import * as echarts from 'echarts'; import { ref } from 'vue'; +import { useProgram } from '@/store/modules/program'; const route = useRoute(); const router = useRouter(); +const useStore = useProgram(); const detail = ref(); const activeName = ref(); const myChart1 = ref(null); @@ -15,7 +17,6 @@ const myChart5 = ref(null); const myChart6 = ref(null); function dealData() { - console.info(detail.value); detail.value = { ...detail.value, dataTimestamp: moment(Number(detail.value.dataTimestamp)).format('YYYY-MM-DD HH:mm:ss'), @@ -163,8 +164,11 @@ watch( ); onBeforeMount(() => { - localStorage.setItem('detail', route.query.detail); - detail.value = JSON.parse(localStorage.getItem('detail')); + if (!JSON.parse(localStorage.getItem('detail'))) { + detail.value = useStore.details; + } else { + detail.value = JSON.parse(localStorage.getItem('detail')); + } dealData(); activeName.value = 'first'; });