From b38c6a7d47aeb3cffc499d81f86c3677e85e3bc8 Mon Sep 17 00:00:00 2001 From: Xiaoyu <3306310490@qq.com> Date: Thu, 20 Feb 2025 00:28:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86=E8=B7=AF?= =?UTF-8?q?=E7=94=B1=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/router/index.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/router/index.ts b/src/router/index.ts index 3ab16a5..633e40b 100644 --- a/src/router/index.ts +++ b/src/router/index.ts @@ -5,6 +5,14 @@ import { useUserStore } from '../stores/user' const router = createRouter({ history: createWebHistory(), routes: [ + { + path: '/', + redirect: to => { + // 如果已登录,重定向到后台首页,否则重定向到登录页 + const userStore = useUserStore() + return userStore.isLoggedIn ? '/dashboard' : '/login' + } + }, { path: '/login', name: 'Login', @@ -115,7 +123,7 @@ router.beforeEach((to, from, next) => { if (to.matched.some(record => record.meta.requiresAuth) && !userStore.isLoggedIn) { next({ path: '/login', - query: { redirect: to.fullPath } // 保存原目标路径 + query: { redirect: to.fullPath } }) } else { next() From 12f41faa403a501ae40149698a8996aa3c6bbe6b Mon Sep 17 00:00:00 2001 From: Xiaoyu <3306310490@qq.com> Date: Thu, 20 Feb 2025 00:59:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86=E6=8A=A5?= =?UTF-8?q?=E5=91=8A=E7=AE=A1=E7=90=86=E7=9A=84=E5=9B=BE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/report/analysis/index.vue | 152 +++++++++++++++++++++++----- src/views/report/daily/index.vue | 146 ++++++++++++++++++++++++-- 2 files changed, 262 insertions(+), 36 deletions(-) diff --git a/src/views/report/analysis/index.vue b/src/views/report/analysis/index.vue index f3a4896..9f75ce7 100644 --- a/src/views/report/analysis/index.vue +++ b/src/views/report/analysis/index.vue @@ -2,7 +2,7 @@ import { ref, onMounted, onUnmounted, computed } from "vue"; import * as echarts from "echarts"; import { ElMessageBox, ElMessage } from "element-plus"; -import { Plus } from '@element-plus/icons-vue'; +import { Plus } from "@element-plus/icons-vue"; interface AnalysisReport { id: number; @@ -118,39 +118,125 @@ const initChart = () => { myChart = echarts.init(chartDom); const option = { + backgroundColor: 'transparent', title: { - text: "监测指标趋势分析", + text: '近7天报告提交趋势', + textStyle: { + fontSize: 16, + fontWeight: 500, + color: '#303133' + }, + padding: [20, 0] }, tooltip: { - trigger: "axis", + trigger: 'axis', + backgroundColor: 'rgba(255, 255, 255, 0.95)', + borderColor: '#eee', + padding: [15, 20], }, legend: { - data: ["pH值", "溶解氧", "水温"], + data: ['巡护报告', '监测报告'], + right: 0, + top: 0, + itemWidth: 10, + itemHeight: 10, + textStyle: { + color: '#666', + fontSize: 12 + } + }, + grid: { + left: '3%', + right: '4%', + top: '15%', + bottom: '3%', + containLabel: true }, xAxis: { - type: "category", - data: ["1月", "2月", "3月", "4月"], + type: 'category', + boundaryGap: false, + data: ['3-14', '3-15', '3-16', '3-17', '3-18', '3-19', '3-20'], + axisLine: { + show: false + }, + axisTick: { + show: false + }, + splitLine: { + show: false + }, + axisLabel: { + color: '#999', + fontSize: 12 + } }, yAxis: { - type: "value", + type: 'value', + min: 0, + max: 8, + interval: 2, + axisLine: { + show: false + }, + axisTick: { + show: false + }, + splitLine: { + show: false + }, + axisLabel: { + color: '#999', + fontSize: 12 + } }, series: [ { - name: "pH值", - type: "line", - data: [7.1, 7.2, 7.0, 7.3], + name: '巡护报告', + type: 'line', + data: [5, 6, 4, 8, 7, 6, 5], + smooth: true, + symbol: 'circle', + symbolSize: 6, + lineStyle: { + width: 2, + color: '#36A2EB' + }, + itemStyle: { + color: '#36A2EB', + borderWidth: 2, + borderColor: '#fff' + }, + areaStyle: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: 'rgba(54, 162, 235, 0.15)' }, + { offset: 1, color: 'rgba(54, 162, 235, 0.02)' } + ]) + } }, { - name: "溶解氧", - type: "line", - data: [6.5, 6.3, 6.0, 5.8], - }, - { - name: "水温", - type: "line", - data: [15, 16, 18, 21], - }, - ], + name: '监测报告', + type: 'line', + data: [3, 4, 3, 5, 4, 5, 4], + smooth: true, + symbol: 'circle', + symbolSize: 6, + lineStyle: { + width: 2, + color: '#4BC0C0' + }, + itemStyle: { + color: '#4BC0C0', + borderWidth: 2, + borderColor: '#fff' + }, + areaStyle: { + color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [ + { offset: 0, color: 'rgba(75, 192, 192, 0.15)' }, + { offset: 1, color: 'rgba(75, 192, 192, 0.02)' } + ]) + } + } + ] }; myChart.setOption(option); @@ -210,7 +296,7 @@ const handleSubmit = () => { // 刷新数据 const handleRefresh = () => { - ElMessage.success('数据已更新'); + ElMessage.success("数据已更新"); // TODO: 实际刷新数据的逻辑 }; @@ -218,8 +304,8 @@ const handleRefresh = () => {