longyvfengyun
2023-12-20 e20bc2892a994f220a176336c6b6f14eeb3e1937
内容提交
8个文件已修改
124 ■■■■ 已修改文件
src/api/analysis/index.js 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/router/routes.js 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/analysis/fhAnalysis.vue 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/analysis/fusionAnalysis.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/analysis/hdAnalysis.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/analysis/lofAnalysis.vue 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/analysis/module/index.js 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
vite.config.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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
    }
  });
}
src/router/routes.js
@@ -89,10 +89,10 @@
      },
      {
        path: "analysis/fh",
        name: "基于Frechet距离的电池故障检测算法",
        name: "融合K-means和Fréchet的电池故障检测算法",
        meta: {
          isTechPage: true,
          title: "基于Frechet距离的电池故障检测算法"
          title: "融合K-means和Fréchet的电池故障检测算法"
        },
        component: ()=>import("../views/analysis/fhAnalysis.vue")
      },
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();
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;
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;
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;
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
  }
}
vite.config.js
@@ -34,7 +34,8 @@
    }
  },
  server: {
    port: 8081
    port: 8081,
    host: '0.0.0.0'
  },
  resolve: {
    alias: {