Browse Source

控制统计模块新增

Koishi 1 year atrás
parent
commit
691fd91295
2 changed files with 133 additions and 13 deletions
  1. 10 2
      src/api/index.js
  2. 123 11
      src/components/search/action.vue

+ 10 - 2
src/api/index.js

@@ -428,7 +428,6 @@ const getAlarmSnap = (data) => {
     });
 };
 
-//刷新报警信息
 const getEvaluationData = (id) => {
     return request({
         baseURL: process.env.VUE_APP_API,
@@ -436,6 +435,14 @@ const getEvaluationData = (id) => {
         method: "get",
     });
 };
+
+const getControlStatistics = (startTs, endTs) => {
+    return request({
+        baseURL: process.env.VUE_APP_API,
+        url: `/control-record/control-statistics?startTs=${startTs}&endTs=${endTs}`,
+        method: "get",
+    });
+}
 export default {
     login,
     getStation,
@@ -491,5 +498,6 @@ export default {
     statusChange,
     returnSetting,
     getAlarmSnap,
-    getEvaluationData
+    getEvaluationData,
+    getControlStatistics
 };

+ 123 - 11
src/components/search/action.vue

@@ -45,7 +45,17 @@
               end-placeholder="结束日期"
             >
             </el-date-picker>
-            <div class="buttons" @click="getControlRecord()">查询</div>
+            <div
+              class="buttons"
+              @click="
+                () => {
+                  getControlRecord();
+                  getControlStatistics();
+                }
+              "
+            >
+              查询
+            </div>
           </div>
           <el-scrollbar style="height: 94%">
             <div class="tables">
@@ -102,6 +112,57 @@
                 >
                 </el-table-column>
               </el-table>
+              <div class="titleinfoall" v-if="showControlStatistics">
+                <div class="titleinfo">
+                  <span class="showTitle fontSty1">启动次数:</span>
+                  <span class="showvalue">
+                    {{ controlStatisticsInfo.startCount }}
+                  </span>
+                  <span class="showTitle fontSty">次</span>
+                </div>
+                <div class="titleinfo">
+                  <span class="showTitle fontSty1">停机次数:</span>
+                  <span class="showvalue">
+                    {{ controlStatisticsInfo.stopCount }}
+                  </span>
+                  <span class="showTitle fontSty">次</span>
+                </div>
+                <div class="titleinfo">
+                  <span class="showTitle fontSty1">维护次数:</span>
+                  <span class="showvalue">
+                    {{ controlStatisticsInfo.maintenanceCount }}
+                  </span>
+                  <span class="showTitle fontSty">次</span>
+                </div>
+                <div class="titleinfo">
+                  <span class="showTitle fontSty1">解除维护次数:</span>
+                  <span class="showvalue">
+                    {{ controlStatisticsInfo.unMaintenanceCount }}
+                  </span>
+                  <span class="showTitle fontSty">次</span>
+                </div>
+                <div class="titleinfo">
+                  <span class="showTitle fontSty1">提前时间:</span>
+                  <span class="showvalue">
+                    {{ controlStatisticsInfo.advanceTime?.toFixed(2) || 0 }}
+                  </span>
+                  <span class="showTitle fontSty">小时</span>
+                </div>
+                <div class="titleinfo">
+                  <span class="showTitle fontSty1">多发电量:</span>
+                  <span class="showvalue">
+                    {{ controlStatisticsInfo.powerGeneration?.toFixed(2) || 0 }}
+                  </span>
+                  <span class="showTitle fontSty">kw</span>
+                </div>
+                <div class="titleinfo">
+                  <span class="showTitle fontSty1">节约电量:</span>
+                  <span class="showvalue">
+                    {{ controlStatisticsInfo.powerSaving?.toFixed(2) || 0 }}
+                  </span>
+                  <span class="showTitle fontSty">kw</span>
+                </div>
+              </div>
             </div>
           </el-scrollbar>
           <div class="paginations">
@@ -112,8 +173,7 @@
               layout="prev, pager, next"
               :total="total"
               @current-change="handleCurrentChange"
-            >
-            </el-pagination>
+            />
           </div>
         </div>
       </div>
@@ -248,6 +308,8 @@ export default {
       otherContentInfo: {
         score: 0,
       },
+      showControlStatistics: false,
+      controlStatisticsInfo: {},
     };
   },
   methods: {
@@ -331,6 +393,30 @@ export default {
       this.dataDeal();
       this.getControlRecord();
     },
+
+    getControlStatistics() {
+      this.showControlStatistics = false;
+      this.controlStatisticsInfo = {};
+      const stTs = this.timeValue[0];
+      const endTs = this.timeValue[1];
+      api
+        .getControlStatistics(
+          new Date(stTs).getTime(),
+          new Date(endTs).getTime()
+        )
+        .then((res) => {
+          this.showControlStatistics = true;
+          this.controlStatisticsInfo = {
+            advanceTime: res.data.advanceTime,
+            maintenanceCount: res.data.maintenanceCount,
+            powerGeneration: res.data.powerGeneration,
+            powerSaving: res.data.powerSaving,
+            startCount: res.data.startCount,
+            stopCount: res.data.stopCount,
+            unMaintenanceCount: res.data.unMaintenanceCount,
+          };
+        });
+    },
     getControlRecord() {
       api
         .controlRecord({
@@ -450,11 +536,11 @@ export default {
                   color: "#eee",
                 },
               },
-              splitLine:{
-                lineStyle:{
-                  color:['#878787']
-                }
-              }
+              splitLine: {
+                lineStyle: {
+                  color: ["#878787"],
+                },
+              },
             },
             {
               type: "value",
@@ -467,9 +553,9 @@ export default {
                   color: "#eee",
                 },
               },
-              splitLine:{
-                show:false
-              }
+              splitLine: {
+                show: false,
+              },
             },
           ],
           dataZoom: [
@@ -624,6 +710,7 @@ export default {
   margin-top: 20px;
   width: 95%;
   margin-left: 3%;
+  position: relative;
 }
 
 .table {
@@ -668,6 +755,31 @@ tr {
   display: flex;
   flex-direction: row-reverse;
 }
+
+.titleinfoall {
+  display: flex;
+  position: absolute;
+  left: 10px;
+  bottom: 10px;
+}
+
+.showTitle {
+  color: #ffffff;
+  margin-right: 10px;
+}
+.fontSty {
+  font-size: 12px;
+}
+.fontSty1 {
+  font-weight: bold;
+}
+
+.showvalue {
+  color: #ffffff;
+  font-size: 14px;
+  font-weight: bold;
+  margin-right: 10px;
+}
 </style>
 
 <style lang="less">