rui.jiang 6 miesięcy temu
rodzic
commit
117d4c57c6

Plik diff jest za duży
+ 21 - 22277
package-lock.json


+ 34 - 0
src/api/ledger.js

@@ -495,3 +495,37 @@ export function delWindFieldContractById(data) {
     data,
   });
 }
+
+
+// 风机异常信息
+export function queryDetectionDic(data) {
+  return request({
+    url: "/energy-manage-service/waveDic/queryDetectionDic",
+    method: "get",
+    data,
+  });
+}
+
+
+
+
+
+// // 获取测点数据
+export function getMesureData(data) {
+  return request({
+    url: "/WZLapi/waveData/getMesureData", // 使用正确的路径,不包含 /api 前缀
+    method: "post",
+    data,
+  });
+}
+
+
+
+// // 获取测点数据
+export function gettime(data) {
+  return request({
+    url: "/WJapi/analysis/time", // 使用正确的路径,不包含 /api 前缀
+    method: "post",
+    data,
+  });
+}

+ 1 - 0
src/components/selecttree.vue

@@ -1,6 +1,7 @@
 <template>
   <div class="selectTree">
     <el-select
+    size="small"
       ref="elSelect"
       v-model="newVal"
       :placeholder="placeholder"

+ 74 - 66
src/views/health/components/timedomaincharts.vue

@@ -1,24 +1,24 @@
 <template>
   <div>
+    <div class="FD">
+      <div v-if="TZshow" class="eigenvalue">
+        <h5>特征值</h5>
+        <p>有效值:{{ this.timeList.Xrms }}</p>
+        <p>平均值:{{ this.timeList.mean_value }}</p>
+        <p>最大值:{{ this.timeList.max_value }}</p>
+        <p>最小值:{{ this.timeList.min_value }}</p>
+        <p>峰值:{{ this.timeList.Xp }}</p>
+        <p>峰峰值:{{ this.timeList.Xpp }}</p>
+        <p>波形因子:{{ this.timeList.Sf }}</p>
+        <p>脉冲指标:{{ this.timeList.If }}</p>
+        <p>裕度指标:{{ this.timeList.Ce }}</p>
+        <p>偏度指标:{{ this.timeList.Cw }}</p>
+        <p>峭度指标:{{ this.timeList.Cq }}</p>
+      </div>
+    </div>
     <!-- ECharts 图表容器 -->
- 
 
-    <div class="line-chart" ref="chart">
-      <!-- <div class="eigenvalue">
-                <h5>特征值</h5>
-                <p>有效值:</p>
-                <p>平均值:</p>
-                <p>最大值:</p>
-                <p>最小值:</p>
-                <p>峰值:</p>
-                <p>峰峰值:</p>
-                <p>波形因子:</p>
-                <p>脉冲指标:</p>
-                <p>裕度指标:</p>
-                <p>偏度指标:</p>
-                <p>峭度指标:</p>
-              </div> -->
-    </div>
+    <div class="line-chart" ref="chart"></div>
   </div>
 </template>
 
@@ -28,29 +28,20 @@ import * as echarts from "echarts"; // 导入 echarts 库
 export default {
   name: "TimedomainCharts", // 组件名称
   props: {
-    // 可以通过 props 接收外部传入的数据
-    chartData: {
-      type: Array,
-      required: true,
-    },
-    chartLabels: {
-      type: Array,
-      required: true,
-    },
     currentIndex: {
       type: Number,
       default: 0,
     },
-    tableData: {
-      type: Array,
-      default: () => [],
+    timeList: {
+      type: Object,
+      default: () => ({}),
     },
   },
   data() {
     return {
       chartInstance: null,
       option: null,
-      
+      TZshow: false,
     };
   },
   watch: {
@@ -62,11 +53,13 @@ export default {
       this.updateChart(this.chartData, newLabels);
     },
   },
+
   mounted() {
-    this.initializeChart();
+    this.$nextTick(() => {
+      this.initializeChart();
+    });
   },
   methods: {
-    // 初始化图表
     initializeChart() {
       // 获取图表容器
       const chartDom = this.$refs.chart;
@@ -74,13 +67,17 @@ export default {
       this.chartInstance = echarts.init(chartDom);
 
       // 默认图表数据和配置
-      const defaultData = [Math.random() * 300];
-      const defaultLabels = ["2024/1/1"];
+      const defaultData = this.timeList.y;
+      const defaultLabels = this.timeList.x;
       this.updateChart(defaultData, defaultLabels);
     },
     // 更新图表数据
     updateChart(data, labels) {
       const option = {
+        title: {
+          text: this.timeList.title,
+          left: "center",
+        },
         toolbox: {
           feature: {
             dataZoom: { yAxisIndex: "none" },
@@ -102,39 +99,50 @@ export default {
               show: true,
               title: "特征值",
               icon: `image://${require("@/assets/analyse/10.png")}`,
-              onclick: () => alert("自定义按钮被点击!"),
+              onclick: () => this.Show(),
             },
           },
         },
         xAxis: {
           type: "category",
-          boundaryGap: false,
-          data: labels,
+          name: this.timeList.xaxis, // 设置X轴标题
+          nameLocation: "center", // 标题位置:可选 "start" | "center" | "end"
+          nameTextStyle: {
+            fontSize: 14,
+            color: "#333", // 标题颜色
+            padding: [10, 0, 0, 0], // 上、右、下、左的间距
+          },
+          data: labels, // 横坐标数据
+          boundaryGap: false, // 坐标轴是否留白
+          position: "bottom", // 确保X轴在底部
         },
+
         yAxis: {
           type: "value",
-          boundaryGap: [0, "100%"],
+          name: this.timeList.yaxis,
         },
         tooltip: {
           trigger: "axis",
-          position: function (pt) {
-            return [pt[0], "10%"];
+          axisPointer: {
+            type: "line", // 显示十字线
           },
         },
         series: [
           {
             name: "数据系列",
-            type: "line",
-            symbol: "none",
-            sampling: "lttb",
-            itemStyle: { color: "rgb(255, 70, 131)" },
-            areaStyle: {
-              color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
-                { offset: 0, color: "rgb(255, 158, 68)" },
-                { offset: 1, color: "rgb(255, 70, 131)" },
-              ]),
+            type: "line", // 折线图
+            data: data, // 数据
+            symbol: "none", // 数据点的样式
+            symbolSize: 8, // 数据点的大小
+            lineStyle: {
+              color: "rgb(75, 192, 192)", // 折线颜色
+              width: 2, // 线条宽度
+            },
+            itemStyle: {
+              color: "rgb(75, 192, 192)", // 数据点颜色
+              borderColor: "#fff",
+              borderWidth: 2,
             },
-            data: data,
           },
         ],
       };
@@ -144,20 +152,16 @@ export default {
     },
 
     previousRow() {
-      let newIndex =
-        this.currentIndex > 0
-          ? this.currentIndex - 1
-          : this.tableData.length - 1;
-      console.log("previousRow newIndex:", newIndex);
-      this.$emit("update:currentIndex", newIndex); // 更新父组件的 currentIndex
+   
     },
+
     nextRow() {
-      let newIndex =
-        this.currentIndex < this.tableData.length - 1
-          ? this.currentIndex + 1
-          : 0;
-      console.log("nextRow newIndex:", newIndex);
-      this.$emit("update:currentIndex", newIndex); // 更新父组件的 currentIndex
+     
+    },
+ 
+
+    Show() {
+      this.TZshow = !this.TZshow;
     },
   },
 };
@@ -168,21 +172,25 @@ export default {
   width: 100%;
   height: 250px;
 }
+.FD {
+  width: 100%;
+  height: 1px;
+  position: relative;
+}
 
 .eigenvalue {
   position: absolute;
-  top: 0;
+  top: 30px;
   right: 0;
   font-size: 10px;
   width: 100px;
   border: 1px solid black;
   padding: 5px;
   background: #fff;
-  z-index: 99 h5 {
+  z-index: 99;
+  h5 {
     line-height: 16px;
     height: 16px;
   }
 }
-
-
 </style>

+ 187 - 55
src/views/health/vibration.vue

@@ -28,24 +28,34 @@
     <div class="searchbox">
       <p>
         单位:
-        <el-select v-model="company" size="small" placeholder="请选择">
-          <el-option
-            v-for="item in companyoptions"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value"
-          >
-          </el-option>
-        </el-select>
+        <selecttree
+          style="width: 220px"
+          placeholder="请选择上级单位"
+          :list="parentOpt"
+          type="1"
+          v-model="companyCode"
+          @change="parentChange"
+          :defaultParentProps="{
+            children: 'children',
+            label: 'companyName',
+            value: 'codeNumber',
+          }"
+        >
+        </selecttree>
       </p>
       <p>
         风机:
-        <el-select v-model="unitvalue" size="small" placeholder="请选择">
+        <el-select
+          v-model="unitvalue"
+          @change="getchedian"
+          size="small"
+          placeholder="请选择"
+        >
           <el-option
             v-for="item in unitoptions"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value"
+            :key="item.engineCode"
+            :label="item.engineName"
+            :value="item.engineCode"
           >
           </el-option>
         </el-select>
@@ -55,9 +65,9 @@
         <el-select v-model="monitoringvalue" size="small" placeholder="请选择">
           <el-option
             v-for="item in monitoringoptions"
-            :key="item.value"
-            :label="item.label"
-            :value="item.value"
+            :key="item.detectionPointEn"
+            :label="item.detectionPointCn"
+            :value="item.detectionPointEn"
           >
           </el-option>
         </el-select>
@@ -74,7 +84,9 @@
         >
         </el-date-picker>
       </p>
-      <el-button type="primary" size="small">查询</el-button>
+      <el-button type="primary" size="small" @click="conditions"
+        >查询</el-button
+      >
       <el-button size="small">导出</el-button>
     </div>
     <div class="main-body">
@@ -111,14 +123,12 @@
               minimized: item.isMinimized,
             }"
           >
-            <p>测点路径:</p>
+            <p>测点路径:{{}}</p>
             <P><span>采样频率:</span><span>采样时间:</span></P>
             <div v-if="item.name === '时域图'">
               <timedomaincharts
-                :chartData="chartData"
-                :chartLabels="chartLabels"
+                :timeList="timeList"
                 :currentIndex="currentIndex"
-                :tableData="tableData"
                 @update:currentIndex="handleCurrentIndexUpdate"
               ></timedomaincharts>
             </div>
@@ -149,17 +159,21 @@
       <div class="data-origin">
         <el-table
           ref="singleTable"
-          :data="tableData"
+          :data="tableDataList"
           :current-row-key="currentIndex"
           @current-change="handleCurrentChange"
           highlight-current-row
           style="width: 100%"
         >
           <el-table-column type="index" label="排序"> </el-table-column>
-          <el-table-column prop="name" label="时间"> </el-table-column>
-          <el-table-column prop="address" label="测点名称"> </el-table-column>
-          <el-table-column prop="address" label="场站"> </el-table-column>
-          <el-table-column prop="address" label="风机"> </el-table-column>
+          <el-table-column prop="timeStamp" label="时间"> </el-table-column>
+          <el-table-column prop="mesurePointName" label="测点名称">
+          </el-table-column>
+          <el-table-column prop="address" label="场站">
+            {{ this.companyCode }}
+          </el-table-column>
+          <el-table-column prop="windTurbineNumber" label="风机" width="80px">
+          </el-table-column>
         </el-table>
       </div>
     </div>
@@ -167,18 +181,27 @@
 </template>
 
 <script>
+import {
+  getSysOrganizationAuthTreeByRoleId,
+  windEngineGrouPage,
+  queryDetectionDic,
+  getMesureData,
+} from "@/api/ledger.js";
+import selecttree from "../../components/selecttree.vue";
+
 import * as echarts from "echarts";
 import envelopecharts from "./components/envelopecharts.vue";
 import spectrogramcharts from "./components/spectrogramcharts.vue";
 import tendencycharts from "./components/tendencycharts.vue";
 import timedomaincharts from "./components/timedomaincharts.vue";
-
+import axios from "axios";
 export default {
   components: {
     envelopecharts,
     spectrogramcharts,
     tendencycharts,
     timedomaincharts,
+    selecttree,
   },
   data() {
     return {
@@ -187,7 +210,7 @@ export default {
       tableData: [],
       data: [10, 20, 30, 40], // 假设是图表的数据
       labels: ["2024/1/1", "2024/1/2", "2024/1/3", "2024/1/4"], // 假设是时间轴数据
-      currentIndex: 0,
+
       tableData: [], // 假设是来自父组件的数据
 
       company: "",
@@ -196,40 +219,121 @@ export default {
       unitoptions: [],
       monitoringvalue: "",
       monitoringoptions: [],
-      timevalue: "",
-      tableData: [
-        { name: "2024-11-01", address: "Location A" },
-        { name: "2024-11-02", address: "Location B" },
-        { name: "2024-11-03", address: "Location C" },
-      ],
+
+      tableData: [],
 
       fourList: [],
       currentRow: null, // 用于存储当前选中的行
       currentIndex: 0,
       isChartVisible: false,
+      parentOpt: [],
+      defaultdata: {},
+      companyCode: "",
+      maplist: {},
+      timevalue: [], // 绑定 el-date-picker 的值
+      startTime: "", // 开始时间
+      endTime: "", // 结束时间
+      tableDataList: [],
+
+      timeList: {},
     };
   },
 
+  created() {
+    this.GETtree();
+  },
   methods: {
+    // 获取风场
+    async GETtree() {
+      const res = await getSysOrganizationAuthTreeByRoleId();
+      const treedata = res.data;
+      const processedData = this.processTreeData(treedata);
+      this.parentOpt = processedData;
+      this.defaultdata = res.data[0];
+    },
+
+    parentChange(data) {
+      this.maplist = data;
+      this.maplistArr = data;
+      let paramsData = {
+        fieldCode: this.maplist.codeNumber,
+        pageNum: 1,
+        pageSize: 99,
+      };
+      this.unitvalue = "";
+      // 获取风机
+      windEngineGrouPage(paramsData).then((res) => {
+        this.unitoptions = res.data.list;
+      });
+
+      console.log(data, "parentChange");
+      if (data.codeType === "field") {
+        if (this.parseCoordinates(data.longitudeAndLatitudeString).length > 0) {
+          return;
+        }
+      } else {
+        const dataMapList = data.children;
+        dataMapList.forEach((element) => {
+          console.log(element);
+          if (
+            this.parseCoordinates(element.longitudeAndLatitudeString).length >
+              0 &&
+            element.codeType === "field"
+          ) {
+            return;
+          }
+        });
+      }
+    },
+    processTreeData(treeData) {
+      const processedData = [];
+      function processNode(node) {
+        if (node.codeType === "field") {
+          node.companyName = node.fieldName;
+        }
+        if (node.children && node.children.length > 0) {
+          node.children.forEach((child) => {
+            processNode(child);
+          });
+        }
+      }
+      treeData.forEach((root) => {
+        processNode(root);
+        processedData.push(root);
+      });
+      return processedData;
+    },
+    parseCoordinates(input) {
+      if (input && typeof input === "string") {
+        return input.split(",").map(Number);
+      }
+      // debugger;
+      return [];
+    },
+    // 获取测点
+    getchedian(value) {
+      queryDetectionDic({ engineCodes: value }).then((res) => {
+        this.monitoringoptions = res.data;
+      });
+    },
+// 更新父组件的 currentIndex
     handleCurrentIndexUpdate(newIndex) {
       this.currentIndex = newIndex;
+      this.setCurrentRowData(newIndex)
     },
+
+    // 当前所在行高亮提示
     setCurrent(row) {
-      this.$nextTick(() => {
-        if (this.$refs.singleTable) {
-          this.$refs.singleTable.setCurrentRow(row); // 设置当前行
-        } else {
-          console.warn("Cannot access $refs.singleTable: it's undefined.");
-        }
-      });
+      this.$refs.singleTable.setCurrentRow(row);
     },
+    // 当前单选
     handleCurrentChange(val) {
-      this.currentRow = val; // 处理当前选中行
-      const index = this.tableData.indexOf(val); // 获取当前选中行的索引
+      this.currentRow = val;
+      const index = this.tableData.indexOf(val);
       this.currentIndex = index; // 更新当前索引
-      console.log("currentIndex updated to:", this.currentIndex);
     },
 
+
     generate(type) {
       if (!this.currentRow) {
         this.$message.warning("请先选择数据");
@@ -240,7 +344,6 @@ export default {
         1: "时域图", // Time Domain Chart
         2: "频谱图", // Spectrogram Chart
         3: "包络谱图", // Envelope Spectrum Chart
-
       };
 
       const chartName = nameMap[type];
@@ -252,6 +355,19 @@ export default {
         };
         this.fourList.push(newItem);
       }
+      const params = {
+        ids: [67803],
+        windCode: "SKF001_wave",
+        analysisType: "time",
+      };
+
+      axios
+        .post("/WJapi/analysis/time", params)
+        .then((res) => {
+          this.timeList = JSON.parse(res.data);
+          console.log(this.timeList);
+        })
+        .catch((error) => {});
     },
 
     tendency() {
@@ -267,9 +383,34 @@ export default {
       this.fourList.push(newItem);
     },
 
+    //   // const params = {
+    //   //   windCode: this.maplist.codeNumber,
+    //   //   windTurbineNumberList: this.unitvalue,
+    //   //   mesureNameList: this.monitoringvalue,
+    //   //   startTime: this.$formatDateTWO(this.timevalue[0]),
+    //   //   endTime: this.$formatDateTWO(this.timevalue[1]),
+    //   // };
+    conditions() {
+      const params = {
+        endTime: "2024-07-02 00:00:00",
+        mesureNameList: ["gearbox_input_end_radial_vibration"],
+        startTime: "2024-07-01 00:00:00",
+        windCode: "SKF001",
+        windTurbineNumberList: ["F004"],
+      };
 
+      axios
+        .post("/WZLapi/waveData/getMesureData", params)
+        .then((res) => {
+          this.tableDataList = res.data.datas;
+          console.log(this.tableDataList, "-----------------");
+        })
+        .catch((error) => {
+          console.error("Error:", error);
+          // Handle the error here
+        });
+    },
 
-    
     // 缩小
     lessen(index) {
       if (!this.fourList[index].isMinimized) {
@@ -391,13 +532,4 @@ export default {
   height: 0px; /* Adjust height when minimized */
   overflow: hidden;
 }
-
-#main {
-  width: 100%;
-  height: 280px;
-}
-
-// .line-chart {
-//   position: relative;
-// }
 </style>

+ 30 - 8
vue.config.js

@@ -64,25 +64,46 @@ module.exports = {
     proxy: {
       "/api": {
         // target: "http://192.168.5.4:16200", // 石月
-        // target: "http://192.168.50.235:16200", //内网
+        target: "http://192.168.50.235:16200", // 内网
         // target: "http://192.168.5.15:16200",
-        target: "http://106.120.102.238:16700", //外网  16600   16700
-        //  target: "http://10.96.137.5",
+        // target: "http://106.120.102.238:16700", // 外网  16600   16700
+        // target: "http://10.96.137.5",
         changeOrigin: true,
         pathRewrite: {
-          "^/api": "", // 需要regit write重写的,
+          "^/api": "", // 去掉 /api 前缀
         },
         onProxyReq(proxyReq, req, res) {
-          console.log("Proxying request to:", proxyReq.path); // 打印代理请求路径
+          console.log("Proxying /api request to:", proxyReq.path); // 打印代理请求路径
         },
       },
+      // 未知量
+      "/WZLapi": {
+        target: "http://192.168.50.241:9001", // WZLapi 目标地址
+        changeOrigin: true,
+        pathRewrite: {
+          "^/WZLapi": "", // 去掉 /WZLapi 前缀
+        },
+      
+      },
+         // 文佳
+         "/WJapi": {
+          target: "http://192.168.5.28:8888", // WZLapi 目标地址
+          changeOrigin: true,
+          pathRewrite: {
+            "^/WJapi": "", // 去掉 /WZLapi 前缀
+          },
+          onProxyReq(proxyReq, req, res) {
+            console.log("Proxying /sAlgorithm request to:", proxyReq.path); // 打印代理请求路径
+          },
+        },
       "/transDataWeb": {
         target: "http://192.168.50.241:9000/trans_data_web",
         changeOrigin: true,
         pathRewrite: {
-          "^/transDataWeb": "", // 需要regit write重写的,
+          "^/transDataWeb": "", // 去掉 /transDataWeb 前缀
         },
       },
+
       "/sAlgorithm": {
         target: "http://192.168.5.28:8666", // 目标地址
         changeOrigin: true,
@@ -90,14 +111,15 @@ module.exports = {
           "^/sAlgorithm": "", // 如果后端需要 `/api` 前缀
         },
         onProxyReq(proxyReq, req, res) {
-          console.log("Proxying request to:", proxyReq.path); // 打印代理请求路径
+          console.log("Proxying /sAlgorithm request to:", proxyReq.path); // 打印代理请求路径
         },
       },
+
       "/databaseApi": {
         target: "http://192.168.5.18:3000",
         changeOrigin: true,
         pathRewrite: {
-          "^/databaseApi": "", // 如果后端需要 `/api` 前缀
+          "^/databaseApi": "", // 去掉 /databaseApi 前缀
         },
       },
     },

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików