rui.jiang 3 месяцев назад
Родитель
Сommit
eb2b3765c0

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

@@ -172,7 +172,9 @@
           v-for="analysis in analysisInfo.analysisTypes"
           :key="analysis.id"
         >
-          <h6>{{ analysis.typeName }}:</h6>
+          <h6 v-if="analysis.children && analysis.children.length > 0">
+            {{ analysis.typeName }}:
+          </h6>
           <div class="completeAssetssType">
             <el-tag
               v-for="analysisChild in analysis.children"

+ 21 - 27
src/views/overview/index.vue

@@ -25,12 +25,14 @@
       <el-tree
         class="filter-tree"
         :data="data"
-        highlight-current
+        :highlight-current="true"
         :props="defaultProps"
         :default-expanded-keys="expandedKeys"
         :current-node-key="initBatchCode"
         :filter-node-method="filterNode"
+        :check-on-click-node="true"
         @node-click="handleNodeClick"
+        :default-expand-all="defalueExpandAll"
         :node-key="'codeNumber'"
         ref="tree"
       />
@@ -117,7 +119,6 @@
         </div>
       </el-tooltip>
     </div>
-
     <el-dialog
       :title="'分析主题:' + batchTitle"
       :visible="isShowComment"
@@ -150,6 +151,7 @@ import { getAnalysisCodeInfo } from "@/api/overview";
 export default {
   data() {
     return {
+      defalueExpandAll: process.env.VUE_APP_Helath === "demo" ? true : false,
       loading: false,
       filterText: "",
       data: [],
@@ -187,17 +189,18 @@ export default {
     },
     // 监听树数据加载完成后,展开指定节点
     data: {
-      handler(newData) {
+      async handler(newData) {
         if (newData.length > 0 && this.$route.query.batchCode) {
           this.initBatchCode = this.$route.query.batchCode;
+          await this.$nextTick();
+          this.$refs.tree.setCurrentKey(this.initBatchCode); // 确保生效
           this.setExpandedNode(this.initBatchCode);
-          this.$nextTick(() => {
-            this.scrollToSelectedNode();
-          });
+          this.scrollToSelectedNode();
         }
       },
       immediate: true,
     },
+
     // 监听 initBatchCode 的变化,确保树节点正确选中
     // 监听选中节点的变化,确保树节点正确选中
     initBatchCode(newVal) {
@@ -255,7 +258,7 @@ export default {
         if (res.code === 200) {
           this.loading = false;
           this.batchCodeList = [];
-          this.data = this.formatData(res.data); // 赋值树数据
+          this.data = await this.formatData(res.data); // 赋值树数据
         }
       } catch (err) {
         console.error("获取数据失败", err);
@@ -326,34 +329,24 @@ export default {
         }
         return null;
       };
-
       // 获取目标节点的父级
       const parentCode = findParentNode(this.data, batchCode);
       if (parentCode) {
-        this.expandedKeys = [parentCode]; // 只展开找到的父级节点
+        this.$nextTick(() => {
+          this.expandedKeys = [parentCode]; // 只展开找到的父级节点
+        });
       }
     },
 
     // 处理树节点点击
     handleNodeClick(data) {
-      console.log(
-        data,
-        data.children,
-        !data.children || data.children.length === 0,
-        data.levelstate === "2" && data.children.length !== 0,
-        "data"
-      );
-      if (
-        !data.children ||
-        (data.children.length === 0 &&
-          data.levelstate === "2" &&
-          data.children.length !== 0)
-      ) {
-        this.initBatchCode = data.codeNumber; // 更新选中的节点
+      if (!data.children || data.children.length === 0) {
+        this.initBatchCode = data.codeNumber;
       } else {
         this.$message.warning("当前选中风场未进行任何分析,请重新选择");
       }
     },
+
     //获取
     queryAllAnalysisType() {
       queryAllAnalysisType().then((res) => {
@@ -430,10 +423,6 @@ export default {
 
       return isMatch;
     },
-    // filterNode(value, data) {
-    //   if (!value) return true;
-    //   return data.fieldOrCompanyName.indexOf(value) !== -1;
-    // },
     setInitBathCode(val) {
       this.isShowComment = true;
       this.dialogInitBatchCode = val;
@@ -597,4 +586,9 @@ export default {
   overflow-y: scroll;
   height: 80vh;
 }
+
+.is-current > .el-tree-node__content {
+  // background-color: #f0f7ff !important;
+  background-color: #f90 !important;
+}
 </style>

+ 4 - 4
src/views/performance/components/chartsCom/BarChart.vue

@@ -1,7 +1,7 @@
 <!--
  * @Author: your name
  * @Date: 2024-09-11 14:30:17
- * @LastEditTime: 2025-08-15 17:23:24
+ * @LastEditTime: 2025-08-19 14:38:12
  * @LastEditors: bogon
  * @Description: In User Settings Edit
  * @FilePath: /performance-test/src/views/performance/components/chartsCom/BarChart.vue
@@ -182,7 +182,7 @@ export default {
     // 绘制图表
     drawChart() {
       if (!this.chartData.data || this.chartData.data.length === 0) return;
-
+      console.log(this.color1, "this.color1");
       const data = this.chartData.data.map((chartDataset, index) => {
         return {
           x: chartDataset.xData,
@@ -193,13 +193,13 @@ export default {
             color:
               this.chartData.data.length >= 2
                 ? colorSchemes[0].colors[colorSchemes[0].colors.length - index]
-                : "#588CF0", // 多颜色支持
+                : this.color1, // 多颜色支持
           },
           line: {
             color:
               this.chartData.data.length >= 2
                 ? colorSchemes[0].colors[colorSchemes[0].colors.length - index]
-                : "#588CF0", // 多颜色支持
+                : this.color1, // 多颜色支持
           },
           hovertemplate:
             `${this.chartData.xaixs}: %{x}<br>` +

+ 8 - 2
src/views/performance/components/chartsCom/lineAndChildLine.vue

@@ -172,6 +172,12 @@ export default {
             })
           : JSON.parse(JSON.stringify(this.chartData.data));
       newData.forEach((turbine, index) => {
+        console.log(
+          index,
+          this.color1.length > 0,
+          index % this.colors.length,
+          "this.color1.length > 0"
+        );
         // 判断图表类型,根据类型调整绘制方式
         const chartConfig = {
           x: turbine.xData, // X 数据
@@ -180,8 +186,8 @@ export default {
           line: {
             color:
               this.color1.length > 0
-                ? this.color1[index % this.color1.length]
-                : this.colors[index % this.colors.length], // 为每个机组分配不同的颜色
+                ? this.color1[(index % this.color1.length) + 3]
+                : this.colors[(index % this.colors.length) + 3], // 为每个机组分配不同的颜色
           },
           marker: {
             color: