Browse Source

性能预警综合分析

lining 3 years ago
parent
commit
b9c701a280

+ 6 - 0
src/App.vue

@@ -476,4 +476,10 @@ body {
     border-color: #05bb4c;
   }
 }
+.el-tree-node__content{
+  height: 40px !important;
+}
+.el-tree-node__label{
+  font-size: 18px !important;
+}
 </style>

+ 1 - 1
src/api/axios.js

@@ -85,7 +85,7 @@ export function requestData(options) {
         // window.location.reload();
         // window.__STATICVUE__.$router.replace('/login');
 
-      } else if (response.data.code === 200 || response.data.length>=0) { // 请求成功 code
+      } else if (response.data.code === 200 || response.data.length>=0 || response.data.records) { // 请求成功 code
 
         options.success && options.success(response.data);
         resolve(response);

+ 6 - 0
src/router/index.js

@@ -809,6 +809,12 @@ const routes = [{
 	name: "warning",
 	component: () => import("../views/sampleDatabase/warning/index.vue")
 },
+//性能预警综合分析
+{
+	path: "/others/analysis",
+	name: "analysis",
+	component: () => import("../views/sampleDatabase/analysis/index.vue")
+},
 //智能营销样本库
 {
 	path: "/others/market",

+ 1 - 0
src/views/MalfunctionWarning/MalfunctionWarning.vue

@@ -252,6 +252,7 @@
       v-model="resultsDisplay"
       :allData="showList"
       :intervalValue="intervalValue"
+      :moudleList="faultLists"
       @save-date="saveData"
     ></TrainingResults>
     <Records @results="recordResults" v-model="recordsDisplay"></Records>

+ 9 - 53
src/views/MalfunctionWarning/components/trainingResults.vue

@@ -77,7 +77,6 @@
                 align="center"
               ></el-table-column>
               <el-table-column width="150">
-                     
                 <template #default="scope">
                   <span>
                     <el-select
@@ -90,15 +89,14 @@
                     >
                       <el-option
                         v-for="item in moudleList"
-                        :key="item.value"
-                        :label="item.label"
-                        :value="item.value"
+                        :key="item.faultcode"
+                        :label="item.faulttype"
+                        :value="item.faultcode"
                       >
                       </el-option>
                     </el-select>
                   </span>
                 </template>
-                   
               </el-table-column>
             </el-table>
           </div>
@@ -155,6 +153,12 @@ export default {
       type: Number,
       default: 1,
     },
+    moudleList: {
+      type: Array,
+      default: () => {
+        return [];
+      },
+    },
   },
   data() {
     return {
@@ -162,54 +166,6 @@ export default {
       lableList: [],
       lineList: [],
       batchDisplay: false,
-      moudleList: [
-        {
-          id: 0,
-          value: "JC",
-          label: "机舱故障",
-        },
-        {
-          id: 1,
-          value: "BJ",
-          label: "变桨故障",
-        },
-        {
-          id: 2,
-          value: "PH",
-          label: "偏航故障",
-        },
-        {
-          id: 3,
-          value: "FDJ",
-          label: "发电机故障",
-        },
-        {
-          id: 4,
-          value: "CLX",
-          label: "齿轮箱故障",
-        },
-        {
-          id: 5,
-          value: "YY",
-          label: "液压故障",
-        },
-        {
-          id: 6,
-          value: "ZZ",
-          label: "主轴故障",
-        },
-        {
-          id: 7,
-          value: "ZK",
-          label: "主控故障",
-        },
-        {
-          id: 8,
-          value: "BPQ",
-          label: "变频器故障",
-        },
-      ],
-
       Analysis: [
         {
           title: "",

+ 12 - 12
src/views/MalfunctionWarning/supervised.vue

@@ -196,18 +196,18 @@ export default {
     ChartDetails,
     DetectionRecord,
   },
-  created() {
-    if (this.timeValue.length === 0) {
-      let date = new Date();
-      this.timeValue[0] = date.getTime() - 86400000;
-      this.timeValue[1] = date.getTime();
-    }
-    let select = this.options.filter(
-      (item) => item.value === this.selectValue
-    )[0];
-    this.selectMoudle = select.station[0].lable;
-    this.moudleList = select.station;
-  },
+  // created() {
+  //   if (this.timeValue.length === 0) {
+  //     let date = new Date();
+  //     this.timeValue[0] = date.getTime() - 86400000;
+  //     this.timeValue[1] = date.getTime();
+  //   }
+  //   let select = this.options.filter(
+  //     (item) => item.value === this.selectValue
+  //   )[0];
+  //   this.selectMoudle = select.station[0].lable;
+  //   this.moudleList = select.station;
+  // },
   data() {
     return {
       dataList: [],

+ 18 - 18
src/views/NewPages/multiple-y-line-chart-normal.vue

@@ -458,24 +458,24 @@ export default {
             data: this.xdata,
           },
         ],
-        // yAxis: {
-        //   type: "value",
-        //   axisLabel: {
-        //     formatter: "{value}",
-        //     fontSize: 14,
-        //   },
-        //   axisLine: {
-        //     show: false,
-        //   },
-        //   splitLine: {
-        //     show: true,
-        //     lineStyle: {
-        //       color: "#606769",
-        //       type: "dashed",
-        //     },
-        //   },
-        // },
-        yAxis: this.yAxis,
+        yAxis: {
+          type: "value",
+          axisLabel: {
+            formatter: "{value}",
+            fontSize: 14,
+          },
+          axisLine: {
+            show: false,
+          },
+          splitLine: {
+            show: true,
+            lineStyle: {
+              color: "#606769",
+              type: "dashed",
+            },
+          },
+        },
+        // yAxis: this.yAxis,
         series: this.series,
       };
     },

+ 10 - 0
src/views/layout/Menu.vue

@@ -560,6 +560,11 @@ export default {
                   icon: "svg-wind-site",
                   path: "/health/MalfunctionWarning/Supervised",
                 },
+                {
+                  text: "性能预警综合分析",
+                  icon: "svg-matrix",
+                  path: "/others/analysis",
+                },
               ],
             },
           ],
@@ -986,6 +991,11 @@ export default {
                   icon: "svg-matrix",
                   path: "/others/warning",
                 },
+                {
+                  text: "性能预警综合分析",
+                  icon: "svg-matrix",
+                  path: "/others/analysis",
+                },
                 // {
                 //   text: "风电营销样本库",
                 //   icon: "svg-matrix",

+ 338 - 0
src/views/sampleDatabase/analysis/index.vue

@@ -0,0 +1,338 @@
+<template>
+  <div class="knowledge-2">
+    <div class="query mg-b-8">
+      <div class="query-items">
+        <div class="query-item">
+          <div class="lable">场站:</div>
+          <div class="search-input">
+            <el-select
+              v-model="wpId"
+              clearable
+              placeholder="请选择"
+              popper-class="select"
+            >
+              <el-option
+                v-for="item in wpArray"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+              />
+            </el-select>
+          </div>
+        </div>
+        <div class="query-item">
+          <div class="lable">样本类型:</div>
+          <div class="search-input">
+            <el-select
+              v-model="sampleValue"
+              clearable
+              placeholder="请选择"
+              popper-class="select"
+              style="width: 130px; margin-left: 20px"
+            >
+              <el-option
+                v-for="item in sampleList"
+                :key="item.value"
+                :value="item.value"
+                :label="item.label"
+              />
+            </el-select>
+          </div>
+        </div>
+        <div class="query-item" style="width: 445px">
+          <div class="lable">起止时间:</div>
+          <div class="search-input">
+            <el-date-picker
+              class="picker"
+              @change="changes"
+              v-model="timeValue"
+              type="datetimerange"
+              range-separator="至"
+              start-placeholder="开始日期"
+              end-placeholder="结束日期"
+            >
+            </el-date-picker>
+          </div>
+        </div>
+        <div class="query-item" style="width: 250px">
+          <div class="lable">时间间隔:</div>
+          <div class="search-input">
+            <el-select
+              v-model="interval"
+              collapse-tags
+              placeholder="请选择"
+              popper-class="select"
+            >
+              <el-option
+                v-for="item in intervals"
+                :key="item.value"
+                :value="item.value"
+                :label="item.label"
+              >
+              </el-option>
+            </el-select>
+          </div>
+        </div>
+        <div class="query-actions">
+          <button class="btn" @click="getData()">查询</button>
+        </div>
+      </div>
+    </div>
+
+    <el-row :type="'flex'" class="content">
+      <el-col :span="5">
+        <div class="left">
+          <el-tree
+            class="filter-tree"
+            :data="showData"
+            :props="defaultProps"
+            :filter-node-method="filterNode"
+            node-key="id"
+            :default-expanded-keys="[0]"
+            :default-checked-keys="[ids]"
+            ref="tree"
+            highlight-current
+            @node-click="handleChange"
+          >
+          </el-tree>
+        </div>
+      </el-col>
+      <el-col :span="19">
+        <el-row>
+          <el-col :span="15">
+            <div class="charts">
+              <div class="titles">性能分析图</div>
+              <PerformanceEcharts id="chartsData" :showTime="true" :data="scatterLineData" width="100%" height="70vh"></PerformanceEcharts>
+            </div>
+          </el-col>
+          <el-col :span="9">
+            <div class="charts" v-if="warningTimeList.length > 0">
+              <div class="titles">预警饼状图</div>
+              <PieCharts id="pie" width="90%" height="70vh" :warningTimeList="warningTimeList"></PieCharts>
+            </div>
+          </el-col>
+        </el-row>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+<script>
+import PerformanceEcharts from "../performance/performanceEcharts.vue";
+import PieCharts from "./pieCharts.vue";
+import BASE from "@tools/basicTool.js";
+export default {
+  components: {
+    PerformanceEcharts,
+    PieCharts,
+  },
+  created() {
+    if (this.timeValue.length === 0) {
+      let date = new Date();
+      this.timeValue[0] = 1622476800000;
+      this.timeValue[1] = 1630252800000;
+    }
+    this.getData();
+    this.getWp();
+  },
+  data() {
+    return {
+      timeValue: [],
+      ids:'',
+      wpId: "NSS_FDC",
+      wpArray: [],
+      sampleValue: "0",
+      sampleList: [
+        {
+          label: "正样本",
+          value: "0",
+        },
+        {
+          label: "负样本",
+          value: "1",
+        },
+      ],
+      interval: "5-1008",
+      intervals: [
+        {
+          label: "小于30分钟",
+          value: "0-0.5",
+        },
+        {
+          label: "30分钟-1小时",
+          value: "0.5-1",
+        },
+        {
+          label: "1小时-2小时",
+          value: "1-2",
+        },
+        {
+          label: "2小时-5小时",
+          value: "2-5",
+        },
+        {
+          //42天
+          label: "大于5小时",
+          value: "5-1008",
+        },
+      ],
+
+      defaultProps: {
+        children: "children",
+        label: "windturbineId",
+      },
+      showData: [],
+      warningTimeList: [],
+      scatterLineData:{},
+      warningList: [
+        {
+          label: "变桨系统",
+          value: "BJXT",
+        },
+        {
+          label: "测风系统",
+          value: "CFXT",
+        },
+        {
+          label: "发电机",
+          value: "FDJ",
+        },
+        {
+          label: "传动链",
+          value: "CDL",
+        },
+        {
+          label: "齿轮箱",
+          value: "CLX",
+        },
+        {
+          label: "机舱",
+          value: "JC",
+        },
+        {
+          label: "液压系统",
+          value: "YYXT",
+        },
+        {
+          label: "偏航系统",
+          value: "PHXT",
+        },
+        {
+          label: "塔底柜",
+          value: "TDG",
+        },
+      ],
+    };
+  },
+  methods: {
+    // 获取风场
+    getWp() {
+      let that = this;
+      that.API.requestData({
+        baseURL: "http://10.155.32.4:8082/",
+        subUrl: "powercompare/windfarmAjax",
+        success(res) {
+          that.wpArray = res.data;
+          that.wpId = res.data[1].id;
+        },
+      });
+    },
+    getData() {
+      let that = this;
+      this.API.requestData({
+        method: "GET",
+        subUrl: "http://192.168.1.18:9002/analyse/basic",
+        data: {
+          station: this.wpId,
+          intervals: this.interval,
+          tag: this.sampleValue,
+          st: new Date(this.timeValue[0]).formatDate("yyyy-MM-dd hh:mm:ss"),
+          et: new Date(this.timeValue[1]).formatDate("yyyy-MM-dd hh:mm:ss"),
+        },
+        success(res) {
+          if (res) {
+            that.ids = res.data[0].children[0].id
+            that.showData = res.data;
+            that.handleChange(res.data[0].children[0])
+          }
+        },
+      });
+    },
+    async handleChange(val) {
+      if (val.st) {
+        BASE.showLoading({ text: "加载中..." });
+        let warningList = [];
+        let that = this;
+        await this.API.requestData({
+          method: "GET",
+          subUrl: "http://192.168.10.18:8075/alarm/history/page",
+          data: {
+            pagenum: 1,
+            pagesize: 20000,
+            starttime: val.st,
+            endtime: val.et,
+            stationid: this.wpId,
+            windturbineid: val.wtId,
+          },
+          success(res) {
+            if (res.records) {
+              res.records.forEach((item) => {
+                if (
+                  warningList.filter((val) => val.label === item.category3)
+                    .length > 0
+                ) {
+                  warningList.filter((val) => val.label === item.category3)[0]
+                    .num++;
+                } else {
+                  let obj = {
+                    label: item.category3,
+                    name: that.warningList.filter(
+                      (val) => val.value === item.category3
+                    )[0].label,
+                    num: 1,
+                  };
+                  warningList.push(obj);
+                }
+              });
+
+              that.warningTimeList = warningList;
+            }
+          },
+        });
+        
+        await that.API.requestData({
+        method: "GET",
+        baseURL: "http://192.168.1.18:9002/",
+        // baseURL: "http://192.168.10.4:9002/",
+        subUrl: "case/performance/line",
+        data: {
+          id: val.id,
+          interval: 30,
+        },
+        success(res) {
+          if (res.code == 200) {
+            that.scatterLineData = res.data;
+            BASE.closeLoading();
+          }
+        },
+      });
+      }
+    },
+  },
+};
+</script>
+<style lang="less" scoped>
+.charts {
+  display: flex;
+  flex-direction: column;
+  justify-content: center;
+}
+.titles{
+  font-size: 16px;
+  margin: 20px 0 40px 10px;
+}
+body .el-tree {
+  height: 85vh;
+  padding-left: 30px;
+  overflow-y: auto;
+}
+</style>

+ 141 - 0
src/views/sampleDatabase/analysis/pieCharts.vue

@@ -0,0 +1,141 @@
+<template>
+  <div class="precisionEcharts" :style="style" :id="id"></div>
+</template>
+<script>
+import * as echarts from "echarts";
+export default {
+  props: {
+    warningTimeList: {
+      type: Array,
+    },
+    id: Object,
+    width: {
+      type: String,
+      default: "600px",
+    },
+    height: {
+      type: String,
+      default: "250px",
+    },
+  },
+  data() {
+    return {
+      xindex: [],
+    };
+  },
+  computed: {
+    style() {
+      return `width: ${this.width}; height: ${this.height};`;
+    },
+  },
+  mounted() {
+    this.deal();
+    this.$nextTick(() => {
+      this.initChart();
+    });
+  },
+  updated() {
+    this.$nextTick(() => {
+      this.initChart();
+    });
+  },
+  methods: {
+    deal() {
+      for (let index = 0; index < 35; index++) {
+        this.xindex.push(index);
+      }
+    },
+    initChart() {
+      let seriesData = [];
+      this.warningTimeList.forEach((item) => {
+        let obj = {
+          value: item.num,
+          name: item.name,
+        };
+        seriesData.push(obj);
+      });
+      let chartDom = document.getElementById(this.id);
+      let myChart = echarts.init(chartDom);
+      let option = {
+        title: {
+          text: "",
+        },
+        tooltip: {
+          trigger: "item",
+        },
+        legend: {
+          top: "5%",
+          left: "center",
+          textStyle: {
+            color: "#ffffff",
+            fontSize: 14,
+          },
+        },
+        series: [
+          {
+            name: "报警次数",
+            type: "pie",
+            radius: ["30%", "60%"],
+            avoidLabelOverlap: false,
+            itemStyle: {
+              borderRadius: 10,
+              borderColor: "#000",
+              borderWidth: 2,
+            },
+            label: {
+              show: true,
+              normal: {
+                show: true,
+                textStyle: {
+                  fontSize: "20",
+                  color: "#ffffff",
+                },
+              },
+              emphasis: {
+                show: true,
+                textStyle: {
+                  fontSize: "25",
+                  color: "#ffffff",
+                },
+              },
+            },
+            emphasis: {
+              label: {
+                show: true,
+                fontSize: "40",
+                fontWeight: "bold",
+              },
+            },
+            labelLine: {
+              show: true,
+            },
+            data: seriesData,
+          },
+        ],
+      };
+      option && myChart.setOption(option);
+    },
+    Compare(property) {
+      return function (a, b) {
+        var value1 = a[property];
+        var value2 = b[property];
+        return value1 - value2;
+      };
+    },
+  },
+  watch: {
+    warningTimeList: {
+      handler(newValue, oldValue) {
+        this.initChart();
+      },
+      deep: true,
+    },
+  },
+};
+</script>
+<style lang="less" scoped>
+// .precisionEcharts {
+//   width: 600px;
+//   height: 250px;
+// }
+</style>

+ 9 - 7
src/views/sampleDatabase/performance/index.vue

@@ -173,7 +173,7 @@ export default {
         },
       ],
       // 时间间隔
-      interval: "1-2",
+      interval: "5-1008",
       intervals: [
         //和明华有约定,必须这么写
         {
@@ -253,10 +253,12 @@ export default {
     async startAjax() {
       var that = this;
       that.time = [
-        new Date(new Date() - 3600 * 24 * 1000 * 15).formatDate(
-          "yyyy-MM-dd hh:mm:ss"
-        ),
-        new Date().formatDate("yyyy-MM-dd hh:mm:ss"),
+        // new Date(new Date() - 3600 * 24 * 1000 * 15).formatDate(
+        //   "yyyy-MM-dd hh:mm:ss"
+        // ),
+        // new Date().formatDate("yyyy-MM-dd hh:mm:ss"),
+        new Date(1622476800000).formatDate("yyyy-MM-dd hh:mm:ss"),
+        new Date(1630252800000).formatDate("yyyy-MM-dd hh:mm:ss")
       ];
       await that.API.requestData({
         method: "GET",
@@ -282,7 +284,7 @@ export default {
       that.API.requestData({
         method: "GET",
         // baseURL: "http://192.168.10.19:9002/",
-        baseURL: "http://192.168.10.4:9002/",
+        baseURL: "http://192.168.1.18:9002/",
         subUrl: "case/performance/line",
         data: {
           id: ids,
@@ -320,7 +322,7 @@ export default {
       that.API.requestData({
         showLoading: true,
         method: "GET",
-        baseURL: "http://192.168.10.4:9002/",
+        baseURL: "http://192.168.1.18:9002/",
         //    baseURL: "http://192.168.10.19:9002/",
         subUrl: "case/performance/list",
         data: {

+ 21 - 9
src/views/sampleDatabase/performance/performanceEcharts.vue

@@ -20,6 +20,10 @@ export default {
       type: String,
       default: "350px",
     },
+    showTime: {
+      type: Boolean,
+      default: false,
+    },
     // 传入数据
     data: {
       type: Array,
@@ -65,7 +69,7 @@ export default {
       let option = {
         legend: {
           show: true,
-          data: ["实发功率","理论功率", "实时风速"],
+          data: ["实发功率", "理论功率", "实时风速"],
           right: 120,
           icon: "ract",
           itemWidth: 8,
@@ -159,7 +163,7 @@ export default {
         ],
         series: [],
       };
-      if (this.data.power.length > 0) {
+      if (this.data?.power?.length > 0) {
         let arr = [];
         this.data.power.forEach((item) => {
           arr.push(item.doubleValue);
@@ -174,7 +178,7 @@ export default {
 
         option.series.push(obj);
       }
-      if (this.data.llglpower.length > 0) {
+      if (this.data?.llglpower?.length > 0) {
         let arr = [];
         this.data.llglpower.forEach((item) => {
           arr.push(item.doubleValue);
@@ -189,7 +193,7 @@ export default {
 
         option.series.push(obj);
       }
-      if (this.data.speed.length > 0) {
+      if (this.data?.speed?.length > 0) {
         let arr = [];
         this.data.speed.forEach((item) => {
           arr.push(item.doubleValue);
@@ -225,11 +229,19 @@ export default {
   },
   updated() {
     let data = [];
-    if (this.data?.power.length > 0 || this.data?.speed.length > 0)
-      this.data?.power.forEach((value, index) => {
-        data.push(new Date(value.ts).formatDate("yyyy-MM-dd hh:mm"));
-      });
-    this.xdata = data;
+    if (this.data?.power.length > 0 || this.data?.speed.length > 0) {
+      if (this.showTime) {
+        this.data?.power.forEach((value, index) => {
+          data.push(new Date(value.ts).formatDate("MM-dd hh:mm"));
+        });
+      } else {
+        this.data?.power.forEach((value, index) => {
+          data.push(new Date(value.ts).formatDate("yyyy-MM-dd hh:mm"));
+        });
+      }
+
+      this.xdata = data;
+    }
     this.$nextTick(() => {
       this.initChart();
     });