longyvfengyun
2023-11-30 5ebe1291c95021f3bcb14e70c9a0a61f4b207a63
src/views/analysis/lofAnalysis.vue
@@ -1,11 +1,12 @@
<script setup>
import {onMounted, ref} from "vue";
import {nextTick, onMounted, ref} from "vue";
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 HdwChart from "@/components/echarts/hdwChart.vue";
import getNormalLine from "@/components/echarts/options/normalLine";
import {ElMessage} from "element-plus";
const carName = ref("");
const timeRange = ref([]);
@@ -51,7 +52,6 @@
 * @return {{x: [], y: [], mark: []}}
 */
const formatData = (data)=>{
   console.log(data);
   // 初始化lineData
   const lineData = {
      x: [],
@@ -78,9 +78,12 @@
   return lineData;
}
const loading = ref(false);
const searchData = async ()=>{
   loading.value = true;
   const rs = await searchBmsAnalysis();
   loading.value = false;
   await nextTick();
   if(rs.code === 1) {
      const data = rs.data;
      // 图表1
@@ -91,6 +94,7 @@
         return {
            name: '#'+(key+1),
            type: 'line',
            sampling: "lttb",
            smooth: false,
            symbolSize: 0,
            data: item,
@@ -102,6 +106,7 @@
         type: 'line',
         smooth: false,
         symbolSize: 0,
         sampling: "lttb",
         lineStyle: {
            color: "#FF0000"
         },
@@ -116,6 +121,7 @@
         return {
            name: '#'+(key+1),
            type: 'line',
            sampling: "lttb",
            smooth: false,
            symbolSize: 0,
            data: item,
@@ -125,6 +131,7 @@
         name: '阈值',
         type: 'line',
         smooth: false,
         sampling: "lttb",
         symbolSize: 0,
         lineStyle: {
            color: "#FF0000"
@@ -140,6 +147,7 @@
         return {
            name: '#'+(key+1),
            type: 'line',
            sampling: "lttb",
            smooth: false,
            symbolSize: 0,
            data: item,
@@ -149,6 +157,7 @@
         name: '阈值',
         type: 'line',
         smooth: false,
         sampling: "lttb",
         symbolSize: 0,
         lineStyle: {
            color: "#FF0000"
@@ -165,6 +174,7 @@
         return {
            name: '#'+(key+1),
            type: 'line',
            sampling: "lttb",
            smooth: false,
            symbolSize: 0,
            data: item,
@@ -173,6 +183,7 @@
      chart4Option.series.push({
         name: '阈值',
         type: 'line',
         sampling: "lttb",
         smooth: false,
         symbolSize: 0,
         lineStyle: {
@@ -182,11 +193,11 @@
      });
   }else {
      ElMessage.error("暂无数据!!!");
      initChart();
   }
   setChart();
   console.log(rs);
}
const initChart = ()=>{
@@ -261,8 +272,19 @@
   chart3.value.setOption(chart3Option);
   chart4.value.setOption(chart4Option);
}
const svg = `
        <path class="path" d="
          M 30 15
          L 28 17
          M 25.61 25.61
          A 15 15, 0, 0, 1, 15 30
          A 15 15, 0, 1, 1, 27.99 7.5
          L 15 15
        " style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>
      `
onMounted(()=>{
   analysisType.value = 4;
   getCarNames();
   initChart();
   setChart();
@@ -270,7 +292,12 @@
</script>
<template>
   <div class="flex-page-layout">
   <div
      v-loading="loading"
      element-loading-text="查询中..."
      :element-loading-spinner="svg"
      element-loading-background="rgba(122, 122, 122, 0.4)"
      class="flex-page-layout">
      <div class="flex-page-header">
         <div class="input-list">
            <div class="input-item">
@@ -301,7 +328,7 @@
               </div>
            </div>
            <div class="input-item">
               <el-button type="primary" @click="searchData">查询</el-button>
               <el-button :loading="loading" type="primary" @click="searchData">查询</el-button>
            </div>
         </div>
      </div>