Ver Fonte

修改bug

liujiejie há 3 meses atrás
pai
commit
46f74ff119

BIN
src.zip


+ 63 - 29
src/views/overview/components/analysis_information/index.vue

@@ -4,20 +4,23 @@
       <h4>分析介绍:</h4>
       <div class="box-header-min">
         <el-descriptions>
-          <el-descriptions-item label="分析主题">{{}}</el-descriptions-item>
+          <el-descriptions-item label="分析主题">{{
+            analysisInfo.analysisName
+          }}</el-descriptions-item>
           <el-descriptions-item label="分析人">{{
             analysisInfo.updateByName
           }}</el-descriptions-item>
-          <el-descriptions-item label="分析简述">{{}}</el-descriptions-item>
+          <el-descriptions-item label="分析简述">{{
+            analysisInfo.sketch
+          }}</el-descriptions-item>
           <el-descriptions-item label="分析创建时间">
-            {{}}
+            {{ analysisInfo.createTime }}
           </el-descriptions-item>
-          <el-descriptions-item
-            label="分析开始执行时间"
-            >{{
+          <el-descriptions-item label="分析开始执行时间">{{
+            analysisInfo.analysisStartTime
           }}</el-descriptions-item>
           <el-descriptions-item label="分析完成时间">{{
-            analysisInfo.analysisFinishTime
+            analysisInfo.analysisEndTime
           }}</el-descriptions-item>
         </el-descriptions>
         <!-- <div v-if="analysisInfo.dataEndTime || analysisInfo.dataStartTime">
@@ -75,52 +78,57 @@
               v-for="itemData in analysisInfo.windEngineGroups"
               :key="itemData.engineCode"
             >
-              <el-popover placement="right" width="400" trigger="hover">
+              <el-popover
+                placement="right"
+                width="600"
+                trigger="hover"
+                @show="getEngineInfo(itemData.engineCode)"
+              >
                 <el-descriptions class="margin-top" size="mini" border>
                   <!-- :column="3" -->
                   <el-descriptions-item>
                     <template slot="label"> 风机名称 </template>
-                    {{}}
+                    {{ windDetail.engineName }}
                   </el-descriptions-item>
-                  <el-descriptions-item>
+                  <!-- <el-descriptions-item>
                     <template slot="label"> 机型编号 </template>
-                    {{}}
-                  </el-descriptions-item>
+                    {{ windDetail.millTypeCode }}
+                  </el-descriptions-item> -->
                   <el-descriptions-item>
                     <template slot="label"> 额定容量 </template>
-                    {{}}
+                    {{ windDetail.ratedCapacity }}/KW
                   </el-descriptions-item>
                   <el-descriptions-item>
                     <template slot="label"> 轮毂高度 </template>
-                    {{}}
+                    {{ windDetail.hubHeight }}/米
                   </el-descriptions-item>
                   <el-descriptions-item>
                     <template slot="label"> 海拔高度 </template>
-                    {{}}
+                    {{ windDetail.elevationHeight }}/米
                   </el-descriptions-item>
                   <el-descriptions-item>
                     <template slot="label"> 经度 </template>
-                    {{}}
+                    {{ windDetail.longitude }}
                   </el-descriptions-item>
                   <el-descriptions-item>
                     <template slot="label"> 纬度 </template>
-                    {{}}
+                    {{ windDetail.latitude }}
                   </el-descriptions-item>
                   <el-descriptions-item>
                     <template slot="label"> 是否标杆风机 </template>
-                    {{}}
+                    {{ windDetail.sightcing == 1 ? "是" : "否" }}
                   </el-descriptions-item>
                   <el-descriptions-item>
                     <template slot="label"> 额定风速 </template>
-                    {{}}
+                    {{ windDetail.rated_wind_speed }} m/s
                   </el-descriptions-item>
                   <el-descriptions-item>
                     <template slot="label"> 切入风速 </template>
-                    {{}}
+                    {{ windDetail.ratedCutInWindspeed }} m/s
                   </el-descriptions-item>
                   <el-descriptions-item>
                     <template slot="label"> 切出风速 </template>
-                    {{}}
+                    {{ windDetail.ratedCutOutWindspeed }} m/s
                   </el-descriptions-item>
                 </el-descriptions>
                 <div slot="reference">
@@ -147,13 +155,20 @@
     <div class="box-min">
       <h4>完成分析类型:</h4>
       <template v-if="analysisInfo && analysisInfo.analysisTypes?.length > 0">
-        <div class="completeAssetssType">
-          <el-tag
-            v-for="analysis in analysisInfo.analysisTypes"
-            :key="analysis.analysisTypeName"
-            type="warning"
-            >{{ analysis.analysisTypeName }}
-          </el-tag>
+        <div
+          class="analysisTypes"
+          v-for="analysis in analysisInfo.analysisTypes"
+          :key="analysis.id"
+        >
+          <h6>{{ analysis.typeName }}:</h6>
+          <div class="completeAssetssType">
+            <el-tag
+              v-for="analysisChild in analysis.children"
+              :key="analysisChild.id"
+              type="warning"
+              >{{ analysisChild.typeName }}
+            </el-tag>
+          </div>
         </div>
       </template>
 
@@ -166,6 +181,7 @@
 import Map from "../map/index.vue";
 import { getFieldInfo } from "@/api/overview";
 import { getWindEngineGroup } from "@/api/ledger";
+import { aW } from "plotly.js-dist";
 export default {
   name: "AnalysisInformation",
   components: {
@@ -189,6 +205,7 @@ export default {
       data: [
         1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
       ],
+      windDetail: {},
     };
   },
   watch: {
@@ -212,6 +229,16 @@ export default {
     }
   },
   methods: {
+    //获取风机信息
+    async getEngineInfo(engineCode) {
+      console.log(engineCode, "engineCode");
+      await getWindEngineGroup({ engineCode }).then((res) => {
+        console.log(res, "res");
+        if (res.code === 200) {
+          this.windDetail = res.data;
+        }
+      });
+    },
     async getWindEngList() {
       this.loading = true;
       try {
@@ -289,7 +316,14 @@ export default {
     font-weight: 500;
     margin-bottom: 10px;
   }
-  .completeAssetssType {
+  ::v-deep .analysisTypes {
+    h6 {
+      font-weight: 500 !important;
+      font-size: 12px;
+      margin: 5px 0;
+    }
+  }
+  .analysisTypes:last-child {
     margin-bottom: 50px;
   }
 }

+ 1 - 3
src/views/overview/components/production_indicator_all/index.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2025-01-13 13:45:50
- * @LastEditTime: 2025-02-10 14:51:27
+ * @LastEditTime: 2025-02-11 13:51:12
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/src/views/overview/components/production_indicator_all/index.vue
@@ -101,7 +101,6 @@
 <script>
 import DicCard from "@/views/overview/components/dicCard/index.vue";
 import FilterChart from "@/views/overview/components/filterChart/index.vue";
-import Rader from "@/views/performance/components/chartsCom/Radar.vue";
 import TinymceEditor from "@/components/Tinymce.vue";
 import {
   analysisDetail,
@@ -115,7 +114,6 @@ export default {
   components: {
     DicCard,
     FilterChart,
-    Rader,
     TinymceEditor,
   },
   props: {

+ 42 - 2
src/views/overview/components/production_indicator_unit/index.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2025-01-13 13:44:56
- * @LastEditTime: 2025-02-10 14:51:35
+ * @LastEditTime: 2025-02-12 11:29:24
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/src/views/overview/components/production_indicator_unit/index.vue
@@ -40,6 +40,7 @@
             border
             style="width: 100%"
             align="center"
+            @row-click="handleRowClick(itemCsv.data, $event)"
           >
             <el-table-column prop="wind_turbine_name" label="机组">
             </el-table-column>
@@ -93,7 +94,11 @@
               v-for="(chantItem, chartInd) in itemCsv.data"
               :key="chartInd + 'chantItem' + itemind"
             >
-              <Rader :chartData="chantItem"></Rader>
+              <Rader
+                :ref="itemind + 'chart' + chartInd"
+                :chartData="chantItem"
+                :itemCsvData="itemCsv.data"
+              ></Rader>
             </el-col>
           </el-row>
         </template>
@@ -134,6 +139,23 @@
           </el-col>
         </el-row>
       </el-dialog>
+      <el-dialog
+        title="雷达图表"
+        :visible="radarIsShow"
+        width="450px"
+        v-dialogDrag
+        :modal="false"
+        :lock-scroll="false"
+        :modal-append-to-body="false"
+        @close="radarHandleClose"
+        class="radarDialog"
+      >
+        <Rader
+          ref="dialogChart"
+          :chartData="chartItem"
+          :itemCsvData="handleTableData"
+        ></Rader>
+      </el-dialog>
     </div>
     <div class="right">
       <DicCard
@@ -189,6 +211,9 @@ export default {
       form: {
         value2: "",
       },
+      handleTableData: [], //点击查看雷达图浮窗数据,用于计算中位值
+      chartItem: {}, //点击查看雷达图浮窗数据
+      radarIsShow: false,
       commentDescriptionVos: [], //评论列表
       windEngineGroupList: [], //批次风机列表
       fieldEngineCodes: [], //选中风机
@@ -262,6 +287,13 @@ export default {
     }
   },
   methods: {
+    handleRowClick(data, row) {
+      this.chartItem = row;
+      this.handleTableData = data;
+      this.radarIsShow = true;
+
+      console.log(data, row, "handleRowClick 点击表格行");
+    },
     onSubmit() {
       console.log("submit!");
     },
@@ -269,6 +301,9 @@ export default {
       //关闭评论弹框
       this.$emit("setIsShow");
     },
+    radarHandleClose() {
+      this.radarIsShow = false;
+    },
     async handleComment() {
       try {
         await analysisCommentEdit({
@@ -486,4 +521,9 @@ export default {
   left: 50%;
   transform: translate(0, -50%);
 }
+
+::v-deep .radarDialog .el-dialog__body > div:first-child {
+  display: flex;
+  justify-content: center;
+}
 </style>

+ 46 - 4
src/views/performance/assetssMag.vue

@@ -14,6 +14,13 @@
         class="demo-form-inline"
         :rules="rules"
       >
+        <el-form-item label="分析主题:" prop="analysisName">
+          <el-input
+            size="small"
+            v-model="formInline.analysisName"
+            placeholder="请输入分析主题"
+          ></el-input>
+        </el-form-item>
         <el-form-item label="风场名称:" prop="fieldName">
           <el-input
             size="small"
@@ -21,7 +28,21 @@
             placeholder="请输入风场名称"
           ></el-input>
         </el-form-item>
-
+        <el-form-item label="分析状态:" prop="analysisState">
+          <el-select
+            size="small"
+            v-model="formInline.analysisState"
+            placeholder="请选择分析状态"
+          >
+            <el-option
+              v-for="item in options"
+              :key="item.value"
+              :label="item.label"
+              :value="item.value"
+            >
+            </el-option>
+          </el-select>
+        </el-form-item>
         <el-form-item>
           <el-button type="primary" @click="onSubmit" size="small"
             >查询</el-button
@@ -75,7 +96,7 @@
           min-width="150"
         >
           <template slot-scope="scope">
-            <span v-if="scope.row.analysisState == -1">未分析</span>
+            <span v-if="scope.row.analysisState == -1">未关联</span>
             <span
               v-else-if="
                 scope.row.analysisState == 20 && scope.row.errState == 0
@@ -445,6 +466,24 @@ export default {
       loadingView: false,
       loading: false, //数据加载中
       errorInfo: "",
+      options: [
+        {
+          value: "-1",
+          label: "未关联",
+        },
+        {
+          value: "10",
+          label: "排队中",
+        },
+        {
+          value: "20",
+          label: "分析中",
+        },
+        {
+          value: "30",
+          label: "已分析",
+        },
+      ],
       addRules: {
         fieldCode: [
           { required: true, message: "请选择关联风场", trigger: "change" },
@@ -464,6 +503,8 @@ export default {
         pageNum: 1,
         pageSize: 10,
         totalSize: 0,
+        analysisName: undefined,
+        analysisState: undefined,
       },
       tableData: [],
       rowInfo: {},
@@ -712,15 +753,16 @@ export default {
     },
     // 查询
     onSubmit() {
-      this.getTableList();
+      this.fetchData();
     },
     // 重置
     reset(formName) {
       this.$refs[formName].resetFields();
       this.formInline.fieldName = "";
+      this.formInline.analysisName = "";
       this.formInline.analysisState = "";
       this.formInline.errState = "";
-      this.getTableList();
+      this.fetchData();
     },
     // fetchData 方法在轮询中调用
     async fetchData() {

+ 4 - 4
src/views/performance/components/analysisEvent.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2024-05-29 09:13:51
- * @LastEditTime: 2025-02-07 15:05:03
+ * @LastEditTime: 2025-02-11 11:16:24
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/src/views/performance/components/analysisEvent.vue
@@ -94,7 +94,7 @@
               >
                 <el-select
                   v-model="form.scada"
-                  placeholder="请选择SCADA数据"
+                  placeholder="请选择数据"
                   size="small"
                   clearable
                   @change="handleScada"
@@ -702,7 +702,7 @@ export default {
         configAnalysis: null, //分析类型
         powerFarmID: null, //风场编号//通过路由获取的默认传递的
         dataBatchNum: null, //批次号
-        scada: "minute", //scada数类型
+        scada: "", //scada数类型
         turbines: [], //机组编号
         beginTime: null, //开始时间
         endTime: null, //结束时间
@@ -1028,7 +1028,7 @@ export default {
         configAnalysis: null, //分析类型
         powerFarmID: this.$route.query.fieldEngineCode, //风场编号//通过路由获取的默认传递的
         dataBatchNum: this.$route.query.batchCode, //批次号
-        scada: "minute", //scada数类型
+        scada: "", //scada数类型
         turbines: [], //机组编号
         beginTime: null, //开始时间
         endTime: null, //结束时间

+ 174 - 69
src/views/performance/components/chartsCom/Radar.vue

@@ -1,13 +1,12 @@
 <template>
-  <div>
-    <!-- Chart container -->
-    <div ref="radarChart" style="width: 100%; height: 400px"></div>
-    <!-- Button to trigger dynamic chart update -->
-  </div>
+  <div
+    ref="radarChart"
+    style="width: 100%; height: 400px; min-width: 400px"
+  ></div>
 </template>
 
 <script>
-import Plotly from "plotly.js-dist-min";
+import * as echarts from "echarts";
 
 export default {
   props: {
@@ -15,86 +14,192 @@ export default {
       type: Object,
       default: {},
     },
+    itemCsvData: {
+      type: Array,
+      default: [],
+    },
+  },
+  watch: {
+    chartData: {
+      deep: true,
+      // immediate: true,
+      handler() {
+        if (this.chartData && this.itemCsvData.length > 0) {
+          this.calculateValues();
+          this.drawRadarChart();
+        }
+      },
+    },
+    itemCsvData: {
+      handler() {
+        if (this.chartData && this.itemCsvData.length > 0) {
+          this.calculateValues();
+          this.drawRadarChart();
+        }
+      },
+      deep: true,
+      // immediate: true,
+    },
   },
   data() {
     return {
-      //   chartData: {
-      //     Qp: "87955465.05833334",
-      //     Thc: "2094.177739484127",
-      //     Rdr: "12",
-      //     Qdr: "-87955465.05833334",
-      //     fs: "12333",
-      //   },
+      maxValues: [],
+      minValues: [],
+      medianValues: [],
     };
   },
   mounted() {
-    if (this.chartData) {
-      this.drawRadarChart();
-    }
+    this.$nextTick(() => {
+      if (this.chartData && this.itemCsvData.length > 0) {
+        this.calculateValues();
+        this.drawRadarChart();
+      }
+    });
+
+    // 监听窗口大小变化,手动调用 resize 方法
+    window.addEventListener("resize", this.resizeChart);
+  },
+  beforeDestroy() {
+    // 清除事件监听
+    window.removeEventListener("resize", this.resizeChart);
   },
   methods: {
-    drawRadarChart() {
-      console.log("this.chartData 雷达图设置", this.chartData);
-      // 获取动态数据的 keys 和 values
-      const keys = Object.keys(this.chartData);
-      const values = Object.values(this.chartData).map((val) =>
-        val === "" ? 0 : parseFloat(val)
+    // 计算最大值、最小值和中位值
+    calculateValues() {
+      const data = this.itemCsvData.map((item) => [
+        item.TurbinePowerRate,
+        item.TurbineRunRate,
+        item.WindSpeedAvr,
+        item.Thi,
+        item.Ws,
+      ]);
+
+      // 计算最大值
+      this.maxValues = data[0].map((_, colIndex) =>
+        Math.max(...data.map((row) => row[colIndex]))
       );
 
-      // 构造 Plotly 雷达图数据
-      const trace = {
-        type: "scatterpolar",
-        r: [
-          this.chartData.TurbinePowerRate,
-          this.chartData.TurbineRunRate,
-          this.chartData.WindSpeedAvr,
-          this.chartData.Thi,
-          this.chartData.Ws,
-        ],
-        theta: [
-          "风机能量利用率",
-          "风机可利用率",
-          "平均风速",
-          "利用小时",
-          "功率曲线一致性系数",
-        ],
-        // r: [...values, values[0]], // 闭合多边形,起点与终点一致
-        // theta: [...keys, keys[0]], // 闭合多边形,起点与终点一致
-        fill: "toself", // 填充多边形区域
-        name: this.chartData.wind_turbine_name + "机组指标",
-        marker: {
-          color: "#636efc",
+      // 计算最小值
+      this.minValues = data[0].map((_, colIndex) =>
+        Math.min(...data.map((row) => row[colIndex]))
+      );
+
+      // 计算中位值
+      this.medianValues = this.calculateMedian(data);
+    },
+    // 计算每列的中位值
+    calculateMedian(data) {
+      return data[0].map((_, colIndex) => {
+        const columnData = data
+          .map((row) => parseFloat(row[colIndex])) // 将字符串转换为数字
+          .sort((a, b) => a - b); // 数字排序
+        const mid = Math.floor(columnData.length / 2);
+        return columnData.length % 2 === 0
+          ? (columnData[mid - 1] + columnData[mid]) / 2
+          : columnData[mid];
+      });
+    },
+    // 渲染雷达图
+    drawRadarChart() {
+      // 获取数据
+      const values = [
+        this.chartData.TurbinePowerRate,
+        this.chartData.TurbineRunRate,
+        this.chartData.WindSpeedAvr,
+        this.chartData.Thi,
+        this.chartData.Ws,
+      ];
+
+      // 雷达图的指示器,使用最大值、最小值和中位值来动态设置
+      const indicators = [
+        {
+          name: "风机能量利用率",
+          max: this.maxValues[0],
+          min: this.minValues[0],
         },
-        line: {
-          color: "#636efc", // 多边形边框颜色
-          width: 2, // 边框宽度
+        {
+          name: "风机可利用率",
+          max: this.maxValues[1],
+          min: this.minValues[1],
         },
-      };
+        { name: "平均风速", max: this.maxValues[2], min: this.minValues[2] },
+        { name: "利用小时", max: this.maxValues[3], min: this.minValues[3] },
+        {
+          name: "功率曲线一致性系数",
+          max: this.maxValues[4],
+          min: this.minValues[4],
+        },
+      ];
 
-      // 雷达图布局
-      const layout = {
-        polar: {
-          bgcolor: "#e5ecf6", // 设置背景色为黄色
-          radialaxis: {
-            showline: false,
-            visible: false,
-            range: [Math.min(...values) * 1.1, Math.max(...values) * 1.1], // 设置范围
-            gridcolor: "white", // 设置径向网格线为白色
-          },
-          gridshape: "linear", //设置形状默认圆形,可以设置为linear多边形
-          angularaxis: {
-            showline: false, // 隐藏 `angularaxis` 线
-            showticklabels: true, // 隐藏角度标签
-            ticks: false, // 隐藏刻度
-            gridcolor: "white", // 设置角度网格线为白色
+      // 构建 ECharts 配置项
+      const option = {
+        title: {
+          text: this.chartData.wind_turbine_name + "机组指标",
+          left: "center",
+        },
+        tooltip: {
+          trigger: "item",
+        },
+        radar: {
+          indicator: indicators,
+          center: ["45%", "45%"], // 雷达图的位置
+          radius: "50%", // 设置雷达图的半径
+          splitNumber: 5, // 设置雷达图网格的数量
+        },
+        toolbox: {
+          feature: {
+            saveAsImage: { show: true },
           },
         },
-        showlegend: false, // 隐藏图例
-        title: this.chartData.wind_turbine_name + "机组指标",
+        series: [
+          {
+            name: this.chartData.wind_turbine_name + "机组指标",
+            type: "radar",
+            data: [
+              {
+                value: values,
+                name: this.chartData.wind_turbine_name + "机组指标",
+                lineStyle: {
+                  width: 2, // 边框宽度
+                  color: "#636efc", // 边框颜色
+                },
+                areaStyle: {
+                  color: "rgba(99, 110, 252, 0.3)", // 填充区域的颜色
+                },
+              },
+            ],
+          },
+          {
+            name: "中位值",
+            type: "radar",
+            data: [
+              {
+                value: this.medianValues,
+                name: "中位值",
+                lineStyle: {
+                  width: 2, // 边框宽度
+                  color: "#f39c12", // 中位值线条颜色
+                  type: "dashed", // 中位值线条类型(虚线)
+                },
+                areaStyle: {
+                  color: "rgba(243, 156, 18, 0.3)", // 中位值的填充区域颜色
+                },
+              },
+            ],
+          },
+        ],
       };
 
-      // 渲染图表
-      Plotly.react(this.$refs.radarChart, [trace], layout);
+      // 使用 ECharts 渲染雷达图
+      const chart = echarts.init(this.$refs.radarChart);
+      chart.setOption(option);
+    },
+    // 图表调整大小
+    resizeChart() {
+      const chart = echarts.getInstanceByDom(this.$refs.radarChart);
+      if (chart) {
+        chart.resize();
+      }
     },
   },
 };