Browse Source

华电部署修改2d图选中点色带展示bug

liujiejie 2 weeks ago
parent
commit
2591e35efb

BIN
src/assets/logoZN.png


+ 1 - 1
src/components/map/index.vue

@@ -257,7 +257,7 @@ export default {
       layers: [
         new TileLayer({
           source: new XYZ({
-            // url: "http://106.120.102.238:18000/tiles/{z}/{x}/{y}.png", //外网
+            url: "http://106.120.102.238:18000/tiles/{z}/{x}/{y}.png", //外网
             // url: "http://127.0.0.1:8010/tiles/{z}/{x}/{y}.png", //本地
             url: "http://192.168.50.235/tiles/{z}/{x}/{y}.png", //内网
             // url: "http://10.96.137.5:9080/tiles/{z}/{x}/{y}.png", //大~#@唐

+ 2 - 2
src/views/admin/cockpitManage/HD.vue

@@ -197,7 +197,7 @@ export default {
 
 <style lang="scss" scoped>
 .map-ditu {
-  height: 93.3vh;
+  height: 91vh;
   display: flex;
   flex-direction: column;
 }
@@ -217,7 +217,7 @@ bottom-data {
 .zuobian {
   width: 150px;
   position: absolute;
-  top: 15px;
+  top: 30px;
   left: 10px;
 }
 </style>

+ 16 - 0
src/views/health/components/malfunction/temperature.vue

@@ -91,6 +91,10 @@
           :lineType="item.lineType"
           :lineColor="item.lineColor"
           :chartData="item.data"
+          :fieldCode="fieldCode"
+          :windTurbineNumber="windTurbineNumber"
+            :bearingKey="item.bearingKey"
+          
         />
       </div>
     </div>
@@ -126,6 +130,14 @@ export default {
       type: Number,
       default: 0,
     },
+    fieldCode: {
+      type: String,
+      default: "",
+    },
+    windTurbineNumber: {
+      type: String,
+      default: "",
+    },
   },
   data() {
     return {
@@ -149,20 +161,24 @@ export default {
           data: this.echartsdata.main_bearing,
           lineType: "line",
           lineColor: "#02aae9",
+          bearingKey: "innerRing",
         },
         {
           title: "发电机驱动端轴承温度趋势图",
           data: this.echartsdata.generator_drive_end,
+          bearingKey: "rollingElement",
         },
         {
           title: "齿轮箱油温趋势图",
           data: this.echartsdata.gearbox_oil,
           lineType: "line",
           lineColor: "#02aae9",
+          bearingKey: "outerRing",
         },
         {
           title: "发电机非驱动端轴承温度趋势图",
           data: this.echartsdata.generator_nondrive_end,
+          bearingKey: "cage",
         },
       ];
 

+ 189 - 1
src/views/health/components/malfunction/zhexian.vue

@@ -1,5 +1,29 @@
 <template>
-  <div ref="chartRef" style="width: 100%; height: 100%"></div>
+  <div>
+    <div ref="chartRef" style="width: 100%; height: 320px"></div>
+    <el-dialog
+      title="机组运行数据"
+      :visible.sync="dialogVisible"
+      width="50%"
+      v-dialogDrag
+      :modal="false"
+      ref="myDialog"
+      @open="resetDialogPosition"
+      @closed="resetDialogPosition"
+    >
+      <el-table :data="records" style="width: 100%">
+        <el-table-column
+          v-for="(col, index) in columns"
+          :key="index"
+          :prop="col"
+          :label="col"
+          :min-width="140"
+          show-overflow-tooltip
+          align="center"
+        />
+      </el-table>
+    </el-dialog>
+  </div>
 </template>
 
 <script>
@@ -27,12 +51,108 @@ export default {
         values: [],
       }),
     },
+    fieldCode: {
+      // 新增 fieldCode 属性
+      type: String,
+      default: "",
+    },
+    windTurbineNumber: {
+      // 新增 windTurbineNumber 属性
+      type: String,
+      default: "",
+    },
+    bearingKey: {
+      type: String,
+      default: "",
+    },
   },
   data() {
     return {
       myChart: null,
+      dialogVisible: false,
+
+      records: [
+        {
+          风机名称: "36",
+          时间戳: "2023-12-31 20:00:00",
+          有功功率: 406.67,
+          风轮转速: 5.95,
+          发电机转速: 5.95,
+          风速: 4.35,
+          桨距角1: -1,
+          桨距角2: -1,
+          桨距角3: -1,
+          机舱位置: 249.35,
+          对风角度: -6.29,
+          发电机驱动端轴承温度: 43.57,
+          机舱内温度: 8.48,
+          环境温度: 3.9,
+          主轴承轴承温度: 43.57,
+          主轴承轴承温度2: 0,
+          发电机绕组1温度: 50.59,
+          发电机绕组2温度: 50.12,
+          发电机绕组3温度: 48.65,
+          电网A相电流: 349.7,
+          电网B相电流: 350.4,
+          电网C相电流: 351.25,
+        },
+        {
+          风机名称: "36",
+          时间戳: "2023-12-31 20:10:00",
+          有功功率: 448.99,
+          风轮转速: 6.15,
+          发电机转速: 6.15,
+          风速: 4.56,
+          桨距角1: -1,
+          桨距角2: -1,
+          桨距角3: -1,
+          机舱位置: 246.5,
+          对风角度: -0.68,
+          发电机驱动端轴承温度: 43.62,
+          机舱内温度: 8.11,
+          环境温度: 3.86,
+          主轴承轴承温度: 43.62,
+          主轴承轴承温度2: 0,
+          发电机绕组1温度: 51.15,
+          发电机绕组2温度: 50.53,
+          发电机绕组3温度: 49.02,
+          电网A相电流: 384.95,
+          电网B相电流: 385.41,
+          电网C相电流: 388.41,
+        },
+        {
+          风机名称: "36",
+          时间戳: "2023-12-31 20:20:00",
+          有功功率: 523.07,
+          风轮转速: 6.46,
+          发电机转速: 6.46,
+          风速: 4.84,
+          桨距角1: -1,
+          桨距角2: -1,
+          桨距角3: -1,
+          机舱位置: 246.5,
+          对风角度: -4.87,
+          发电机驱动端轴承温度: 43.69,
+          机舱内温度: 7.76,
+          环境温度: 3.8,
+          主轴承轴承温度: 43.69,
+          主轴承轴承温度2: 0,
+          发电机绕组1温度: 51.67,
+          发电机绕组2温度: 50.95,
+          发电机绕组3温度: 49.39,
+          电网A相电流: 449.76,
+          电网B相电流: 446.67,
+          电网C相电流: 450.7,
+        },
+      ],
     };
   },
+  computed: {
+    columns() {
+      // 如果 records 为空则返回空数组
+      return this.records.length > 0 ? Object.keys(this.records[0]) : [];
+    },
+  },
   watch: {
     chartData: {
       deep: true,
@@ -50,10 +170,78 @@ export default {
     }
   },
   methods: {
+    resetDialogPosition() {
+      this.$nextTick(() => {
+        const dialogEl = this.$refs.myDialog?.$el?.querySelector(".el-dialog");
+        if (dialogEl) {
+          // 清除拖拽遗留位置样式,恢复居中
+          dialogEl.style.left = "0px";
+          dialogEl.style.top = "150px";
+          dialogEl.style.transform = "0px";
+        }
+      });
+    },
+
     initChart() {
       this.myChart = echarts.init(this.$refs.chartRef);
       this.updateChart();
+
+      this.myChart.getZr().on("click", (params) => {
+        const pointInPixel = [params.offsetX, params.offsetY];
+        const pointInGrid = this.myChart.convertFromPixel(
+          { xAxisIndex: 0, yAxisIndex: 0 },
+          pointInPixel
+        );
+        const clickedTime = pointInGrid[0];
+
+        if (!this.chartData.timestamps.length) return;
+
+        // 找最接近点击时间的索引
+        let minDiff = Infinity;
+        let closestIndex = -1;
+        for (let i = 0; i < this.chartData.timestamps.length; i++) {
+          const time = new Date(this.chartData.timestamps[i]).getTime();
+          const diff = Math.abs(time - clickedTime);
+          if (diff < minDiff) {
+            minDiff = diff;
+            closestIndex = i;
+          }
+        }
+
+        if (closestIndex !== -1) {
+          const value = this.chartData.values[closestIndex];
+          const time = this.chartData.timestamps[closestIndex];
+  this.myChart.setOption({
+    series: [
+      {
+        markLine: {
+          symbol: 'none',
+          lineStyle: {
+            type: 'dashed',
+            color: '#FF0000',
+          },
+          data: [
+            {
+              xAxis: time,
+            },
+          ],
+        },
+      },
+    ],
+  });
+          if (value === 1) {
+            console.log("点击对应的values值:", value);
+            console.log("对应的timestamps:", time);
+            console.log("fieldCode:", this.fieldCode);
+            console.log("windTurbineNumber:", this.windTurbineNumber);
+            console.log("bearingKey:", this.bearingKey);
+
+            this.dialogVisible = !this.dialogVisible;
+          }
+        }
+      });
     },
+
     updateChart() {
       if (!this.myChart || !this.chartData.timestamps.length) return;
 

+ 151 - 78
src/views/health/malfunction copy.vue → src/views/health/malfunction copy 2.vue

@@ -91,11 +91,12 @@
           start-placeholder="开始日期"
           end-placeholder="结束日期"
         />
+        <!-- :picker-options="datePickerOptions" -->
       </p>
       <el-button
         type="primary"
         size="small"
-        @click="conditions(1)"
+        @click="onSearchClick"
         class="search-btn"
         >查询</el-button
       >
@@ -105,6 +106,7 @@
     <div class="main-body">
       <keep-alive>
         <component
+          ref="activeComponent"
           :is="activeTab"
           :codedata="tabData[activeTab].codedata"
           v-bind="
@@ -114,6 +116,8 @@
           "
           :totalCount="tabData[activeTab].totalCount"
           :totalPage="tabData[activeTab].totalPage"
+          :fieldCode="tabConditions[activeTab].companyCode"
+          :windTurbineNumber="tabConditions[activeTab].unitvalue"
           @updatePage="handlePageChange"
         />
       </keep-alive>
@@ -150,8 +154,8 @@ export default {
   },
   data() {
     return {
-      activeTab: "Temperature",
-      activeName: "Temperature",
+      activeTab: "Bearing",
+      activeName: "Bearing",
       menuItems: [
         {
           name: "轴承诊断",
@@ -205,6 +209,24 @@ export default {
           echartsdata: {},
         },
       },
+      datePickerOptions: {
+        onPick: ({ minDate, maxDate }) => {
+          if (minDate && !maxDate) {
+            const maxTime = new Date(
+              minDate.getTime() + 30 * 24 * 60 * 60 * 1000
+            );
+            this.datePickerOptions.disabledDate = (time) => {
+              return (
+                time.getTime() < minDate.getTime() ||
+                time.getTime() > maxTime.getTime()
+              );
+            };
+          } else {
+            this.datePickerOptions.disabledDate = () => false;
+          }
+        },
+        disabledDate: () => false,
+      },
     };
   },
   created() {
@@ -241,9 +263,7 @@ export default {
     },
     parentChange(data) {
       const condition = this.tabConditions[this.activeTab];
-
       if (!data?.codeNumber) return;
-
       condition.unitvalue = "";
       condition.monitoringvalue = "";
       condition.frequencyvalue = "";
@@ -257,10 +277,14 @@ export default {
       });
 
       axios
-        .get(`/ETLapi/waveData/getAllSamplingFrequency/${data.codeNumber}`)
-        .then((res) => {
-          condition.frequencyoptions = res.data.datas;
-        });
+ .get(`/ETLapi/waveData/getAllSamplingFrequency/${data.codeNumber}`)
+.then((res) => {
+  condition.frequencyoptions = (res.data.datas || [])
+    .map(item => Number(item))
+    .filter(num => num >= 12800)
+    .map(num => num.toString());
+});
+
 
       condition.companyCode = data.codeNumber;
     },
@@ -275,7 +299,7 @@ export default {
           if (res.data.code === 500) {
             condition.monitoringoptions = [];
             this.$message({
-              message: res.data.message || "未知错误",
+              message: "当前风场不存在测点和采样频率数据" || "未知错误",
               type: "warning",
             });
             return;
@@ -309,82 +333,131 @@ export default {
       });
       return processedData;
     },
+    onSearchClick() {
+      this.conditions(1, false); // 主动查询,第一页,非分页触发
+    },
     handlePageChange(page) {
-      this.conditions(page);
+      this.conditions(page, true); // true 表示分页触发
     },
-    conditions(page) {
-      const tab = this.activeTab;
-      const condition = this.tabConditions[tab];
-
-      const params = {
-        samplingFrequency: condition.frequencyvalue,
-        windCode: condition.companyCode,
-        windTurbineNumberList: [condition.unitvalue],
-        mesureNameList: [condition.monitoringvalue],
-        startTime: this.$formatDateTWO(condition.timevalue[0]),
-        endTime: this.$formatDateTWO(condition.timevalue[1]),
-        pageNo: page,
-        pageSize: 10,
-      };
 
-      if (tab === "Temperature") {
-        const temperature = {
-          windCode: "WOF046400029",
-          windTurbineNumberList: ["WOG01312"],
-          startTime: "2023-10-01 00:00",
-          endTime: "2023-10-07 00:00",
-          pageNo: page,
-          pageSize: 500,
-        };
-
-        const loading = this.$loading({
-          lock: true,
-          text: "温度诊断数据加载中,请稍候…",
-          spinner: "el-icon-loading",
-          background: "rgba(0, 0, 0, 0.8)", // 稍浅一些,更柔和
-          customClass: "custom-loading-style", // 可选:如果你有样式可以加类名
-        });
+    conditions(page, isPageChange = false) {
+      const tab = this.activeTab;
+      this.$nextTick(() => {
+        const comp = this.$refs.activeComponent;
+        if (comp && typeof comp.reset === "function") {
+          comp.reset();
+        }
+      });
 
-        const thresholdReq = axios
-          .post("/AnalysisMulti/temperature/threshold", temperature)
-          .then((res) => {
-            const data = res.data.data.records || [];
-            this.tabData[tab].codedata = data;
-            this.tabData[tab].totalCount = res.data.data.totalSize || 0;
-            console.log("温度诊断总数:", res.data.data.totalSize);
-          })
-          .catch((err) => {
-            console.error("温度诊断请求失败:", err);
-            this.$message.error("温度诊断数据请求失败,请稍后再试");
+      // 把后面接口请求部分放进延迟里,确保 reset 先执行完成
+      setTimeout(() => {
+        const condition = this.tabConditions[tab];
+
+        if (tab === "Temperature") {
+          const temperature = {
+            windCode: condition.companyCode,
+            windTurbineNumberList: [condition.unitvalue],
+            startTime: this.$formatDateTWO(condition.timevalue[0]),
+            endTime: this.$formatDateTWO(condition.timevalue[1]),
+            pageNo: page,
+            pageSize: 500,
+          };
+
+          const loading = this.$loading({
+            lock: true,
+            text: "温度诊断数据加载中,请稍候…",
+            spinner: "el-icon-loading",
+            background: "rgba(0, 0, 0, 0.8)",
           });
 
-        const trendReq = axios
-          .post("/AnalysisMulti/SPRT/trend", temperature)
-          .then((res) => {
-            const echartsdata = res.data.data || {};
-            this.tabData[tab].echartsdata = echartsdata;
-            console.log("趋势图数据:", echartsdata);
-          })
-          .catch((err) => {
-            console.error("趋势图请求失败:", err);
-            this.$message.error("温度趋势图数据请求失败,请稍后再试");
-          });
+          const emptyEchartsData = {
+            gearbox_oil: { timestamps: [], values: [] },
+            generator_drive_end: { timestamps: [], values: [] },
+            generator_nondrive_end: { timestamps: [], values: [] },
+            main_bearing: { timestamps: [], values: [] },
+          };
+
+          const trendRequest = () => {
+            const trendStart = performance.now();
+            return axios
+              .post("/AnalysisMulti/SPRT/trend", temperature)
+              .then((res) => {
+                const trendEnd = performance.now();
+                console.log(
+                  `温度诊断 trend 接口耗时: ${(
+                    (trendEnd - trendStart) /
+                    1000
+                  ).toFixed(2)}s`
+                );
+                const echartsdata = res.data.data || {};
+                this.tabData[tab].echartsdata = echartsdata;
+              })
+              .catch((err) => {
+                console.error("趋势图请求失败:", err);
+                this.$message.error("温度趋势图数据请求失败,请稍后再试");
+              });
+          };
+
+          const thresholdStart = performance.now();
+          const thresholdReq = axios
+            .post("/AnalysisMulti/temperature/threshold", temperature)
+            .then((res) => {
+              const thresholdEnd = performance.now();
+              console.log(
+                `温度诊断 threshold 接口耗时: ${(
+                  (thresholdEnd - thresholdStart) /
+                  1000
+                ).toFixed(2)}s`
+              );
+
+              const data = res.data.data.records || [];
+              this.tabData[tab].codedata = data;
+              this.tabData[tab].totalCount = res.data.data.totalSize || 0;
+
+              if (!data.length) {
+                this.$message.warning("暂无诊断数据");
+                this.tabData[tab].echartsdata = emptyEchartsData;
+                return Promise.resolve("skip trend");
+              }
+
+              return isPageChange ? Promise.resolve() : trendRequest();
+            })
+            .catch((err) => {
+              console.error("温度诊断请求失败:", err);
+              this.$message.error("温度诊断数据请求失败,请稍后再试");
+            });
 
-        // 所有请求完成后关闭 loading
-        Promise.allSettled([thresholdReq, trendReq]).finally(() => {
-          loading.close();
-        });
-      } else {
-        // 默认其他组件逻辑
-        axios
-          .post("/ETLapi/waveData/getMesureDataWithSF", params)
-          .then((res) => {
-            const data = res.data || {};
-            this.tabData[tab].codedata = data.datas || [];
-            this.tabData[tab].totalCount = data.totalCount || 0;
-            this.tabData[tab].totalPage = data.totalPage || 0;
+          Promise.resolve(thresholdReq).finally(() => {
+            loading.close();
           });
-      }
+        } else {
+          const params = {
+            samplingFrequency: condition.frequencyvalue,
+            windCode: condition.companyCode,
+            windTurbineNumberList: [condition.unitvalue],
+            mesureNameList: [condition.monitoringvalue],
+            startTime: this.$formatDateTWO(condition.timevalue[0]),
+            endTime: this.$formatDateTWO(condition.timevalue[1]),
+            pageNo: page,
+            pageSize: 10,
+          };
+
+          const startTime = performance.now();
+          axios
+            .post("/ETLapi/waveData/getMesureDataWithSF", params)
+            .then((res) => {
+              const endTime = performance.now();
+              console.log(
+                `其他 tab 接口请求耗时: ${(endTime - startTime).toFixed(2)}ms`
+              );
+
+              const data = res.data || {};
+              this.tabData[tab].codedata = data.datas || [];
+              this.tabData[tab].totalCount = data.totalCount || 0;
+              this.tabData[tab].totalPage = data.totalPage || 0;
+            });
+        }
+      }, 300); // 延迟100毫秒执行接口请求逻辑
     },
   },
 };

+ 2 - 1
src/views/home/Index.vue

@@ -2,7 +2,7 @@
   <div class="homeWrap" v-loading="loading">
     <el-container v-if="isShowHd">
       <el-main>
-        <el-header>
+        <el-header >
           <div class="headerHDBox">
             <div class="headerLeft"></div>
             <!-- <HeaderCom class="headerRight" @setLoding="setLoding"></HeaderCom> -->
@@ -89,6 +89,7 @@ export default {
   padding: 0 !important;
   background: #1b3b7f;
   color: #fff !important;
+height: 80px !important;
   .headerHDBox {
     display: flex;
     justify-content: space-between;

+ 9 - 2
src/views/home/components/MenuHD.vue

@@ -13,6 +13,7 @@
       background-color="#1b3b7f"
       text-color="#fff"
       active-text-color="#ffd04b"
+
     >
       <!--     :active-text-color="activeTextColor" -->
       <template v-for="(item, indexMenu) in routerList">
@@ -258,7 +259,7 @@ export default {
   background-repeat: no-repeat !important;
   background-position: center !important;
   background-size: 100%, 100% !important;
-  height: 60px !important;
+  height: 80px !important;
   width: 140px !important;
   display: flex !important;
   align-items: center !important;
@@ -388,4 +389,10 @@ export default {
     padding: 0 5px !important;
   }
 }
-</style> -->
+.el-submenu__title * {
+  font-size: 16px;
+}
+.el-menu-item * {
+  font-size: 16px;
+}
+</style>

+ 1 - 1
src/views/ledger/windsite.vue

@@ -861,7 +861,7 @@ export default {
           params.fieldCode = this.detail.fieldCode;
         }
         console.log(this.form, params);
-        return;
+        // return;
 
         // Determine which API to call
         const API = this.isEdit

+ 2 - 2
vue.config.js

@@ -66,8 +66,8 @@ module.exports = {
         // target: "http://192.168.5.4:16200", // 石月
         // target: "http://192.168.50.235:16200", // 内网
         // target: "http://192.168.5.15:16200",
-        target: "http://192.168.50.235:16500", //演示环境
-        // target: "http://106.120.102.238:26500", //外网演示环境
+        // target: "http://192.168.50.235:16500", //演示环境
+        target: "http://106.120.102.238:26500", //外网演示环境
         // target: "http://106.120.102.238:16700", // 外网16700  生产16600
         // target: "http://10.96.137.5",
         changeOrigin: true,