Browse Source

健康管理单机明细模块完成、风资源模块修改

yangxiao 3 years ago
parent
commit
9a2dd46d62

File diff suppressed because it is too large
+ 619 - 621
src/router/index.js


+ 229 - 252
src/views/HealthControl/Health10.vue

@@ -3,19 +3,19 @@
     <el-row :gutter="20" class="table-panel">
       <el-col :span="6">
         <panel :title="'等级评价'" :showLine="false">
-          <Table :data="tableData1" :canScroll="false" />
+          <Table :data="top5Table" :canScroll="false" />
         </panel>
       </el-col>
       <el-col :span="6">
         <panel :title="'健康报告'" :showLine="false">
-          <Table :data="tableData2" :canScroll="false" />
+          <Table :data="dateTable" :canScroll="false" />
         </panel>
       </el-col>
       <el-col :span="12" class="wrong-list">
         <panel :title="'故障信息'" :showLine="false">
           <div class="data-list" style="display:flex;">
-            <Table :data="tableData3" :canScroll="false" />
-            <Table :data="tableData4" :canScroll="false" />
+            <Table :data="top10TableLeft" :canScroll="false" />
+            <Table :data="top10TableRight" :canScroll="false" />
           </div>
         </panel>
       </el-col>
@@ -43,27 +43,28 @@
               <div style="height:calc(100vh - 174px);">
                 <table style="width:100%;" border="0" cellspacing="0">
                   <tbody>
-                    <tr v-for="index of 8" :key="index">
+                    <tr v-for="(item, index) of partsArray" :key="index">
                       <td style="width:50px;">
-                        发电机
+                        {{item[1]}}
                       </td>
                       <td style="width:105px;">
-                        <div style="background-color: #00bf4d;width:10px;height:10px;margin:0 auto;"></div>
+                        <div :style="'background-color: ' + item[0] + ';width:10px;height:10px;margin:0 auto;'"></div>
                       </td>
                       <td style="width:400px;">
                         <div class="percent-item">
-                          85%
+                          {{item[3]}}%
                           <div class="percent-bar" style="margin-right: 4px;">
-                            <div class="percent-value" style="width:80%"></div>
+                            <div class="percent-value" :style="'width:' + item[3] +'%'"></div>
                           </div>
-                          剩余9999/建个故障9999
+                          <!-- 剩余9999/建个故障9999 -->
+                          {{item[4]}}
                         </div>
                       </td>
                       <td style="width:200px;">
-                        <table-line-chart :height="'20px'" />
+                        <table-line-chart :height="'20px'" :list="item[8]" />
                       </td>
                       <td style="width:#00bf4d">
-                        29.33
+                        {{item[6]}}
                       </td>
                     </tr>
                   </tbody>
@@ -80,12 +81,13 @@
             <span class="des-title">预计损失电量<span class="num">73824.0</span><span class="unit">Kwh</span></span>
             <span class="des-title">预计检修时长<span class="num">29.33</span><span class="unit">H</span></span>
           </div>
-          <img-line-chart height="270px" :list="line.value" :units="line.units" /></div
-      ></el-col>
+          <img-line-chart height="270px" :list="line.value" :units="line.units" />
+        </div>
+      </el-col>
     </el-row>
     <div class="fc-info mg-b-16">
       <panel :title="'曲线'" :showLine="false">
-        <zoom-line-chart height="35vh" :list="line1.value" :units="line1.units" />
+        <zoom-line-chart height="35vh" :list="powerChartData.value" :units="powerChartData.units" />
       </panel>
     </div>
   </div>
@@ -102,7 +104,7 @@ import ImgLineChart from "../../components/chart/line/img-line-chart.vue";
 import ZoomLineChart from '../../components/chart/line/zoom-line-chart.vue';
 
 export default {
-  setup() {},
+  setup () { },
   components: {
     Panel,
     Table,
@@ -110,169 +112,107 @@ export default {
     ImgLineChart,
     ZoomLineChart,
   },
-  data() {
+  data () {
+    const that = this;
     return {
-      tableData1: {
+      top5Table: {
         column: [
           {
-            name: " ",
-            field: "name",
+            name: "排名",
+            field: "index",
             width: "10%",
           },
           {
             name: "日期",
-            field: "v1",
+            field: "date",
             width: "45%",
           },
           {
-            name: "登记",
-            field: "v2",
+            name: "等级",
+            field: "rank",
             width: "45%",
           },
         ],
-        data: [
-          {
-            name: "1",
-            v1: "2018-05-31 00:00:00",
-            v2: "C",
-          },
-          {
-            name: "2",
-            v1: "2018-05-31 00:00:00",
-            v2: "C",
-          },
-          {
-            name: "3",
-            v1: "2018-05-31 00:00:00",
-            v2: "C",
-          },
-          {
-            name: "4",
-            v1: "2018-05-31 00:00:00",
-            v2: "C",
-          },
-          {
-            name: "5",
-            v1: "2018-05-31 00:00:00",
-            v2: "C",
-          },
-        ],
+        data: []
       },
-      tableData2: {
+      dateTable: {
         column: [
           {
-            name: " ",
-            field: "name",
+            name: "排名",
+            field: "index",
             width: "10%",
           },
           {
             name: "日期",
-            field: "v1",
-            width: "45%",
+            field: "date",
+            width: "60%",
           },
           {
             name: "健康情况",
-            field: "v2",
-            width: "45%",
-            template: function(data) {
-              return "<div style='display: flex;'><div style='width: 50%;'>" + data + "</div><div style='width: 50%;'><div style='border: 1px solid #182238;background: #303f6e;width: 70%;margin: 0 auto;color:#FFF'>查看报告</div></div></div>";
+            field: "",
+            width: "30%",
+            template () {
+              return "<div style='border: 1px solid #182238;background: #303f6e;width: 70%;margin: 0 auto;color:#FFF;cursor: pointer;'>查看报告</div>";
             },
           },
         ],
-        data: [
-          {
-            name: "1",
-            v1: "2018-05-31 00:00:00",
-            v2: "差",
-          },
-          {
-            name: "2",
-            v1: "2018-05-31 00:00:00",
-            v2: "差",
-          },
-          {
-            name: "3",
-            v1: "2018-05-31 00:00:00",
-            v2: "差",
-          },
-          {
-            name: "4",
-            v1: "2018-05-31 00:00:00",
-            v2: "差",
-          },
-          {
-            name: "5",
-            v1: "2018-05-31 00:00:00",
-            v2: "差",
-          },
-        ],
+        data: []
       },
-      tableData3: {
+      top10TableLeft: {
         column: [
           {
-            name: "",
-            field: "name",
+            name: "排名",
+            field: "index",
             width: "8%",
           },
           {
             name: "故障名称",
-            field: "v1",
-            template: function(data) {
-              return "<div style='overflow: hidden;text-overflow:ellipsis;white-space: nowrap;'>" + data + "</div>";
-            },
+            field: "warnDesc"
           },
           {
             name: "故障时间",
-            field: "v2",
+            field: "startTime",
             width: "35%",
           },
           {
             name: "修复时间",
-            field: "v3",
+            field: "stopTime",
           },
           {
             name: "时长",
-            field: "v4",
+            field: "stopHours",
           },
         ],
-        data: [
+        data: [],
+      },
+      top10TableRight: {
+        column: [
           {
-            name: "1",
-            v1: "风机叶轮刹车系统",
-            v2: "2018-05-31 16:28:38",
-            v3: "2018-05-31",
-            v4: "0.09",
+            name: "排名",
+            field: "index",
+            width: "8%",
           },
           {
-            name: "2",
-            v1: "风机叶轮刹车系统",
-            v2: "2018-05-31 16:28:38",
-            v3: "2018-05-31",
-            v4: "0.09",
+            name: "故障名称",
+            field: "warnDesc"
           },
           {
-            name: "3",
-            v1: "风机叶轮刹车系统",
-            v2: "2018-05-31 16:28:38",
-            v3: "2018-05-31",
-            v4: "0.09",
+            name: "故障时间",
+            field: "startTime",
+            width: "35%",
           },
           {
-            name: "4",
-            v1: "风机叶轮刹车系统",
-            v2: "2018-05-31 16:28:38",
-            v3: "2018-05-31",
-            v4: "0.09",
+            name: "修复时间",
+            field: "stopTime",
           },
           {
-            name: "5",
-            v1: "风机叶轮刹车系统",
-            v2: "2018-05-31 16:28:38",
-            v3: "2018-05-31",
-            v4: "0.09",
+            name: "时长",
+            field: "stopHours",
           },
         ],
+        data: [],
       },
+      partsArray: [],
       tableData4: {
         column: [
           {
@@ -283,7 +223,7 @@ export default {
           {
             name: "故障名称",
             field: "v1",
-            template: function(data) {
+            template: function (data) {
               return "<div style='overflow: hidden;text-overflow:ellipsis;white-space: nowrap;'>" + data + "</div>";
             },
           },
@@ -445,134 +385,13 @@ export default {
           },
         ],
       },
-      line1: {
-        units: ["功率", "风速"],
-        value: [
-          {
-            title: "应发功率",
-            yAxisIndex: 0,
-            value: [
-              {
-                text: "05-02 00:00",
-                value: 1,
-              },
-              {
-                text: "05-04 00:00",
-                value: 13,
-              },
-              {
-                text: "05-06 00:00",
-                value: 14,
-              },
-              {
-                text: "05-08 00:00",
-                value: 12,
-              },
-              {
-                text: "05-10 00:00",
-                value: 3,
-              },
-              {
-                text: "05-12 00:00",
-                value: 5,
-              },
-              {
-                text: "05-14 00:00",
-                value: 1,
-              },
-              {
-                text: "05-16 00:00",
-                value: 1,
-              },
-              {
-                text: "05-18 00:00",
-                value: 13,
-              },
-              {
-                text: "05-20 00:00",
-                value: 14,
-              },
-              {
-                text: "05-22 00:00",
-                value: 12,
-              },
-              {
-                text: "05-24 00:00",
-                value: 3,
-              },
-              {
-                text: "05-26 00:00",
-                value: 5,
-              },
-              {
-                text: "05-28 00:00",
-                value: 1,
-              },
-            ],
-          },
-          {
-            title: "实际功率",
-            yAxisIndex: 0,
-            value: [
-              {
-                text: "05-02 00:00",
-                value: 1,
-              },
-              {
-                text: "05-04 00:00",
-                value: 3,
-              },
-              {
-                text: "05-06 00:00",
-                value: 4,
-              },
-              {
-                text: "05-08 00:00",
-                value: 1,
-              },
-              {
-                text: "05-10 00:00",
-                value: 13,
-              },
-              {
-                text: "05-12 00:00",
-                value: 15,
-              },
-              {
-                text: "05-14 00:00",
-                value: 11,
-              },
-              {
-                text: "05-16 00:00",
-                value: 5,
-              },
-              {
-                text: "05-18 00:00",
-                value: 4,
-              },
-              {
-                text: "05-20 00:00",
-                value: 1,
-              },
-              {
-                text: "05-22 00:00",
-                value: 3,
-              },
-              {
-                text: "05-24 00:00",
-                value: 3,
-              },
-              {
-                text: "05-26 00:00",
-                value: 1,
-              },
-              {
-                text: "05-28 00:00",
-                value: 13,
-              },
-            ],
-          },
-        ],
+      powerChartData: {
+        units: [""],
+        value: [{
+          title: "",
+          yAxisIndex: 0,
+          value: []
+        }],
       },
       line2: {
         units: ["功率", "风速"],
@@ -643,7 +462,165 @@ export default {
       },
     };
   },
-  created() {},
+
+  created () {
+    this.wtId = this.$route.params.wtId;
+    this.getTop5();
+    this.renderDateTable();
+    this.getTop10();
+    this.getMtbfByBj();
+    this.getFindPowerChar();
+  },
+
+  methods: {
+    // 获取等级评价
+    getTop5 () {
+      let that = this;
+      that.API.requestData({
+        method: "POST",
+        subUrl: "healthsub/gadaytop5",
+        data: {
+          wtId: that.wtId
+        },
+        success (res) {
+          let top5TableData = [];
+          let index = 1;
+          for (let key in res.data) {
+            let ele = res.data[key];
+            top5TableData.push({
+              index,
+              date: ele[1],
+              rank: ele[2],
+              wpId: ele[3],
+              wtId: ele[4]
+            });
+            index++;
+          }
+          that.top5Table.data = top5TableData;
+        }
+      });
+    },
+
+    // 渲染健康报告表格
+    renderDateTable (day = 5) {
+      let tableData = [];
+      for (let i = 0; i < day; i++) {
+        tableData.push({
+          index: (i + 1),
+          date: new Date((new Date().getTime() - 3600 * 1000 * 24 * (i + 1))).formatDate("yyyy-MM-dd hh:mm:ss"),
+          wtId: this.wtId
+        });
+      }
+      this.dateTable.data = tableData;
+    },
+
+    // 获取等级评价
+    getTop10 () {
+      let that = this;
+      that.API.requestData({
+        method: "POST",
+        subUrl: "healthsub/queryStopTop10",
+        data: {
+          wtId: that.wtId
+        },
+        success (res) {
+          let leftData = [];
+          let rightData = [];
+
+          res.data.forEach((ele, index) => {
+            const item = {
+              index: (index + 1),
+              warnDesc: ele.warnDesc,
+              startTime: new Date(ele.startTime).formatDate("yyyy-MM-dd hh:mm:ss"),
+              stopTime: new Date(ele.stopTime).formatDate("yyyy-MM-dd hh:mm:ss"),
+              stopHours: ele.stopHours
+            };
+            if (index < 5) {
+              leftData.push(item);
+            } else {
+              rightData.push(item);
+            }
+          });
+
+          that.top10TableLeft.data = leftData;
+          that.top10TableRight.data = rightData;
+        }
+      });
+    },
+
+    // 获取八大部件
+    getMtbfByBj () {
+      let that = this;
+      that.API.requestData({
+        method: "POST",
+        subUrl: "healthsub/getWtMttrandMtbfByBj",
+        data: {
+          wtId: that.wtId
+        },
+        success (res) {
+          let partsArray = [];
+          for (let key in res.data) {
+            let linChartData = [];
+            res.data[key][2].split(",").forEach((ele, index) => {
+              linChartData.push({
+                text: (index + 1),
+                value: ele,
+              });
+            });
+            res.data[key].push(linChartData);
+            partsArray.push(res.data[key])
+          }
+          that.partsArray = partsArray;
+        }
+      });
+    },
+
+    // 获取发电曲线
+    getFindPowerChar () {
+      let that = this;
+      that.API.requestData({
+        method: "POST",
+        subUrl: "healthsub/findPowerChar",
+        timeout: 300000,
+        data: {
+          wtId: that.wtId
+        },
+        success (res) {
+          let chartUnits = ["(WM)", "(m/s)"];
+          let chartData = [{
+            title: "理论功率",
+            yAxisIndex: 0,
+            value: []
+          }, {
+            title: "实际功率",
+            yAxisIndex: 0,
+            value: []
+          }, {
+            title: "实时风速",
+            yAxisIndex: 1,
+            value: []
+          }];
+
+          res.data.timearr.forEach((time, index) => {
+            chartData[0].value.push({
+              text: new Date(time).formatDate("MM-dd hh:mm"),
+              value: res.data.llgl[index]
+            });
+            chartData[1].value.push({
+              text: new Date(time).formatDate("MM-dd hh:mm"),
+              value: res.data.sjgl[index]
+            });
+            chartData[2].value.push({
+              text: new Date(time).formatDate("MM-dd hh:mm"),
+              value: res.data.ssfs[index]
+            });
+          });
+          that.powerChartData.value = chartData;
+          that.powerChartData.units = chartUnits;
+        }
+      });
+    },
+  }
 };
 </script>
 

+ 1 - 5
src/views/NewPages/dj1.vue

@@ -1006,13 +1006,9 @@ export default {
           recorddate: that.recorddate
         },
         success (res) {
-          const keyArray = ["value1", "value2", "value3", "value4"];
+          const keyArray = ["value2", "value3", "value4"];
 
           let powerLineChartData = [{
-            title: "风速",
-            yAxisIndex: 1,
-            value: []
-          }, {
             title: "实际拟合功率",
             yAxisIndex: 0,
             value: []

+ 1 - 1
src/views/windAnalysis/tab1.vue

@@ -22,7 +22,7 @@
         <button class="btn green" @click="search">搜索</button>
       </div>
     </div>
-    <NormalScatterChart height="650px" :data="chartData" :showLegend="true" />
+    <NormalScatterChart height="650px" :data="chartData" xTitle="风速" yTitle="功率" :showLegend="true" />
   </div>
 </template>
 

+ 2 - 2
src/views/windAnalysis/tab2.vue

@@ -31,7 +31,7 @@
         <button class="btn green" @click="search">搜索</button>
       </div>
     </div>
-    <NormalScatterChart height="650px" :data="chartData" :showLegend="true" />
+    <NormalScatterChart height="650px" :data="chartData" xTitle="风速" yTitle="功率" :showLegend="true" />
   </div>
 </template>
 
@@ -103,7 +103,7 @@ export default {
         method: "POST",
         subUrl: "scatter/scatterAjax",
         data: {
-          wpId: that.wpId,
+          wpId: "",
           pjId: that.projectId,
           lnId: "",
           year: (that.recorddate ? new Date(that.recorddate).getFullYear() : ""),

+ 2 - 2
src/views/windAnalysis/tab3.vue

@@ -31,7 +31,7 @@
         <button class="btn green" @click="search">搜索</button>
       </div>
     </div>
-    <NormalScatterChart height="650px" :data="chartData" :showLegend="true" />
+    <NormalScatterChart height="650px" :data="chartData" xTitle="风速" yTitle="功率" :showLegend="true" />
   </div>
 </template>
 
@@ -103,7 +103,7 @@ export default {
         method: "POST",
         subUrl: "scatter/scatterAjax",
         data: {
-          wpId: that.wpId,
+          wpId: "",
           pjId: "",
           lnId: that.lineId,
           year: (that.recorddate ? new Date(that.recorddate).getFullYear() : ""),