Procházet zdrojové kódy

逆变器单机页面

wsy před 3 roky
rodič
revize
7c81ca6b5f
1 změnil soubory, kde provedl 65 přidání a 42 odebrání
  1. 65 42
      src/views/WindSite/pages/Inverter-Info.vue

+ 65 - 42
src/views/WindSite/pages/Inverter-Info.vue

@@ -69,10 +69,10 @@
                 <div class="state-list">
                   <el-scrollbar>
                     <div class="list-body">
-                      <div v-for="index of 100" :key="index" class="list-item">
-                        <div class="text">主流功率</div>
+                      <div v-for="item of diAll" :key="item" class="list-item">
+                        <div class="text">{{item.name}}</div>
                         <div class="state">
-                          <div :class="{ red: index % 2 == 1, green: index % 2 != 1 }"></div>
+                          <div :class="{ red: item.value == 1, green: item.value != 1 }"></div>
                         </div>
                       </div>
                     </div>
@@ -88,9 +88,8 @@
 </template>
 
 <script>
-import BtnGroup2 from "@com/coms/btn/btn-group-double.vue";
+// import BtnGroup2 from "@com/coms/btn/btn-group-double.vue";
 import List from "@com/coms/list/list.vue";
-import util from "@/helper/util.js";
 import Panel from "../../../components/coms/panel/panel.vue";
 import MultipleLineChart from "../../../components/chart/line/multiple-line-chart.vue";
 import collapseList from "@/components/coms/collapse/collapse-list.vue";
@@ -99,7 +98,7 @@ export default {
   name: "Box",
   // 使用组件
   components: {
-    BtnGroup2,
+    // BtnGroup2,
     List,
     Panel,
     MultipleLineChart,
@@ -109,6 +108,8 @@ export default {
   data() {
     return {
       WindSites: [],
+      diAll: [],
+      diOn: [],
       list: {
         title: "逆变器列表",
         datas: [
@@ -122,45 +123,15 @@ export default {
       aiData: [],
       lineValue: [
         {
-          title: "平均风速",
+          title: "功率",
           value: [
             {
-              text: "1日",
+              text: "00:00",
               value: 0
-            },
-            {
-              text: "2日",
-              value: 3
             }
           ]
         }
-      ],
-      option: {
-        xAxis: {
-          type: "category",
-          data: function() {
-            let date = new Date();
-            date.setHours(0);
-            date.setMinutes(0);
-            const result = [];
-            for (let i = 0; i < 24 * 4; i++) {
-              result.push(date.formatDate("yyyy-MM-dd hh:mm:ss"));
-              date.setMinutes(date.getMinutes+15);
-              return result;
-            }
-          }
-        },
-        yAxis: {
-          type: "value"
-        },
-        series: [
-          {
-            data: [820, 932, 901, 934, 1290, 1330, 1320],
-            type: "line",
-            smooth: true
-          }
-        ]
-      }
+      ]
     };
   },
   // 函数
@@ -182,7 +153,7 @@ export default {
     async buildSelectList() {
       let res = await this.API.requestData({
         method: "POST",
-        baseURL: "http://localhost:8082/",
+        // baseURL: "http://localhost:8082/",
         subUrl: "matrix/findPVSimpleMatrixAll"
       });
       let WindSites = [];
@@ -202,7 +173,7 @@ export default {
     async getData() {
       let res = await this.API.requestData({
         method: "POST",
-        baseURL: "http://localhost:8082/",
+        // baseURL: "http://localhost:8082/",
         subUrl: "monitorinverter/findInverterInfo",
         data: {
           wtId: this.wtId
@@ -221,6 +192,48 @@ export default {
         }
       }
       this.aiData = aiData;
+    },
+    async getDIData() {
+      let res = await this.API.requestData({
+        method: "POST",
+        // baseURL: "http://localhost:8082/",
+        subUrl: "monitorinverter/findInverterDI",
+        data: {
+          wtId: this.wtId
+        }
+      });
+      if (res.data.data) {
+        this.diAll = res.data.data.allList;
+        this.diOn = res.data.data.onList;
+      }
+    },
+    async getLineChart() {
+      let res = await this.API.requestData({
+        method: "POST",
+        // baseURL: "http://localhost:8082/",
+        subUrl: "monitorinverter/findInverterPowerLine",
+        data: {
+          wtId: this.wtId
+        }
+      });
+      let date = new Date();
+      date.setHours(0);
+      date.setMinutes(0);
+      let timt = date.getTime();
+      const result = [];
+      for (let i = 0; i <= 48; i++) {
+        date.setMinutes(i * 30);
+        result.push({
+          text: new Date(timt + i * 1000 * 60 * 30).formatDate("hh:mm"),
+          value: res.data.data[i]
+        });
+      }
+      this.lineValue = [
+        {
+          title: "功率",
+          value: result
+        }
+      ];
     }
   },
   // 生命周期钩子
@@ -230,11 +243,16 @@ export default {
   created() {
     this.buildSelectList();
     this.getData();
+    this.getDIData();
+    this.getLineChart();
     let that = this;
     that.timmer = setInterval(() => {
       that.getData();
+      that.getDIData();
     }, 2000);
-    console.log(this.option);
+    that.timmer1 = setInterval(() => {
+      that.getLineChart();
+    }, 60 * 1000);
   },
   beforeMount() {
     // 渲染前
@@ -539,6 +557,11 @@ export default {
             margin-left: 8px;
           }
         }
+        .chart {
+          width: 100%;
+          height: 100%;
+          display: inline-block;
+        }
       }
     }
   }