Browse Source

feat: 预警管理

wangjunjun 3 years ago
parent
commit
f87dcfe101

+ 1 - 1
src/components/coms/table/table.vue

@@ -13,7 +13,7 @@
           <td
             v-for="(col, i) of data.column"
             :key="i"
-            :style="{ width: col.width }"
+            :style="{ width: col.width, color: row.color }"
             :class="{ light: hoverRow == row || hoverCol == col, num: col.is_num, 'always-light': col.is_light || row.is_light }"
             @mouseenter="hover(row, col)"
             @mouseleave="leave()"

+ 5 - 5
src/router/index.js

@@ -260,11 +260,11 @@ const routes = [
     path: '/performanceAnalysis', // 单机性能分析
     name: 'performanceAnalysis',
     component: () => import('../views/performanceAnalysis/index.vue'),
-    children: [{
-      path: "detail/:wpId",
-      name: "performanceAnalysisDetail",
-      component: () => import("../views/performanceAnalysis/detail/index.vue"),
-    }]
+    // children: [{
+    //   path: "detail/:wpId",
+    //   name: "performanceAnalysisDetail",
+    //   component: () => import("../views/performanceAnalysis/detail/index.vue"),
+    // }]
   },
   {
     path: '/historySearch', // 测点历史数据查询

+ 138 - 21
src/views/NewPages/alarm-center.vue

@@ -2,38 +2,49 @@
   <div class="alarm-center">
     <div class="action-bar">
       <div class="selections mg-b-16">
-        <div class="item" @click="tabSelect(0)" :class="{ active: tabIndex == 0 }">发电机</div>
+        <div v-for="(tabItem, tabIndex) in tabLists" :key="tabItem.type" class="item" :class="{ active: tabIndex == cureent }" @click="tabSelect(tabItem.type, tabIndex)" >
+          {{ tabItem.name }}
+        </div>
+        <!-- <div class="item" @click="tabSelect(0)" :class="{ active: tabIndex == 0 }">发电机</div>
         <div class="item" @click="tabSelect(1)" :class="{ active: tabIndex == 1 }">齿轮箱</div>
         <div class="item" @click="tabSelect(2)" :class="{ active: tabIndex == 2 }">变桨系统</div>
         <div class="item" @click="tabSelect(3)" :class="{ active: tabIndex == 3 }">液压站</div>
         <div class="item" @click="tabSelect(3)" :class="{ active: tabIndex == 4 }">风机震动</div>
-        <div class="item" @click="tabSelect(3)" :class="{ active: tabIndex == 5 }">其他参数</div>
+        <div class="item" @click="tabSelect(3)" :class="{ active: tabIndex == 5 }">其他参数</div> -->
       </div>
       <div class="query mg-b-16">
         <div class="query-items">
           <div class="query-item">
             <div class="lable">风场:</div>
             <div class="search-input">
-              <el-select v-model="value1" clearable placeholder="请选择" popper-class="select">
-                <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
+              <el-select v-model="optSelectValue" clearable placeholder="请选择" popper-class="select" @change="handelSelectChange">
+                <el-option v-for="item in options" :key="item.id" :label="item.name" :value="item.id"> </el-option>
               </el-select>
             </div>
           </div>
         </div>
         <div class="query-actions">
-          <button class="btn green">搜索</button>
+          <button class="btn green" @click="handelSelectChange">搜索</button>
         </div>
       </div>
     </div>
     <el-scrollbar>
       <div class="fj">
+        <div class="fj-item" v-for="(item, index) in tableLists" :key="index">
+          <div class="fj-title">风机编号:{{item[0].wtId}}</div>
+          <div class="fj-info">
+            <Table :data="handleTable(item)"></Table>
+          </div>
+        </div>
+      </div>
+      <!-- <div class="fj">
         <div class="fj-item" v-for="index in 25" :key="index">
           <div class="fj-title">风机编号:000</div>
           <div class="fj-info">
             <Table :data="tableData"></Table>
           </div>
         </div>
-      </div>
+      </div> -->
     </el-scrollbar>
   </div>
 </template>
@@ -44,7 +55,70 @@ export default {
   components: { Table },
   data() {
     return {
-      tableData: {
+      cureent: 0,
+      optSelectValue: '',
+      tabLists: [
+        {
+          type: 'fdj',
+          name: '发电机'
+        },
+        {
+          type: 'clx',
+          name: '齿轮箱'
+        },
+        {
+          type: 'bj',
+          name: '变桨系统'
+        },
+        {
+          type: 'yyz',
+          name: '液压站'
+        },
+        {
+          type: 'zd',
+          name: '风机震动'
+        },
+        {
+          type: 'qt',
+          name: '其他参数'
+        }
+      ],
+      // tableData: {
+      //   column: [
+      //     {
+      //       name: "",
+      //       field: "name",
+      //       is_num: false,
+      //       is_light: false,
+      //     },
+      //     {
+      //       name: "",
+      //       field: "value",
+      //       is_num: false,
+      //       is_light: false,
+      //     },
+      //   ],
+      //   data: [
+      //     // {
+      //     //   name: "发电机绕组U1温度",
+      //     //   desc: "1234.56",
+      //     // },
+      //   ],
+      // },
+      tableLists: [],
+      options: [],
+      type: '',
+      timmer: null, // 遮罩开关
+    };
+  },
+  methods: {
+    tabSelect(type, index) {
+      this.cureent = index
+      this.type = type
+      this.getList(true)
+    },
+    handleTable(item) {
+      let tableData = {
         column: [
           {
             name: "",
@@ -54,27 +128,70 @@ export default {
           },
           {
             name: "",
-            field: "desc",
+            field: "value",
             is_num: false,
             is_light: false,
           },
         ],
-        data: [
-          {
-            name: "发电机绕组U1温度",
-            desc: "1234.56",
+        data: item
+      }
+      return tableData
+    },
+    handelSelectChange() {
+      this.getList(true)
+    },
+    getList(showLoading) {
+      let _this = this
+      _this.API.requestData({
+          showLoading,
+          method: "POST",
+          subUrl: "/temperature/getTemperatureList",
+          data:{
+            type: this.type,
+            wpId: this.optSelectValue
           },
-        ],
-      },
-    };
-  },
-  methods: {
-    tabSelect(tab) {},
+          success(res) {
+            _this.tableLists = res.data
+            // this.tableData.data = res.data
+            // debugger
+            console.log(res)
+          }
+      })
+    },
+
+    getSelectLists(showLoading) {
+      let _this = this
+      _this.API.requestData({
+          showLoading,
+          method: "GET",
+          subUrl: "/powercompare/windfarmAjax",
+          success(res) {
+            _this.options = res.data
+            _this.optSelectValue = res.data[0].id
+            _this.getList(false);
+            // _this.$nextTick(() => {
+            //   _this.getList(false);
+            //   _this.timmer = setInterval(() => {
+            //     _this.getList(false)
+            //   }, _this.$store.state.websocketTimeSec);
+            // });
+          }
+      })
+    }
   },
   created() {
-    for (let i = 1; i < 7; i++) {
-      this.tableData.data.push(JSON.parse(JSON.stringify(this.tableData.data[0])));
-    }
+    // for (let i = 1; i < 7; i++) {
+    //   this.tableData.data.push(JSON.parse(JSON.stringify(this.tableData.data[0])));
+    // }
+    this.type = this.tabLists[0].type
+    this.getSelectLists(false);
+
+    // this.getList()
+  },
+
+  unmounted() {
+    clearInterval(this.timmer);
+    this.timmer = null;
   },
 };
 </script>

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

@@ -107,6 +107,18 @@ export default {
                   path: "/historySearch"
                 }
               ]
+            },
+            {
+              text: "预警记录",
+              icon: "svg-wind-site",
+              path: "/new",
+              children: [
+                {
+                  text: "预警管理",
+                  icon: "svg-wind-site",
+                  path: "/new/alarmcenter"
+                }
+              ]
             }
           ],
         },