Переглянути джерело

自定义报警统计--未完

wsy 3 роки тому
батько
коміт
52fa30fb03
2 змінених файлів з 238 додано та 0 видалено
  1. 6 0
      src/router/index.js
  2. 232 0
      src/views/alarmCenter/customStatistics.vue

+ 6 - 0
src/router/index.js

@@ -637,6 +637,12 @@ const routes = [{
         name: "customAlarm",
         component: () => import("../views/alarmCenter/customAlarm.vue")
     },
+    // 报警中心-自定义报警统计
+    {
+        path: "/alarmCenter/customStatistics",
+        name: "customStatistics",
+        component: () => import("../views/alarmCenter/customStatistics.vue")
+    },
 ]
 const router = createRouter({
     history: createWebHashHistory(),

+ 232 - 0
src/views/alarmCenter/customStatistics.vue

@@ -0,0 +1,232 @@
+<template>
+  <div>
+    <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="stationId"
+              clearable
+              placeholder="请选择"
+              popper-class="select"
+              @change="(stationId) => { Windturbines() }"
+            >
+              <el-option
+                v-for="item in ChangZhan"
+                :key="item.id"
+                :value="item.id"
+                :label="item.name"
+              ></el-option>
+            </el-select>
+          </div>
+        </div>
+        <div class="query-item">
+          <div class="lable">开始日期:</div>
+          <div class="search-input">
+            <el-date-picker
+              v-model="startDate"
+              type="date"
+              placeholder="开始日期"
+              popper-class="date-select"
+              value-format="YYYY-MM-DD"
+            ></el-date-picker>
+          </div>
+        </div>
+        <div class="query-item">
+          <div class="lable">结束日期:</div>
+          <div class="search-input">
+            <el-date-picker
+              v-model="endDate"
+              type="date"
+              placeholder="开始日期"
+              popper-class="date-select"
+              value-format="YYYY-MM-DD"
+            ></el-date-picker>
+          </div>
+        </div>
+        <div class="query-actions">
+          <button class="btn green" @click="getTable()">查询</button>
+        </div>
+      </div>
+    </div>
+    <div class="table-box">
+      <div class="title">自定义报警统计</div>
+      <div class="report-items">
+        <div class="title" v-for="item in tableData" :key="item" @click="alertDetail(item)">
+          <div class="alarmName">{{item.alarmtext}}</div>
+          <div class="alarmCount">{{item.sum}}</div>
+        </div>
+      </div>
+    </div>
+    <el-dialog
+      title="自定义报警统计-图表"
+      v-model="dialogShow"
+      width="80%"
+      top="10vh"
+      custom-class="modal dBody"
+      :close-on-click-modal="true"
+    >
+      <div class="dGrid" height="100%">
+        <table class="com-table">
+          <thead>
+            <tr>
+              <th>风机</th>
+              <th>数量</th>
+            </tr>
+          </thead>
+          <el-scrollbar>
+            <tbody>
+              <tr>
+                <td>XG01_28</td>
+                <td>51</td>
+              </tr>
+            </tbody>
+          </el-scrollbar>
+        </table>
+      </div>
+      <div class="dChart" height="100%"></div>
+    </el-dialog>
+  </div>
+</template>
+<script>
+// import ComTable from "@/components/coms/table/table.vue";
+
+export default {
+  name: "customStatistics",
+  components: {},
+  data() {
+    let that = this;
+    return {
+      ChangZhan: [],
+      stationId: "XS_FDC",
+      startDate: "",
+      endDate: "",
+      tableData: [],
+      dialogShow: false
+
+      // tableLoading: true
+    };
+  },
+  created() {
+    this.ChangZhanVal();
+    let end = new Date();
+    let start = new Date(end.getTime() - 1 * 24 * 60 * 60 * 1000);
+    this.endDate = end.formatDate("yyyy-MM-dd");
+    this.startDate = start.formatDate("yyyy-MM-dd");
+    this.getTable();
+  },
+  methods: {
+    // 场站
+    ChangZhanVal() {
+      var that = this;
+      that.API.requestData({
+        method: "GET",
+        baseURL: "http://10.155.32.4:9001/",
+        subUrl: "benchmarking/wplist",
+        success(res) {
+          that.ChangZhan = res.data;
+          that.stationId = res.data[0].id;
+        }
+      });
+    },
+    getTable() {
+      let that = this;
+      this.tableLoading = true;
+      this.API.requestData({
+        timeout: 30000,
+        method: "GET",
+        baseURL: "http://192.168.1.18:8075/",
+        subUrl: "alarm/count/querymap",
+        data: {
+          stationid: this.stationId,
+          datebegin: this.startDate,
+          dateend: this.endDate
+        },
+        success(res) {
+          let tmpArr = [];
+          for (var key in res.data) {
+            let item = res.data[key];
+            item["key"] = key;
+            tmpArr.push(item);
+          }
+          tmpArr.sort(function(a, b) {
+            return b["sum"] - a["sum"];
+          });
+          that.tableData = tmpArr;
+        }
+      });
+    },
+    alertDetail(item) {
+      this.dialogShow = true;
+      this.API.requestData({
+        timeout: 30000,
+        method: "GET",
+        baseURL: "http://192.168.1.18:8075/",
+        subUrl: "alarm/count/querybyname",
+        data: {
+          stationid: this.stationId,
+          datebegin: this.startDate,
+          dateend: this.endDate,
+          snapid: item["key"]
+        },
+        success(res) {
+          console.log(res);
+        }
+      });
+    }
+  }
+};
+</script>
+<style lang="less">
+.dGrid {
+  height: 70vh;
+  width: 30%;
+  display: inline-block;
+  table {
+    tbody {
+      height: 65vh;
+    }
+  }
+}
+.dChart {
+  background-color: blue;
+  height: 70vh;
+  width: 70%;
+  display: inline-block;
+}
+.dBody {
+  height: 80vh;
+}
+.title {
+  background: rgba(255, 255, 255, 0.1);
+  margin-bottom: 8px;
+  padding: 1vh;
+}
+
+.report-items {
+  display: flex;
+  flex-wrap: wrap;
+  .title {
+    height: 70px;
+    width: 280px;
+    background: fade(@gray, 40);
+    color: @gray-l;
+    font-size: 2vh;
+    margin-left: 7px;
+    margin-right: 7px;
+    margin-top: 7px;
+    margin-bottom: 7px;
+    cursor: pointer;
+    div {
+      width: 100%;
+      display: block;
+      clear: both;
+      text-align: center;
+      &:first-child {
+        margin-bottom: 20px;
+      }
+    }
+  }
+}
+</style>