From e20bc2892a994f220a176336c6b6f14eeb3e1937 Mon Sep 17 00:00:00 2001
From: longyvfengyun <496960745@qq.com>
Date: 星期三, 20 十二月 2023 17:31:15 +0800
Subject: [PATCH] 内容提交

---
 src/views/analysis/lofAnalysis.vue    |    9 ++-
 src/router/routes.js                  |    4 
 src/views/analysis/fusionAnalysis.vue |    9 ++-
 src/views/analysis/hdAnalysis.vue     |    9 ++-
 src/views/analysis/module/index.js    |   26 +++++++-
 vite.config.js                        |    3 
 src/api/analysis/index.js             |   25 +++++++
 src/views/analysis/fhAnalysis.vue     |   39 +++++++++++-
 8 files changed, 102 insertions(+), 22 deletions(-)

diff --git a/src/api/analysis/index.js b/src/api/analysis/index.js
index d044da5..5378f30 100644
--- a/src/api/analysis/index.js
+++ b/src/api/analysis/index.js
@@ -3,14 +3,35 @@
 /**
  * 鑾峰彇鐢垫睜鍒嗘瀽鏁版嵁
  * @param type 鍒嗘瀽鏁版嵁鐨勭畻娉曠被鍨�
+ * @param boxSn 杞﹁締缂栫爜
+ * @param startTime 寮�濮嬫椂闂�
+ * @param endTime   缁撴潫鏃堕棿
  * @return {Promise<AxiosResponse<any>> | *}
  */
-export const bmsAnalysisApi = (type)=>{
+export const bmsAnalysisApi = (type, boxSn, startTime, endTime)=>{
   return axios({
     method: "POST",
     url: "/monitor/box/bmsAlgorith",
-    params: {
+    data: {
       type,
+      boxSn,
+      startTime,
+      endTime
+    }
+  });
+}
+
+/**
+ * 鏇村叿鏁版嵁绫诲瀷鏌ヨ鍙娇鐢ㄦ棩鏈�
+ * @param algorithmType 鏁版嵁绫诲瀷
+ * @return {Promise<AxiosResponse<any>> | *}
+ */
+export const bmsAnalysisTimeApi = (algorithmType)=>{
+  return axios({
+    method: "GET",
+    url: "/monitor/box/selectByAlgotithmType",
+    params: {
+      algorithmType
     }
   });
 }
diff --git a/src/router/routes.js b/src/router/routes.js
index 9d2a9a1..23ffb2d 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -89,10 +89,10 @@
       },
       {
         path: "analysis/fh",
-        name: "鍩轰簬Frechet璺濈鐨勭數姹犳晠闅滄娴嬬畻娉�",
+        name: "铻嶅悎K-means鍜孎r茅chet鐨勭數姹犳晠闅滄娴嬬畻娉�",
         meta: {
           isTechPage: true,
-          title: "鍩轰簬Frechet璺濈鐨勭數姹犳晠闅滄娴嬬畻娉�"
+          title: "铻嶅悎K-means鍜孎r茅chet鐨勭數姹犳晠闅滄娴嬬畻娉�"
         },
         component: ()=>import("../views/analysis/fhAnalysis.vue")
       },
diff --git a/src/views/analysis/fhAnalysis.vue b/src/views/analysis/fhAnalysis.vue
index 5d946f2..a2637cb 100644
--- a/src/views/analysis/fhAnalysis.vue
+++ b/src/views/analysis/fhAnalysis.vue
@@ -3,14 +3,15 @@
 import carInfoModule from "@/views/moudle/battShow/carInfo";
 import FlexBox from "@/components/FlexBox.vue";
 import ChartBox from "@/components/chartBox.vue";
-import {dataAnalysisModule} from "@/views/analysis/module";
+import {dataAnalysisModule, bmsAnalysisTimeModule} from "@/views/analysis/module";
 import HdwChart from "@/components/echarts/hdwChart.vue";
 import getNormalLine from "@/components/echarts/options/normalLine";
 import {ElMessage} from "element-plus";
 
 const carName = ref("");
 const timeRange = ref([]);
-timeRange.value = [new Date("2020-01-01 00:00:00"), new Date("2023-01-01 00:00:00")];
+const nowDate = new Date().format("yyyy-MM-dd hh:mm:ss");
+timeRange.value = [new Date("2020-01-01 00:00:00"), new Date(nowDate)];
 const {carList, getCarNames} = carInfoModule();
 
 const  {
@@ -81,10 +82,12 @@
 const loading = ref(false);
 const searchData = async ()=>{
 	loading.value = true;
-	const rs = await searchBmsAnalysis();
+	const startTime = new Date(timeRange.value[0]).format("yyyy-MM-dd hh:mm:ss");
+	const endTime = new Date(timeRange.value[1]).format("yyyy-MM-dd hh:mm:ss");
+	const rs = await searchBmsAnalysis(carName.value, startTime, endTime);
 	loading.value = false;
 	await nextTick();
-	if(rs.code === 1) {
+	if(rs.code === 1 && rs.data) {
 		const data = rs.data;
 		// 鍥捐〃1
 		title1.value = data.y1Name;
@@ -281,10 +284,36 @@
           A 15 15, 0, 1, 1, 27.99 7.5
           L 15 15
         " style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>
-      `
+      `;
+
+const {
+	getBmsAnalysisTime
+} = bmsAnalysisTimeModule();
+
+const searchBmsAnalysisTime = async ()=>{
+	const res = await getBmsAnalysisTime(analysisType.value);
+	console.log(res);
+	if(res.code ===1 && res.data) {
+		let data = res.data;
+		let list = [];
+		for(let i=0; i<data.length; i++) {
+			let item = data[i];
+			let index = -1;
+			for(let j=0; j<list.length; j++) {
+				let itemJ = list[j];
+				if(item.boxSn === itemJ[j].boxSn) {
+					index = j;
+				}
+			}
+		}
+
+
+	}
+}
 
 onMounted(()=>{
 	analysisType.value = 3;
+	searchBmsAnalysisTime();
 	getCarNames();
 	initChart();
 	setChart();
diff --git a/src/views/analysis/fusionAnalysis.vue b/src/views/analysis/fusionAnalysis.vue
index 2dd830a..9fc0bc0 100644
--- a/src/views/analysis/fusionAnalysis.vue
+++ b/src/views/analysis/fusionAnalysis.vue
@@ -10,7 +10,8 @@
 
 const carName = ref("");
 const timeRange = ref([]);
-timeRange.value = [new Date("2020-01-01 00:00:00"), new Date("2023-01-01 00:00:00")];
+const nowDate = new Date().format("yyyy-MM-dd hh:mm:ss");
+timeRange.value = [new Date("2020-01-01 00:00:00"), new Date(nowDate)];
 const {carList, getCarNames} = carInfoModule();
 
 const  {
@@ -81,10 +82,12 @@
 const loading = ref(false);
 const searchData = async ()=>{
 	loading.value = true;
-	const rs = await searchBmsAnalysis();
+	const startTime = new Date(timeRange.value[0]).format("yyyy-MM-dd hh:mm:ss");
+	const endTime = new Date(timeRange.value[1]).format("yyyy-MM-dd hh:mm:ss");
+	const rs = await searchBmsAnalysis(carName.value, startTime, endTime);
 	loading.value = false;
 	await nextTick();
-	if(rs.code === 1) {
+	if(rs.code === 1 && rs.data) {
 		const data = rs.data;
 		// 鍥捐〃1
 		title1.value = data.y1Name;
diff --git a/src/views/analysis/hdAnalysis.vue b/src/views/analysis/hdAnalysis.vue
index a134370..698c33e 100644
--- a/src/views/analysis/hdAnalysis.vue
+++ b/src/views/analysis/hdAnalysis.vue
@@ -10,7 +10,8 @@
 
 const carName = ref("");
 const timeRange = ref([]);
-timeRange.value = [new Date("2020-01-01 00:00:00"), new Date("2023-01-01 00:00:00")];
+const nowDate = new Date().format("yyyy-MM-dd hh:mm:ss");
+timeRange.value = [new Date("2020-01-01 00:00:00"), new Date(nowDate)];
 const {carList, getCarNames} = carInfoModule();
 
 const  {
@@ -81,10 +82,12 @@
 const loading = ref(false);
 const searchData = async ()=>{
 	loading.value = true;
-	const rs = await searchBmsAnalysis();
+	const startTime = new Date(timeRange.value[0]).format("yyyy-MM-dd hh:mm:ss");
+	const endTime = new Date(timeRange.value[1]).format("yyyy-MM-dd hh:mm:ss");
+	const rs = await searchBmsAnalysis(carName.value, startTime, endTime);
 	loading.value = false;
 	await nextTick();
-	if(rs.code === 1) {
+	if(rs.code === 1 && rs.data) {
 		const data = rs.data;
 		// 鍥捐〃1
 		title1.value = data.y1Name;
diff --git a/src/views/analysis/lofAnalysis.vue b/src/views/analysis/lofAnalysis.vue
index 337d01d..455e565 100644
--- a/src/views/analysis/lofAnalysis.vue
+++ b/src/views/analysis/lofAnalysis.vue
@@ -10,7 +10,8 @@
 
 const carName = ref("");
 const timeRange = ref([]);
-timeRange.value = [new Date("2020-01-01 00:00:00"), new Date("2023-01-01 00:00:00")];
+const nowDate = new Date().format("yyyy-MM-dd hh:mm:ss");
+timeRange.value = [new Date("2020-01-01 00:00:00"), new Date(nowDate)];
 const {carList, getCarNames} = carInfoModule();
 
 const  {
@@ -81,10 +82,12 @@
 const loading = ref(false);
 const searchData = async ()=>{
 	loading.value = true;
-	const rs = await searchBmsAnalysis();
+	const startTime = new Date(timeRange.value[0]).format("yyyy-MM-dd hh:mm:ss");
+	const endTime = new Date(timeRange.value[1]).format("yyyy-MM-dd hh:mm:ss");
+	const rs = await searchBmsAnalysis(carName.value, startTime, endTime);
 	loading.value = false;
 	await nextTick();
-	if(rs.code === 1) {
+	if(rs.code === 1 && rs.data) {
 		const data = rs.data;
 		// 鍥捐〃1
 		title1.value = data.y1Name;
diff --git a/src/views/analysis/module/index.js b/src/views/analysis/module/index.js
index 32791bc..c7ce5d7 100644
--- a/src/views/analysis/module/index.js
+++ b/src/views/analysis/module/index.js
@@ -1,4 +1,4 @@
-import {bmsAnalysisApi} from "@/api/analysis";
+import {bmsAnalysisApi, bmsAnalysisTimeApi} from "@/api/analysis";
 import {ref} from "vue";
 
 /**
@@ -7,9 +7,9 @@
  */
 export const dataAnalysisModule = ()=>{
   const analysisType = ref(1);
-  const searchBmsAnalysis = async ()=>{
+  const searchBmsAnalysis = async (boxSn, startTime, endTime)=>{
     try {
-      const res = await bmsAnalysisApi(analysisType.value);
+      const res = await bmsAnalysisApi(analysisType.value, boxSn, startTime, endTime);
       return res.data;
     }catch (e) {
       console.log(e);
@@ -26,3 +26,23 @@
     searchBmsAnalysis
   }
 }
+
+export const bmsAnalysisTimeModule = ()=>{
+  const getBmsAnalysisTime = async (type)=>{
+    try {
+      const res = await bmsAnalysisTimeApi(type);
+      return res.data;
+    }catch (e) {
+      console.log(e);
+      return {
+        code: 0,
+        data: null,
+        message: "鏁版嵁璇锋眰澶辫触锛岃鑱旂郴绠$悊鍛橈紒"
+      }
+    }
+  }
+
+  return {
+    getBmsAnalysisTime
+  }
+}
diff --git a/vite.config.js b/vite.config.js
index 57686eb..33fef49 100644
--- a/vite.config.js
+++ b/vite.config.js
@@ -34,7 +34,8 @@
     }
   },
   server: {
-    port: 8081
+    port: 8081,
+    host: '0.0.0.0'
   },
   resolve: {
     alias: {

--
Gitblit v1.9.1