소스 검색

修改监视列表导航功能

shilin 3 년 전
부모
커밋
0a85d8f6e4
2개의 변경된 파일73개의 추가작업 그리고 12개의 파일을 삭제
  1. 2 2
      public/static/config/modeConfig.js
  2. 71 10
      src/views/WindSite/pages/DraughtFanList.vue

+ 2 - 2
public/static/config/modeConfig.js

@@ -8,8 +8,8 @@ let baseURL = null;
 let websocketUrl = null;
 
 if (localTest) {
-  baseURL = "http://10.155.32.4:8082/" // 联机调试 - 石林
-  // baseURL = "http://10.155.32.33:9001/" // 联机调试 - 谢生杰
+    baseURL = "http://192.168.10.12:8082/" // 联机调试 - 石林
+        // baseURL = "http://10.155.32.33:9001/" // 联机调试 - 谢生杰
 } else {
     baseURL = "http://10.155.32.4:8082/" // 正式环境
 }

+ 71 - 10
src/views/WindSite/pages/DraughtFanList.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="draught-fan-list">
     <div class="btn-group-tabs">
-      <!-- <BtnGroup2 :btnGroups="btnGroups" :rowIndex="0" :index="1" @select="select"></BtnGroup2> -->
+        <BtnGroup2 :btnGroups="btnGroupsss" :rowIndex="rowIndex" :index="selectIndex" @select="select"></BtnGroup2>
     </div>
     <div class="df-table">
       <ComTable :data="data"></ComTable>
@@ -23,7 +23,7 @@ export default {
   // 数据
   data() {
     return {
-      btnGroups: [
+      btnGroupsss: [
         {
           icon: "fa fa-fire",
           btns: [
@@ -216,11 +216,67 @@ export default {
         },
       });
     },
+    getWp () {
+      let that = this;
+      that.API.requestData({
+        method: "GET",
+        subUrl: "powercompare/windfarmAllAjax",
+        success (res) {
+          let btnGroups = [
+            {
+              icon: "svg-wind-site",
+              btns: [],
+            },
+            {
+              icon: "svg-photovoltaic",
+              btns: [],
+            },
+          ];
+
+          res.data.forEach((ele, index) => {
+            if (ele.id.indexOf("FDC") !== -1) {
+              btnGroups[0].btns.push({
+                text: ele.name,
+                code: ele.id,
+              });
+            } else {
+              btnGroups[1].btns.push({
+                text: ele.name,
+                code: ele.id,
+              });
+            }
+          });
+
+          that.btnGroupsss = btnGroups;
+          that.renderBtnActiveIndex();
+        },
+      });
+    },
+
+    renderBtnActiveIndex () {
+      this.btnGroupsss.forEach((pEle, pIndex) => {
+        pEle.btns.forEach((cEle, cIndex) => {
+          if (cEle.code === this.wpId) {
+            this.rowIndex = pIndex;
+            this.selectIndex = cIndex;
+          }
+        });
+      });
+    },
+
+    select (res) {
+      debugger;
+      this.$router.replace({
+        path: `/monitor/windsite/draughtfanlist/${res.code}`,
+      });
+    },
+
   },
 
   created() {
     let that = this;
     that.wpId = that.$route.params.wpId;
+     that.getWp();
     that.$nextTick(() => {
       that.requestData(false);
       that.timmer = setInterval(() => {
@@ -234,8 +290,17 @@ export default {
   unmounted() {
     clearInterval(this.timmer);
     this.timmer = null;
+  },  watch: {
+    $route (res) {
+      this.wpId = res.params.wpId;
+      if (res.params.wpId) {
+        this.requestData(false);
+        this.renderBtnActiveIndex();
+      }
+    },
   },
 };
+
 </script>
 
 <style lang="less">
@@ -245,14 +310,10 @@ export default {
   display: flex;
   flex-direction: column;
 
-  .btn-group-tabs {
-    display: flex;
-    flex-direction: row;
-
-    .photovoltaic {
-      margin-left: 1.481vh;
-    }
-  }
+.btn-group-tabs {
+  display: flex;
+  flex-direction: row;
+}
 
   .df-table {
     border: 0.093vh solid fade(@darkgray, 50%);