From 466843c041dbbbaa8d08381a6dc4b6ccd75a9771 Mon Sep 17 00:00:00 2001 From: ruancuihong <2806986110@qq.com> Date: Thu, 13 Mar 2025 15:59:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9B=BE=E8=A1=A8=E5=AF=B9=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/axios/axiosCancel.ts | 2 + src/api/safety/index.ts | 20 ++++ src/store/modules/chart.ts | 39 ++++++++ src/views/Main/DailyPatrolCard/index.vue | 63 ++++++++---- src/views/Main/ProjectCountCard/index.vue | 100 ++++++++++++-------- src/views/Main/RiskInspectionCard/index.vue | 99 +++++++++++-------- vite.config.ts | 6 ++ 7 files changed, 232 insertions(+), 97 deletions(-) create mode 100644 src/store/modules/chart.ts diff --git a/src/api/axios/axiosCancel.ts b/src/api/axios/axiosCancel.ts index 654993c..05180b3 100644 --- a/src/api/axios/axiosCancel.ts +++ b/src/api/axios/axiosCancel.ts @@ -21,6 +21,8 @@ export class AxiosCanceler { if (url.indexOf('cameras/previewURLs') > 0) return; // 忽略 重复请求获取预览取流地址 if (url.indexOf('preview/capture') > 0) return; // 忽略 重复请求获取预览取流地址 if (url.indexOf('/sy-engine-backer/cameraInfo/') > 0) return; // 忽略 重复请求获取预览取流地址 + if (url.indexOf('/run/statistic/chart') > 0) return; + // 上传接口忽略重复请求 if (!url.includes('oss')) { config.cancelToken = diff --git a/src/api/safety/index.ts b/src/api/safety/index.ts index 57485ed..77b0e48 100644 --- a/src/api/safety/index.ts +++ b/src/api/safety/index.ts @@ -1,4 +1,5 @@ // import axios from 'axios'; +import { he } from 'element-plus/es/locale'; import { request } from '../axios'; // 预警统计 @@ -85,3 +86,22 @@ export const getObjectStatistic = (params: any) => { params }); }; +function getCookie(name: string): string | null { + const value = `; ${document.cookie}`; + const parts = value.split(`; ${name}=`); + if (parts.length === 2) return parts.pop()?.split(';').shift() || null; + return null; +} +export function getlStatisticChart(data: any) { + // 获取cookie + const shuili = getCookie('Admin-Token'); + return request({ + url: `/run/statistic/chart`, + method: 'post', + data, + headers: { + // 'Admin-Token': shuili, + shuili: 'water ' + shuili + } + }); +} diff --git a/src/store/modules/chart.ts b/src/store/modules/chart.ts new file mode 100644 index 0000000..ef595c1 --- /dev/null +++ b/src/store/modules/chart.ts @@ -0,0 +1,39 @@ +import { defineStore } from 'pinia'; +import { store } from '../index'; +import { getlStatisticChart } from '@/api/safety'; +export interface ChartState { + chartObject: any; +} + +export const useChartStore = defineStore('chart', { + state: (): ChartState => ({ + chartObject: { + endTime: '', + startTime: '', + adcd: '', + group: '' + } + }), + getters: { + getChartObject(): object { + return this.chartObject; + } + }, + actions: { + resetChart() { + this.chartObject = {}; + }, + async initStatisticChart(data: any) { + const pramas = { + ...this.chartObject, + ...data + }; + const res = await getlStatisticChart(pramas); + return res; + } + } +}); + +export const useChartStoreWithOut = () => { + return useChartStore(store); +}; diff --git a/src/views/Main/DailyPatrolCard/index.vue b/src/views/Main/DailyPatrolCard/index.vue index eb34415..9be6d69 100644 --- a/src/views/Main/DailyPatrolCard/index.vue +++ b/src/views/Main/DailyPatrolCard/index.vue @@ -16,6 +16,10 @@